This plugin integrates Amazon Web Services (AWS) functionality into the Cheshire Cat AI, providing tools for AWS IAM policy testing, access management, and cost analysis.
- Python 3.7 or higher
- Cheshire Cat AI platform
- AWS account with appropriate permissions
boto3andtabulatePython libraries
- AWS IAM Policy Testing
- Access Management for AWS Resources
- Search for Users and Roles with Specific Permissions
- Check Access Rights for Specific IAM Identities
- AWS Cost Analysis with Tag Filtering
To use this plugin, you need to configure your AWS credentials. You can do this in one of the following ways:
- IAM Role: Enable IAM role if your machine has the necessary permissions.
- AWS Credentials Profile: Provide a profile name from your AWS credentials file.
- Access Key and Secret: Directly provide your AWS access key ID and secret access key.
Configuration is done through the AWSSettings class in aws_integration.py. To set up the plugin:
- Open the Cheshire Cat AI settings.
- Navigate to the AWS Integration Plugin section.
- Enter your AWS credentials or choose the authentication method.
- Save the settings.
Make sure to keep your AWS credentials secure and never share them publicly.
When running Cheshire Cat AI in a Docker environment, you need to mount your AWS credentials file to make it accessible to the container. Update your docker-compose.yml file with the following volume mount:
volumes:
- ./core:/app
- $HOME/.aws/credentials:/root/.aws/credentials:roThis mounts your local AWS credentials file into the Docker container in read-only mode.
-
Using AWS CLI Profile (Local Development)
- Ensure your AWS CLI is configured with the correct profile.
- In the plugin settings, provide your profile name.
- Mount your credentials as shown in the Docker configuration above.
-
Using IAM Role (In AWS Environment)
- Enable the "IAM role assigned" option in the plugin settings.
- Ensure your EC2 instance or ECS task has the necessary IAM role attached.
-
Using Access Key and Secret Key (Universal)
- Provide your AWS Access Key ID and Secret Access Key in the plugin settings.
- Alternatively, set the following environment variables:
export AWS_ACCESS_KEY_ID=your_access_key export AWS_SECRET_ACCESS_KEY=your_secret_key export AWS_DEFAULT_REGION=your_preferred_region
For more information on configuring AWS credentials, refer to the AWS CLI Environment Variables documentation.
Use the SearchAccessForm to find which users and roles have access to specific actions and resources.
Example:
form_data = {
"action": "s3:ListBucket",
"resource": "*"
}
search_form = SearchAccessForm()
result = search_form.submit(form_data)
print(result["output"])Use the CheckAccessForm to verify if a specific IAM identity has permissions for certain actions and resources.
Example:
form_data = {
"identity": "arn:aws:iam::123456789012:user/example-user",
"action": "s3:ListBucket",
"resource": "*"
}
check_form = CheckAccessForm()
result = check_form.submit(form_data)
print(result["output"])Use the get_aws_cost_analysis tool to analyze AWS costs for a specified time period, with optional tag filtering.
Example usage:
# Analyze costs for the last 30 days
result = get_aws_cost_analysis("30")
# Analyze costs for the last 7 days, filtered by the tag "project:website"
result = get_aws_cost_analysis("7 project:website")
print(result)The tool accepts input in the format: "<days> [tag_key:tag_value]". If no tag is specified, it will analyze all costs for the given period.
To start developing or modifying this plugin:
- Clone this repository into your Cheshire Cat AI's
pluginsfolder. - Install the required dependencies (boto3, tabulate).
- Modify the Python files as needed.
- Update the
plugin.jsonfile with any new version or configuration changes.
Important A new release of your plugin is triggered every time you set a new
versionin theplugin.jsonfile. Please, remember to set it correctly every time you want to release an update.
The AWS Integration Plugin includes error handling to manage common issues:
- If an AWS API call fails, the plugin will return an error message with details about the failure.
- For debugging purposes, you can enable debug mode in the
AwsIamPolicyTesterclass by settingdebug=Truewhen initializing it.
If you encounter any issues:
- Check your AWS credentials and ensure they have the necessary permissions.
- Verify that your AWS region is set correctly in the plugin configuration.
- Look for error messages in the Cheshire Cat AI logs.
- If the issue persists, you can open an issue on the plugin's GitHub repository with a detailed description of the problem and any relevant error messages.