Maintainers
This module is part of the cetmix/cetmix-tower project on GitHub.
You are welcome to contribute.
⚠️ DISCLAIMER: TECHNICAL MODULE
This module integrates Boto3 library, the Amazon Web Services (AWS) Software Development Kit (SDK) for Python, into the Cetmix Tower.
This is a technical module intended for system administrators or DevOps professionals. It may involve server configuration, infrastructure management, or advanced setup outside the standard Odoo interface. Not intended for direct use by end users.
Table of contents
Although Amazon Web Services (AWS) allows API calls without using an SDK, we found that integrating the Amazon SDK into Cetmix Tower makes provisioning, configuring, and maintaining AWS instances more convenient for the end user. However, not all Cetmix Tower users require this functionality, so to avoid overloading the system, we have included it in a separate module.
Prerequisites
The module has boto3 defined in its external dependencies, which means, you should install the Python boto3 package manually if you don’t have automatic package installation configured in your Odoo environment. Run pip install boto3 to install it.
Setting up AWS Access
Create AWS Access Keys
To use the AWS integration with Cetmix Tower, you need to create AWS access keys:
Configure AWS Secrets in Cetmix Tower
Create two secrets in Cetmix Tower to store your AWS credentials:
Note: These secrets will be accessible as #!cxtower.secret.aws_access_key!# and #!cxtower.secret.aws_secret_access_key!# in your commands.
Configure AWS Region
Create a variable to define your AWS region:
Please check the official Boto3 Documentation (https://boto3.amazonaws.com/v1/documentation/api/latest/index.html) for the detailed information about the services and methods provided by the Boto3 library.
Disclaimer: The following example demonstrates one of many possible commands you can create and run with this module. The boto3 library provides access to the full range of AWS services and methods - this is just a starting point to help you get familiar with the integration.
Go to the Code tab
Enter the following Python code:
# List EC2 instances using boto3 result = {"exit_code": 0, "message": None} session = boto3.Session( aws_access_key_id=#!cxtower.secret.aws_access_key!#, aws_secret_access_key=#!cxtower.secret.aws_secret_access_key!#, region_name={{ aws_region_name }} ) ec2 = session.client('ec2') instances = ec2.describe_instances() instance_details = [] for reservation in instances['Reservations']: for instance in reservation['Instances']: instance_detail = "Instance ID: " + instance['InstanceId'] instance_detail += ", Type: " + instance.get('InstanceType', 'Unknown') instance_detail += ", State: " + instance.get('State', {}).get('Name', 'Unknown') instance_details.append(instance_detail) if instance_details: result["message"] = "Found " + str(len(instance_details)) + " EC2 instances:\n" + "\n".join(instance_details) else: result["message"] = "No EC2 instances found"
For a successful execution with EC2 instances:
Found 3 EC2 instances: Instance ID: i-0abc123def456789, Type: t2.micro, State: running Instance ID: i-0def456abc789123, Type: t3.medium, State: stopped Instance ID: i-0789abc123def456, Type: m5.large, State: running
For a successful execution with no EC2 instances:
No EC2 instances found
The cetmix_tower_aws module provides access to the boto3 Python library for AWS service integration. Here are some common services you can use:
# Standard client initialization pattern client = boto3.client( 'service_name', # Replace with: ec2, s3, rds, cloudwatch, etc. region_name={{ aws_region_name }}, aws_access_key_id=#!cxtower.secret.aws_access_key!#, aws_secret_access_key=#!cxtower.secret.aws_secret_access_key!# ) # Or use resource interface for object-oriented access resource = boto3.resource( 'service_name', # Replace with: ec2, s3, etc. region_name={{ aws_region_name }}, aws_access_key_id=#!cxtower.secret.aws_access_key!#, aws_secret_access_key=#!cxtower.secret.aws_secret_access_key!# )
Popular AWS services include: EC2 (compute), S3 (storage), RDS (databases), and CloudWatch (monitoring).
For more details, see the AWS Boto3 Documentation.
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed feedback.
Do not contact contributors directly about support or help with technical issues.
This module is part of the cetmix/cetmix-tower project on GitHub.
You are welcome to contribute.