⬡ Hub
Skip to content

aws_ai_agents

AWS AI Agent Framework

This project is a Python-based framework for creating and managing a system of AI agents to interact with Amazon Web Services (AWS). You can issue natural language commands to the framework, and the agents will perform the corresponding actions on your AWS account.

Architecture

The system is designed with a modular and extensible architecture that separates concerns between understanding commands, routing them, and executing them.

Architecture Diagram

  1. CLI Entrypoint (main.py):

    • The user interacts with the system through this command-line interface.
    • It accepts natural language commands as input.
  2. Agent Manager (agent_manager.py):

    • This is the central orchestrator.
    • It receives the raw command from the CLI.
    • It contains a simple parser to determine the user's intent, identifying the target service (e.g., EC2, S3), the action (e.g., list), and any parameters (e.g., a region).
    • It then routes the parsed command to the appropriate specialized agent.
  3. Specialized Agents (aws_agents/):

    • Each agent is an expert for a specific AWS service.
    • ec2_agent.py: Handles all commands related to EC2 (e.g., listing instances).
    • s3_agent.py: Handles all commands related to S3 (e.g., listing buckets).
    • All agents inherit from a BaseAgent class, ensuring a consistent interface.
  4. AWS Connector (aws_connector.py):

    • This module manages the connection to AWS using the boto3 SDK.
    • It implements a singleton pattern to ensure only one AWS session is active, which is efficient and helps with consistent credential management.
    • It provides helper methods to get AWS clients and resources.

Setup

Follow these steps to set up and run the AWS AI Agent framework.

1. Prerequisites

  • Python 3.7+
  • An AWS account

2. Configure AWS Credentials

Before running the application, you must configure your AWS credentials. The application uses the standard boto3 credential discovery chain. The recommended way is to use the AWS CLI:

aws configure

Enter your AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format.

Alternatively, you can set environment variables:

export AWS_ACCESS_KEY_ID=YOUR_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET
export AWS_DEFAULT_REGION=us-east-1

3. Install Dependencies

Navigate to the project directory and install the required Python packages from the requirements.txt file.

cd aws_ai_agents
pip install -r requirements.txt

Usage

To use the agent framework, you run main.py from the command line, followed by your command in plain English. The command should be enclosed in quotes if it contains spaces.

Workflow Commands (V2.0)

Create a Complete Web Application Stack:

This is the most powerful command, demonstrating multi-agent orchestration. It builds a complete, load-balanced web application environment from scratch.

python main.py "create-web-app named my-production-app in us-east-1"

This single command will automatically orchestrate the following: 1. VPC Agent: Creates a new, best-practice VPC with public and private subnets, an Internet Gateway, a NAT Gateway, and all required route tables. 2. EC2 Agent: Creates a new security group and launches a new EC2 instance in the private subnet. 3. ELB Agent: Creates a public Application Load Balancer, a target group, and a listener, then registers the new EC2 instance as a target.

Troubleshoot Web Application Stack:

This command orchestrates multiple agents to diagnose issues within a web application environment.

python main.py "troubleshoot web-app named my-production-app in us-east-1"

This command will automatically: 1. Check the health of the Load Balancer and its associated Target Group. 2. Check the health and status of the underlying EC2 instance(s). 3. Analyze Security Groups to ensure proper traffic flow. 4. Provide a summary of findings and potential recommendations.

Smart Create EKS Cluster (V2.0):

This is our most advanced workflow, building a production-ready EKS cluster from a single command.

python main.py "eks smart-create cluster named my-prod-cluster in us-west-2 instance-types t3.large"

This command will automatically orchestrate the following: 1. IAM Agent: Creates the required IAM roles for the EKS cluster, its node group, EBS CSI driver, EFS CSI driver, and AWS Load Balancer Controller. 2. VPC Agent: Creates a new, best-practice VPC with public and private subnets. 3. EKS Agent: Creates the EKS cluster control plane and a managed node group with the specified instance types (defaults to t3.medium). 4. EKS Agent: Installs the EBS CSI Driver, EFS CSI Driver, and prepares for the AWS Load Balancer Controller installation.### EC2 Commands

Smart Create EC2 Instance (V2.0):

This is an intelligent command that automatically handles prerequisites.

python main.py "ec2 create instance named my-web-server with ubuntu type t3.large in us-east-1"

This command will automatically: - Find the latest Ubuntu 22.04 or Amazon Linux 2 AMI. - Create a new security group with ports 80 (HTTP) and 22 (SSH) open. - Use the default VPC and a default subnet in the specified region. - Launch an instance with the given name and specified type (defaults to t3.micro if not provided).

List EC2 Instances:

python main.py "ec2 list instances in us-west-2"

Start EC2 Instances:

python main.py "ec2 start instance i-0123456789abcdef0 in us-west-2"

Stop EC2 Instances:

python main.py "ec2 stop instances i-0123456789abcdef0 i-0987654321fedcba0 in us-west-2"

Terminate EC2 Instances (with safety prompt):

python main.py "ec2 terminate instance i-0123456789abcdef0 in us-west-2"

When you issue a terminate command, the agent will ask for confirmation before proceeding:

WARNING: You are about to terminate the following instances: i-0123456789abcdef0
Are you sure you want to proceed? (yes/no): yes

EC2 Commands

List Instances:

python main.py "ec2 list instances in us-east-1"

Start Instances:

python main.py "ec2 start i-1234567890abcdef0 i-0fedcba9876543210 in us-east-1"

Stop Instances:

python main.py "ec2 stop i-1234567890abcdef0 in us-east-1"

Terminate Instances (with safety prompt):

python main.py "ec2 terminate i-1234567890abcdef0 in us-east-1"

Create Instance:

python main.py "ec2 create instance named my-new-instance with ubuntu type t3.micro in us-east-1"

List Idle Instances:

This command lists potentially idle EC2 instances based on low CPU utilization.

python main.py "ec2 list idle-instances in us-east-1 threshold 5.0 period-days 7"

This command will automatically: - Identify running EC2 instances with average CPU utilization below the specified threshold (default 5.0%) over the last specified number of days (default 7).

S3 Commands

Smart Create S3 Bucket (V2.0):

This is an intelligent command that automatically handles prerequisites and best practices.

python main.py "s3 smart-create bucket my-unique-smart-bucket in us-east-1 logging-bucket my-s3-logs"

This command will automatically: - Create an S3 bucket with Block Public Access enabled. - Enable default encryption (SSE-S3). - Optionally configure server access logging to a specified logging bucket (which will also be created with best practices if it doesn't exist).

List S3 Buckets:

python main.py "s3 list buckets"

Create S3 Bucket:

python main.py "s3 create bucket my-unique-bucket-name-12345 in us-west-2"

Delete S3 Bucket (with safety prompt):

python main.py "s3 delete bucket my-unique-bucket-name-12345"

IAM Commands

List IAM Users:

python main.py "iam list users"

Create IAM User:

python main.py "iam create user new-test-user"

Delete IAM User (with safety prompt):

python main.py "iam delete user new-test-user"

Create EKS Cluster Role (with safety prompt):

python main.py "iam create eks-cluster-role my-eks-cluster-role"

Create EKS Node Group Role (with safety prompt):

python main.py "iam create eks-nodegroup-role my-eks-nodegroup-role"

S3 Commands

List Buckets:

python main.py "s3 list buckets"

Create Bucket:

python main.py "s3 create bucket my-unique-bucket-name in us-east-1"

Smart Create Bucket:

python main.py "s3 smart-create bucket my-secure-bucket in us-east-1 logging-bucket my-logging-bucket"

Delete Bucket (with safety prompt):

python main.py "s3 delete bucket my-unique-bucket-name"

Analyze Bucket Cost Optimization:

This command analyzes an S3 bucket for cost optimization opportunities.

python main.py "s3 analyze bucket-cost-optimization my-large-bucket"

This command will automatically: - Retrieve information about the specified S3 bucket. - Suggest potential lifecycle policies to reduce storage costs based on bucket size and object access patterns.

VPC Commands

Smart Create VPC Environment (V2.0):

This is an intelligent command that automatically builds a best-practice VPC environment.

python main.py "vpc smart-create named my-app-vpc in us-east-1 public-subnets 2 private-subnets 2"

This command will automatically create: - A VPC with a /16 CIDR block (or specified CIDR). - The specified number of public and private subnets across different Availability Zones. - An Internet Gateway and a NAT Gateway. - All necessary route tables and associations for a public/private setup.

Create VPC (with safety prompt):**

python main.py "vpc create vpc with cidr 10.10.0.0/16 in us-west-2"

Create Subnet (with safety prompt):

python main.py "vpc create subnet in vpc vpc-0123456789abcdef0 with cidr 10.10.1.0/24 in us-west-2"

RDS Commands

Smart Create DB Instance (V2.0):

This is an intelligent command that automatically handles prerequisites.

python main.py "rds smart-create db instance my-app-db engine postgres username dbadmin password MySecurePassword123 in us-east-1"

This command will automatically: - Use an existing VPC or find the default VPC. - Create a new DB Subnet Group. - Create a new Security Group for the DB, allowing ingress from within the VPC. - Create an RDS instance with sensible defaults (e.g., db.t3.micro, 20GB storage).

Troubleshoot DB Instance (V2.0):

This command orchestrates multiple agents to diagnose issues within an RDS DB instance.

python main.py "rds troubleshoot db instance my-app-db in us-east-1"

This command will automatically: 1. Check the status of the DB instance. 2. Check CloudWatch metrics (CPU, connections) for potential performance issues. 3. Analyze Security Groups to ensure proper connectivity. 4. Provide a report with its findings and recommendations.

Create DB Instance (with safety prompt):**

python main.py "rds create db instance my-postgres-db engine postgres class db.t3.micro storage 20 username dbadmin password MySecurePassword123 in us-west-2"

Create DB Instance with Security Groups and Subnet Group (with safety prompt):

python main.py "rds create db instance my-secure-db engine mysql class db.t3.small storage 50 username adminuser password AnotherSecurePass456 in us-east-1 security-groups sg-0abcdef1234567890 sg-0fedcba9876543210 subnet-group my-db-subnet-group"

CloudWatch Commands

Smart Create CPU Alarm (V2.0):

This is an intelligent command that creates a CloudWatch alarm for high CPU utilization on an EC2 instance.

python main.py "cloudwatch smart-create cpu-alarm for i-0123456789abcdef0 in us-east-1 threshold 90 sns-topic arn:aws:sns:us-east-1:123456789012:my-sns-topic"

This command will automatically: - Create a CloudWatch alarm that triggers when the specified EC2 instance's CPU utilization exceeds a threshold (defaults to 80%). - Send a notification to the specified SNS topic (optional).

List CloudWatch Alarms:

python main.py "cloudwatch list alarms in us-east-1"

List CloudWatch Dashboards:

python main.py "cloudwatch list dashboards in us-west-2"

CloudTrail Commands

List CloudTrail Trails:

python main.py "cloudtrail list trails in us-east-1"

Describe CloudTrail Trails:

python main.py "cloudtrail describe trails in us-west-2"

Cost Management Commands

List Budgets:

python main.py "cost list budgets"

Get Last Month's Cost:

python main.py "cost get monthly cost"

Get Cost Optimization Suggestions:

python main.py "cost get optimization suggestions"

Secrets Manager Commands

List Secrets:

python main.py "secretsmanager list secrets in us-east-1"

Get Secret Metadata:

Note: For security, this command retrieves metadata about the secret, not the secret value itself.

python main.py "secretsmanager get secret my/secret/name in us-east-1"

ACM Commands

List Certificates:

python main.py "acm list certificates in us-east-1"

Route 53 Commands

List Hosted Zones:

python main.py "route53 list hosted-zones"

List Resource Record Sets:

python main.py "route53 list resource-record-sets in zone Z0123456789ABCDEF01234"

ELB Commands

Smart Create Application Load Balancer (V2.0):

This is an intelligent command that creates an ALB, Target Group, and Listener.

python main.py "elb smart-create alb named my-web-alb in us-east-1"

This command will automatically: - Create an internet-facing Application Load Balancer. - Create a target group for HTTP traffic on port 80. - Create a listener for HTTP traffic on port 80, forwarding to the target group. - Automatically create a VPC and subnets if not explicitly provided. - Automatically create a security group allowing HTTP traffic if not explicitly provided.

List Load Balancers:

python main.py "elb list loadbalancers in us-east-1"

Lambda Commands

Smart Create Lambda Function (V2.0):

This is an intelligent command that creates a simple "hello world" Python Lambda function.

python main.py "lambda smart-create function my-hello-world-function in us-east-1"

This command will automatically: - Create a new IAM role with basic Lambda execution permissions. - Create a Python 3.9 Lambda function with a simple "Hello from Lambda!" handler.

List Functions:

python main.py "lambda list functions in us-east-1"

Autoscaling Commands

List Auto Scaling Groups:

python main.py "autoscaling list autoscaling-groups in us-east-1"

OpenSearch Commands

Troubleshoot OpenSearch Domain (V2.0):

This command diagnoses issues within an OpenSearch domain.

python main.py "opensearch troubleshoot domain my-search-domain in us-east-1"

This command will automatically: 1. Check the status and health of the OpenSearch domain. 2. Provide a report with its findings and recommendations.

Create OpenSearch Domain (with safety prompt):

python main.py "opensearch create domain my-search-domain version OpenSearch_2.3 type t3.small.search count 1 size 10 in us-west-2"

SQS Commands

Smart Create Queue (V2.0):

This command creates a standard SQS queue.

python main.py "sqs smart-create queue my-message-queue in us-east-1 message-retention-period 604800 visibility-timeout 60"

This command will automatically: - Create a standard SQS queue with the specified name. - Configure message retention period (defaults to 4 days) and visibility timeout (defaults to 30 seconds).

SQS Commands

Smart Create Queue (V2.0):

This command creates a standard SQS queue.

python main.py "sqs smart-create queue my-message-queue in us-east-1 message-retention-period 604800 visibility-timeout 60"

This command will automatically: - Create a standard SQS queue with the specified name. - Configure message retention period (defaults to 4 days) and visibility timeout (defaults to 30 seconds).

GCP Usage

To use the GCP agent framework, you run main.py with --platform gcp, followed by your command in plain English.

Compute Engine Commands

Smart Create Instance:

python main.py --platform gcp "compute smart-create instance my-gcp-vm type e2-medium image-project debian-cloud image-family debian-11 in us-central1-a"

This command will automatically: - Create a Compute Engine instance with the specified name, machine type, and image. - Use the default network and assign an external IP.

List Instances:

python main.py --platform gcp "compute list instances in us-central1-a"

Start Instance:

python main.py --platform gcp "compute start instance my-gcp-vm in us-central1-a"

Stop Instance:

python main.py --platform gcp "compute stop instance my-gcp-vm in us-central1-a"

Delete Instance (with safety prompt):

python main.py --platform gcp "compute delete instance my-gcp-vm in us-central1-a"

Compute Engine Commands

Smart Create Instance:

python main.py --platform gcp "compute smart-create instance my-gcp-vm type e2-medium image-project debian-cloud image-family debian-11 in us-central1-a"

This command will automatically: - Create a Compute Engine instance with the specified name, machine type, and image. - Use the default network and assign an external IP.

List Instances:

python main.py --platform gcp "compute list instances in us-central1-a"

Start Instance:

python main.py --platform gcp "compute start instance my-gcp-vm in us-central1-a"

Stop Instance:

python main.py --platform gcp "compute stop instance my-gcp-vm in us-central1-a"

Delete Instance (with safety prompt):

python main.py --platform gcp "compute delete instance my-gcp-vm in us-central1-a"

Cloud Storage Commands

Smart Create Bucket:

python main.py --platform gcp "storage smart-create bucket my-unique-gcp-bucket in US"

This command will automatically: - Create a Cloud Storage bucket with the specified name. - Enforce uniform bucket-level access. - Use standard storage class and specified location.

List Buckets:

python main.py --platform gcp "storage list buckets"

Delete Bucket (with safety prompt):

python main.py --platform gcp "storage delete bucket my-unique-gcp-bucket"

Cloud Storage Commands

Smart Create Bucket:

python main.py --platform gcp "storage smart-create bucket my-unique-gcp-bucket in US"

This command will automatically: - Create a Cloud Storage bucket with the specified name. - Enforce uniform bucket-level access. - Use standard storage class and specified location.

List Buckets:

python main.py --platform gcp "storage list buckets"

Delete Bucket (with safety prompt):

python main.py --platform gcp "storage delete bucket my-unique-gcp-bucket"

Cloud SQL Commands

Smart Create Instance:

python main.py --platform gcp "sql smart-create instance my-sql-instance version POSTGRES_14 tier db-f1-micro in us-central1"

This command will automatically: - Create a Cloud SQL instance with the specified name, database version, and machine type. - Enable automatic backups and SSL.

Cloud SQL Commands

Smart Create Instance:

python main.py --platform gcp "sql smart-create instance my-sql-instance version POSTGRES_14 tier db-f1-micro in us-central1"

This command will automatically: - Create a Cloud SQL instance with the specified name, database version, and machine type. - Enable automatic backups and SSL.

Cloud Functions Commands

Smart Create Function:

This command creates a simple "hello world" Cloud Function.

python main.py --platform gcp "functions smart-create function my-http-function runtime python39 in us-central1"

This command will automatically: - Create a Cloud Function with a basic "Hello World!" Python 3.9 runtime. - Configure an HTTP trigger (default) or a Pub/Sub trigger if specified.

Cloud Functions Commands

Smart Create Function:

This command creates a simple "hello world" Cloud Function.

python main.py --platform gcp "functions smart-create function my-http-function runtime python39 in us-central1"

This command will automatically: - Create a Cloud Function with a basic "Hello World!" Python 3.9 runtime. - Configure an HTTP trigger (default) or a Pub/Sub trigger if specified.

VPC Network Commands

Smart Create Network:

This command creates a VPC network.

python main.py --platform gcp "network smart-create network my-gcp-network auto-create-subnetworks true"

This command will automatically: - Create a VPC network with the specified name. - Optionally create subnetworks automatically (default is true).

VPC Network Commands

Smart Create Network:

This command creates a VPC network.

python main.py --platform gcp "network smart-create network my-gcp-network auto-create-subnetworks true"

This command will automatically: - Create a VPC network with the specified name. - Optionally create subnetworks automatically (default is true).

GKE Commands

Smart Create Cluster:

This command creates a Google Kubernetes Engine (GKE) cluster.

python main.py --platform gcp "gke smart-create cluster my-gke-cluster in us-central1 machine-type e2-medium num-nodes 2"

This command will automatically: - Create a GKE cluster with the specified name, machine type, and number of nodes. - Configure default OAuth scopes and enable Workload Identity.

GKE Commands

Smart Create Cluster:

This command creates a Google Kubernetes Engine (GKE) cluster.

python main.py --platform gcp "gke smart-create cluster my-gke-cluster in us-central1 machine-type e2-medium num-nodes 2 anthos-enabled true"

This command will automatically: - Create a GKE cluster with the specified name, machine type, and number of nodes. - Configure default OAuth scopes and enable Workload Identity. - Optionally enable Anthos-related features, making the cluster ready for Anthos registration.

Azure Usage

To use the Azure agent framework, you run main.py with --platform azure --subscription <your-subscription-id>, followed by your command in plain English.

VM Commands

Smart Create VM:

python main.py --platform azure --subscription <your-subscription-id> "vm smart-create vm my-azure-vm resource-group my-rg in eastus image Canonical UbuntuServer 18.04-LTS size Standard_B1s username azureuser password MySecurePassword123"

This command will automatically: - Create a Virtual Machine with the specified name, image, size, and admin credentials. - Automatically create a VNet, Subnet, Public IP, and Network Interface if they don't exist.

List VMs:

python main.py --platform azure --subscription <your-subscription-id> "vm list vms resource-group my-rg"

Start VM:

python main.py --platform azure --subscription <your-subscription-id> "vm start vm my-azure-vm resource-group my-rg"

Stop VM:

python main.py --platform azure --subscription <your-subscription-id> "vm stop vm my-azure-vm resource-group my-rg"

Delete VM (with safety prompt):

python main.py --platform azure --subscription <your-subscription-id> "vm delete vm my-azure-vm resource-group my-rg"

Storage Account Commands

Smart Create Storage Account:

python main.py --platform azure --subscription <your-subscription-id> "storage smart-create storage-account mystorageaccount resource-group my-rg in eastus"

This command will automatically: - Create a Storage Account with the specified name, using sensible defaults (Standard_LRS, StorageV2, HTTPS only, TLS 1.2, no public blob access).

List Storage Accounts:

python main.py --platform azure --subscription <your-subscription-id> "storage list storage-accounts resource-group my-rg"

Delete Storage Account (with safety prompt):

python main.py --platform azure --subscription <your-subscription-id> "storage delete storage-account mystorageaccount resource-group my-rg"

SQL Database Commands

Smart Create SQL Database:

python main.py --platform azure --subscription <your-subscription-id> "sql smart-create sql-database server mysqldbserver database mydatabase username sqladmin password MySecurePassword123 resource-group my-rg in eastus"

This command will automatically: - Create an Azure SQL Server (if it doesn't exist) and an Azure SQL Database. - Configure the database with a Basic SKU (5 DTUs).

BigQuery Commands

Run Query:

This command runs a SQL query in BigQuery.

python main.py --platform gcp "bigquery run query \"SELECT * FROM `project.dataset.table` LIMIT 10\""

This command will automatically: - Execute the specified SQL query in BigQuery. - Return the query results.

BigQuery Commands

Run Query:

This command runs a SQL query in BigQuery.

python main.py --platform gcp "bigquery run query \"SELECT * FROM `project.dataset.table` LIMIT 10\""

This command will automatically: - Execute the specified SQL query in BigQuery. - Return the query results.

Pub/Sub Commands

Smart Create Topic:

This command creates a Cloud Pub/Sub topic.

python main.py --platform gcp "pubsub smart-create topic my-new-topic"

This command will automatically: - Create a Pub/Sub topic with the specified name.

Pub/Sub Commands

Smart Create Topic:

This command creates a Cloud Pub/Sub topic.

python main.py --platform gcp "pubsub smart-create topic my-new-topic"

This command will automatically: - Create a Pub/Sub topic with the specified name.

Vertex AI Commands

Smart Create Notebook Instance:

This command creates a Vertex AI Workbench notebook instance.

python main.py --platform gcp "vertexai smart-create notebook my-ml-notebook in us-central1 machine-type n1-standard-2"

This command will automatically: - Create a Vertex AI Workbench notebook instance with the specified name, machine type, and image.

Vertex AI Commands

Smart Create Notebook Instance:

This command creates a Vertex AI Workbench notebook instance.

python main.py --platform gcp "vertexai smart-create notebook my-ml-notebook in us-central1 machine-type n1-standard-2"

This command will automatically: - Create a Vertex AI Workbench notebook instance with the specified name, machine type, and image.

Vision AI Commands

Analyze Image Labels:

This command detects labels in an image stored in a Cloud Storage bucket.

python main.py --platform gcp "visionai analyze image-labels in bucket my-image-bucket object photos/dog.jpg max-labels 5"

This command will automatically: - Analyze the specified image in Cloud Storage. - Return a list of detected labels with their confidence scores.

Vision AI Commands

Analyze Image Labels:

This command detects labels in an image stored in a Cloud Storage bucket.

python main.py --platform gcp "visionai analyze image-labels in bucket my-image-bucket object photos/dog.jpg max-labels 5"

This command will automatically: - Analyze the specified image in Cloud Storage. - Return a list of detected labels with their confidence scores.

Language AI Commands

Analyze Sentiment:

This command detects the sentiment of a given text.

python main.py --platform gcp "languageai analyze sentiment for text \"I love working with GCP!\""

This command will automatically: - Analyze the sentiment of the provided text. - Return the sentiment score and magnitude.

Language AI Commands

Analyze Sentiment:

This command detects the sentiment of a given text.

python main.py --platform gcp "languageai analyze sentiment for text \"I love working with GCP!\""

This command will automatically: - Analyze the sentiment of the provided text. - Return the sentiment score and magnitude.

Text-to-Speech Commands

Synthesize Speech:

This command synthesizes speech from text and saves it to a local file.

python main.py --platform gcp "texttospeech synthesize speech for text \"Hello, this is a test.\" output-file gcp_output.mp3 language-code en-US gender NEUTRAL"

This command will automatically: - Convert the provided text into speech using Cloud Text-to-Speech. - Save the generated audio file to a local file.

Text-to-Speech Commands

Synthesize Speech:

This command synthesizes speech from text and saves it to a local file.

python main.py --platform gcp "texttospeech synthesize speech for text \"Hello, this is a test.\" output-file gcp_output.mp3 language-code en-US gender NEUTRAL"

This command will automatically: - Convert the provided text into speech using Cloud Text-to-Speech. - Save the generated audio file to a local file.

IAM Commands

Smart Create Service Account:

This command creates a service account and attaches a specified role.

python main.py --platform gcp "iam smart-create service-account my-app-sa display-name \"My Application Service Account\" role roles/viewer"

This command will automatically: - Create a service account with the specified ID and display name. - Attach the specified IAM role to the service account.

IAM Commands

Smart Create Service Account:

This command creates a service account and attaches a specified role.

python main.py --platform gcp "iam smart-create service-account my-app-sa display-name \"My Application Service Account\" role roles/viewer"

This command will automatically: - Create a service account with the specified ID and display name. - Attach the specified IAM role to the service account.

Security Command Center (SCC) Commands

Smart Enable SCC:

This command conceptually enables Security Command Center for a project.

python main.py --platform gcp "scc smart-enable scc for project my-gcp-project-id"

This command will automatically: - Simulate enabling SCC for the specified project. (Note: Full SCC enablement is typically an organization-level task).

Security Command Center (SCC) Commands

Smart Enable SCC:

This command conceptually enables Security Command Center for a project.

python main.py --platform gcp "scc smart-enable scc for project my-gcp-project-id"

This command will automatically: - Simulate enabling SCC for the specified project. (Note: Full SCC enablement is typically an organization-level task).

Cost Management Commands

Get Cost Trends:

This command retrieves simulated cost trends for a project.

python main.py --platform gcp "cost-management get cost-trends for 30 days"

This command will automatically: - Return simulated cost trend data for the specified project over the last 30 days.

Config Commands

Smart Enable Config:

This command enables AWS Config in a specified region.

python main.py "config smart-enable config in us-east-1 s3-bucket my-config-bucket"

This command will automatically: - Create an S3 bucket (if it doesn't exist) for Config data. - Create an IAM role for Config. - Create a configuration recorder and delivery channel. - Start the configuration recorder.

List Compliance by Resource:

This command lists non-compliant resources based on AWS Config rules.

python main.py "config list compliance-by-resource in us-east-1 resource-type AWS::EC2::Instance compliance-type NON_COMPLIANT"

This command will automatically: - Retrieve and display a list of non-compliant resources, optionally filtered by resource type and compliance type.

SNS Commands

Smart Create Topic and Subscribe Email (V2.0):

This command creates an SNS topic and subscribes an email address to it.

python main.py "sns smart-create topic my-alerts email my-email@example.com in us-east-1"

This command will automatically: - Create an SNS topic with the specified name. - Subscribe the provided email address to the topic (requires confirmation from the email recipient).

Config Commands

Smart Enable AWS Config (V2.0):

This command enables AWS Config in a specified region.

python main.py "config smart-enable bucket my-config-bucket-12345 in us-east-1"

This command will automatically: - Create an S3 bucket (if it doesn't exist) for Config history and snapshots. - Create an IAM role for AWS Config. - Create a configuration recorder and delivery channel. - Start the configuration recorder to monitor all supported resources.

WAF Commands

Smart Create Web ACL:

This command creates a WAF Web ACL with a common managed rule set.

python main.py "waf smart-create web-acl my-web-acl in us-east-1 scope REGIONAL default-action allow"

This command will automatically: - Create a WAF Web ACL with the specified name and scope. - Configure a default action (allow or block). - Add the AWSManagedRulesCommonRuleSet.

Troubleshoot Web ACL:

This command retrieves and displays details about a WAF Web ACL.

python main.py "waf troubleshoot web-acl my-web-acl in us-east-1 scope REGIONAL"

This command will automatically: - Fetch and display the configuration, rules, and default action of the specified Web ACL.

IAM Commands

List Users:

python main.py "iam list users"

List Roles:

python main.py "iam list roles"

List Policies:

python main.py "iam list policies"

Create User:

python main.py "iam create user my-new-user"

Delete User (with safety prompt):

python main.py "iam delete user my-old-user"

Create EKS Cluster Role:

python main.py "iam create eks-cluster-role role my-eks-cluster-role"

Create EKS Nodegroup Role:

python main.py "iam create eks-nodegroup-role role my-eks-nodegroup-role"

Create Lambda Execution Role:

python main.py "iam create lambda-execution-role role my-lambda-role"

GuardDuty Commands

Smart Enable GuardDuty (V2.0):

This command enables AWS GuardDuty in a specified region.

python main.py "guardduty smart-enable in us-east-1"

This command will automatically: - Enable GuardDuty in the specified region. - Create a GuardDuty detector if one does not already exist.

WAF Commands

Smart Create Web ACL (V2.0):

This command creates a WAF Web ACL with a common managed rule set.

python main.py "waf smart-create web-acl my-web-acl in us-east-1 scope REGIONAL default-action allow"

This command will automatically: - Create a WAF Web ACL with the specified name and scope. - Add the AWSManagedRulesCommonRuleSet to the Web ACL. - Set the default action for requests that don't match any rules.

Athena Commands

Run Query (V2.0):

This command runs a SQL query on Athena and retrieves the results.

python main.py "athena run query \"SELECT * FROM my_table LIMIT 10\" on database my_database output s3://my-athena-results/ in us-east-1"

This command will automatically: - Execute the specified SQL query in Athena. - Store the results in the designated S3 output location. - Retrieve and display the query results.

Redshift Commands

Smart Create Cluster (V2.0):

This command creates an Amazon Redshift cluster.

python main.py "redshift smart-create cluster my-data-warehouse node-type dc2.large username adminuser password MySecurePassword123 in us-east-1 node-count 2"

This command will automatically: - Create a Redshift cluster with the specified identifier, node type, and credentials. - Configure the number of nodes. - Automatically create a security group allowing Redshift traffic if not explicitly provided.

Kinesis Commands

Smart Create Data Stream (V2.0):

This command creates a Kinesis Data Stream.

python main.py "kinesis smart-create data-stream my-data-stream in us-east-1 shards 2"

This command will automatically: - Create a Kinesis Data Stream with the specified name and shard count (defaults to 1).

Polly Commands

Synthesize Speech (V2.0):

This command synthesizes speech from text and saves it to an S3 bucket.

python main.py "polly synthesize speech for text \"Hello, this is a test.\" to bucket my-audio-output key audio/hello.mp3 in us-east-1 voice Joanna format mp3"

This command will automatically: - Convert the provided text into speech using Amazon Polly. - Save the generated audio file to the specified S3 bucket and key.

Comprehend Commands

Detect Sentiment (V2.0):

This command detects the sentiment of a given text.

python main.py "comprehend detect sentiment for text \"I love working with AWS!\" in us-east-1"

This command will automatically: - Analyze the sentiment of the provided text. - Return the sentiment (POSITIVE, NEGATIVE, NEUTRAL, MIXED) and confidence scores.

Rekognition Commands

Analyze Image Labels (V2.0):

This command detects labels in an image stored in an S3 bucket.

python main.py "rekognition analyze image-labels in bucket my-image-bucket key photos/dog.jpg in us-east-1 max-labels 5 min-confidence 80"

This command will automatically: - Analyze the specified image in S3. - Return a list of detected labels with their confidence scores.

SageMaker Commands

Smart Create Notebook Instance (V2.0):

This command creates a SageMaker notebook instance.

python main.py "sagemaker smart-create notebook-instance my-ml-notebook role arn:aws:iam::123456789012:role/sagemaker-execution-role in us-east-1 instance-type ml.t3.medium volume-size 50"

This command will automatically: - Create a SageMaker notebook instance with the specified name, role, instance type, and volume size.

CloudFront Commands

Smart Create S3 Distribution (V2.0):

This command creates a CloudFront web distribution for an S3 bucket.

python main.py "cloudfront smart-create s3-distribution for bucket my-static-website-bucket in us-east-1 default-root-object index.html"

This command will automatically: - Create a CloudFront web distribution. - Use the specified S3 bucket as the origin. - Configure basic settings for the distribution.

API Gateway Commands

Smart Create REST API (V2.0):

This command creates a simple REST API with a mock integration and deploys it to a stage.

python main.py "apigateway smart-create rest-api my-hello-api in us-east-1 stage prod path greeting"

This command will automatically: - Create a REST API. - Create a resource (e.g., /greeting). - Create a GET method on that resource with a mock integration. - Deploy the API to a specified stage (defaults to dev).

DMS Commands

Smart Create Replication Task (V2.0):

This command sets up a basic DMS replication instance, endpoints, and a replication task.

python main.py "dms smart-create replication-task my-db-migration source my-source-db target my-target-db in us-east-1"

This command will automatically: - Create a DMS replication instance (if not specified). - Create simplified source and target endpoints. - Create a replication task to migrate data.

Fargate Commands

Smart Deploy Container Application (V2.0):

This command deploys a containerized application to ECS Fargate.

python main.py "fargate smart-deploy container-app named my-nginx-app in us-east-1 image nginx:latest port 80"

This command will automatically: - Create an ECS cluster. - Register a task definition for the specified container image (defaults to nginx:latest). - Create an ECS service to run the task on Fargate, with a public IP and security group allowing traffic on the container port. - Automatically create a VPC and subnets if not explicitly provided.

EFS Commands

Smart Create File System (V2.0):

This command creates a new EFS file system and a mount target.

python main.py "efs smart-create file-system my-shared-fs in us-east-1"

This command will automatically: - Create an EFS file system. - Create a mount target in a selected subnet. - Create a security group for the mount target (if not provided) and allow NFS traffic. - Automatically create a VPC and select a subnet if not explicitly provided.

Elastic Beanstalk Commands

Smart Create Web Application (V2.0):

This command creates an Elastic Beanstalk application, environment, and deploys a sample web application.

python main.py "elasticbeanstalk smart-create web-app named my-sample-app in us-east-1 instance-type t3.small"

This command will automatically: - Create an Elastic Beanstalk application and environment. - Deploy a sample Python web application. - Configure the environment with the specified instance type (defaults to t3.micro).

EBS Commands

Smart Create and Attach EBS Volume (V2.0):

This command creates a new EBS volume and attaches it to an EC2 instance.

python main.py "ebs smart-create volume my-data-volume to i-0123456789abcdef0 in us-east-1 size 50 type gp3"

This command will automatically: - Create an EBS volume in the same Availability Zone as the specified EC2 instance. - Attach the newly created volume to the EC2 instance.

EKS Commands

Create EKS Cluster (with safety prompt):

Note: You must first create an EKS cluster role using the IAM agent.

python main.py "eks create cluster my-eks-cluster role arn:aws:iam::123456789012:role/my-eks-cluster-role vpc vpc-0123456789abcdef0 subnets subnet-0123456789abcdef0 subnet-0fedcba9876543210 in us-west-2"

Create EKS Node Group (with safety prompt):

Note: You must first create an EKS node group role using the IAM agent.

python main.py "eks create nodegroup for cluster my-eks-cluster nodegroup my-nodegroup role arn:aws:iam::123456789012:role/my-eks-nodegroup-role instance-types t3.medium t3.large subnets subnet-0123456789abcdef0 subnet-0fedcba9876543210 in us-west-2"

Troubleshoot EKS Cluster (V2.0):

This command orchestrates multiple agents to diagnose issues within an EKS cluster.

python main.py "eks troubleshoot cluster my-eks-cluster in us-east-1"

This command will automatically: 1. Check the status of the EKS cluster control plane. 2. Check the status and health of associated node group(s). 3. Provide a report with its findings and recommendations.

Example Output

When you run a command, the system will print the status and the result in a structured JSON format.

---
Execution Result
---
{
    "status": "success",
    "instances": [
        {
            "InstanceId": "i-0123456789abcdef0",
            "InstanceType": "t2.micro",
            "State": "running",
            "PublicIpAddress": "54.12.34.56",
            "PrivateIpAddress": "10.0.1.23"
        }
    ]
}
------------------------

How to Extend

To add a new agent (e.g., for AWS Lambda):

  1. Create a new file aws_agents/lambda_agent.py.
  2. Create a LambdaAgent class that inherits from BaseAgent.
  3. Implement the execute method and any private methods for Lambda-specific actions.
  4. Register the new agent in agent_manager.py by adding it to the self.agents dictionary.
  5. Update the parser in agent_manager.py to recognize and route Lambda-related commands.

Future Enhancements (Version 2.0 Roadmap)

This section outlines potential future enhancements and additional AWS services that could be integrated into the AI Agent Framework:

Core Services

  • Elastic Beanstalk: For deploying and scaling web applications and services.
  • Fargate: Serverless compute for containers (for ECS and EKS).
  • Outposts: Extending AWS infrastructure and services to virtually any on-premises or edge location.
  • EBS (Elastic Block Store): More granular management of block storage volumes.
  • EFS (Elastic File System): Management of scalable file storage for EC2 instances.

Migration Services

  • AWS Migration Hub: Central location to track migrations.
  • AWS Database Migration Service (DMS): For migrating databases.
  • AWS Server Migration Service (SMS): For migrating on-premises servers to AWS.

Networking & Content Delivery

  • API Gateway: For creating, publishing, maintaining, monitoring, and securing REST, HTTP, and WebSocket APIs.
  • CloudFront: Content Delivery Network (CDN) service.
  • Direct Connect: Dedicated network connection from your premises to AWS.

Artificial Intelligence & Machine Learning

  • Amazon SageMaker: For building, training, and deploying machine learning models.
  • Amazon Rekognition: Image and video analysis.
  • Amazon Comprehend: Natural language processing (NLP).
  • Amazon Polly: Text-to-speech service.

Analytics

  • Amazon Kinesis: For real-time streaming data.
  • Amazon Redshift: Data warehousing service.
  • Amazon Athena: Interactive query service for S3 data.

Security, Identity, & Compliance

  • AWS WAF (Web Application Firewall): Protecting web applications from common web exploits.
  • AWS Shield: DDoS protection.
  • AWS GuardDuty: Threat detection service.
  • AWS Config: Assessing, auditing, and evaluating the configurations of your AWS resources.

Internet of Things (IoT)

  • AWS IoT Core: Connecting IoT devices to AWS cloud services.

Messaging

  • Amazon SES (Simple Email Service): Email sending service.
  • Amazon SNS (Simple Notification Service): Pub/sub messaging service.
  • Amazon SQS (Simple Queue Service): Message queuing service.

Management & Governance

  • AWS Budgets (Enhanced): More detailed budget management and forecasting.
  • AWS Cost Explorer (Enhanced): Deeper cost analysis and reporting.

This roadmap ensures the continuous evolution of the AI Agent Framework into an even more comprehensive and intelligent assistant for AWS infrastructure management.

Files and Subdirectories