{"id":31727163,"url":"https://github.com/tarique-b-devops/aws-cloudtrail-security-ai-agent","last_synced_at":"2026-05-08T14:02:52.919Z","repository":{"id":318354253,"uuid":"1069563426","full_name":"Tarique-B-DevOps/AWS-CloudTrail-Security-AI-Agent","owner":"Tarique-B-DevOps","description":"Analyze AWS CloudTrail events with security insights, powered by Strands Agent, AWS Bedrock LLMs, and AWS Bedrock AgentCore Runtime.","archived":false,"fork":false,"pushed_at":"2025-10-06T18:08:21.000Z","size":131,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-06T18:40:46.683Z","etag":null,"topics":["agentic-ai","agents","aws","aws-bedrock","bedrock","bedrock-agentcore","cloudtrail","genai","llm","python","strands-agents"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tarique-B-DevOps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-04T07:07:36.000Z","updated_at":"2025-10-06T18:08:25.000Z","dependencies_parsed_at":"2025-10-06T18:40:57.473Z","dependency_job_id":null,"html_url":"https://github.com/Tarique-B-DevOps/AWS-CloudTrail-Security-AI-Agent","commit_stats":null,"previous_names":["tarique-b-devops/aws-cloudtrail-security-ai-agent"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Tarique-B-DevOps/AWS-CloudTrail-Security-AI-Agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tarique-B-DevOps%2FAWS-CloudTrail-Security-AI-Agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tarique-B-DevOps%2FAWS-CloudTrail-Security-AI-Agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tarique-B-DevOps%2FAWS-CloudTrail-Security-AI-Agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tarique-B-DevOps%2FAWS-CloudTrail-Security-AI-Agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tarique-B-DevOps","download_url":"https://codeload.github.com/Tarique-B-DevOps/AWS-CloudTrail-Security-AI-Agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tarique-B-DevOps%2FAWS-CloudTrail-Security-AI-Agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000851,"owners_count":26082950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-ai","agents","aws","aws-bedrock","bedrock","bedrock-agentcore","cloudtrail","genai","llm","python","strands-agents"],"created_at":"2025-10-09T06:18:47.738Z","updated_at":"2026-05-08T14:02:51.311Z","avatar_url":"https://github.com/Tarique-B-DevOps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS CloudTrail Security AI Agent | Intelligent Log Analysis with Strands AI \u0026 AWS Bedrock\n\n[![AWS](https://img.shields.io/badge/AWS-CloudTrail-orange)](https://aws.amazon.com/cloudtrail/)\n[![Bedrock](https://img.shields.io/badge/AWS-Bedrock-blue)](https://aws.amazon.com/bedrock/)\n[![Strands AI](https://img.shields.io/badge/Strands-AI%20Agent-green)](https://strandsagents.com/latest/)\n[![Python](https://img.shields.io/badge/Python-3.11+-blue)](https://www.python.org/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-Framework-teal)](https://fastapi.tiangolo.com/)\n[![License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\n\u003e **AI-Powered AWS CloudTrail Security Analysis** | Automated threat detection, anomaly detection, and intelligent security insights using Strands AI Agent, AWS Bedrock LLMs, and AgentCore Runtime.\n\n---\n\n## 🎯 Overview\n\nThe **AWS CloudTrail Security AI Agent** is an intelligent security monitoring solution that leverages artificial intelligence to analyze AWS CloudTrail logs and detect security threats in real-time. Built on Strands AI Agent framework and powered by AWS Bedrock's advanced language models, this tool provides automated security intelligence without requiring external dependencies.\n\n\u003cvideo width=\"640\" height=\"360\" controls\u003e\n  \u003csource src=\"https://github.com/user-attachments/assets/ade274bf-8581-4bec-b08b-2dbe7add8b84\" type=\"video/mp4\"\u003e\n  Your browser does not support the video tag.\n\u003c/video\u003e\n\n[Click here to watch the video in a new tab](https://github.com/user-attachments/assets/ade274bf-8581-4bec-b08b-2dbe7add8b84)\n\n### Key Features\n\n- **🤖 AI-Driven Security Analysis**: Automated CloudTrail log analysis using Strands AI Agent technology\n- **☁️ AWS Bedrock Integration**: Leverages Claude 3.5 Sonnet and other Amazon Bedrock LLMs for advanced threat detection\n- **🚀 AgentCore Runtime Deployment**: Fully managed agent hosting on AWS Bedrock AgentCore for production workloads\n- **🔍 Real-Time Threat Detection**: Identifies suspicious activity, unauthorized access attempts, and anomalous patterns\n- **💬 Interactive Chat Interface**: User-friendly Streamlit-based web UI for natural language security queries\n- **📊 Intelligent Insights**: Generates human-readable security reports with actionable recommendations\n- **🛠️ Zero External Dependencies**: All analysis performed using built-in AWS tools and services\n- **🐳 Containerized Deployment**: Easy setup with Docker and Docker Compose\n\n---\n\n## 🏗️ Architecture \u0026 Technology Stack\n\n### Core Technologies\n\n| Component | Technology | Purpose |\n|-----------|-----------|---------|\n| **AI Agent Framework** | Strands AI Agent | Orchestrates intelligent log analysis and automation |\n| **LLM Platform** | AWS Bedrock (Claude 3.5 Sonnet) | Generative AI for security analysis and insights |\n| **Runtime Environment** | AWS Bedrock AgentCore | Managed serverless agent hosting |\n| **API Layer** | FastAPI | High-performance REST API service |\n| **Frontend Interface** | Streamlit | Interactive chat-style web application |\n| **Data Source** | AWS CloudTrail | AWS audit and governance log service |\n| **Containerization** | Docker \u0026 Docker Compose | Simplified deployment and scalability |\n\n### How It Works\n\n1. **Data Collection**: Retrieves CloudTrail events from specified AWS regions and timeframes\n2. **AI Processing**: Strands Agent analyzes logs using AWS Bedrock LLMs\n3. **Pattern Recognition**: Identifies access patterns, privilege escalations, and anomalies\n4. **Intelligence Generation**: Creates natural language security reports with risk assessments\n5. **Interactive Delivery**: Streams insights through conversational web interface\n\n---\n\n## 🚀 Quick Start Guide\n\n### Prerequisites\n\nBefore installing the AWS CloudTrail Security AI Agent, ensure you have:\n\n- **Docker** (version 20.10+) and **Docker Compose** installed\n- **AWS Account** with CloudTrail enabled\n- **AWS IAM Credentials** with appropriate permissions:\n  - CloudTrail read access (`cloudtrail:LookupEvents`)\n  - Bedrock model access (`bedrock:InvokeModel`)\n  - AgentCore deployment permissions (optional, for production)\n- **AWS Bedrock** service enabled in your region\n- **Anthropic Claude 3.5 Sonnet** model access (or compatible Bedrock model)\n\n### Installation Steps\n\n#### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Tarique-B-DevOps/AWS-CloudTrail-Security-AI-Agent.git\ncd AWS-CloudTrail-Security-AI-Agent\n```\n\n#### 2. Configure AWS Credentials\n\nExport your AWS credentials and Bedrock configuration as environment variables:\n\n```bash\nexport AWS_ACCESS_KEY_ID=your_access_key_id\nexport AWS_SECRET_ACCESS_KEY=your_secret_access_key\nexport AWS_SESSION_TOKEN=your_session_token  # For temporary credentials\nexport BEDROCK_MODEL_REGION=us-east-1\nexport BEDROCK_MODEL_ID=us.anthropic.claude-3-5-sonnet-20241022-v2:0\n```\n\n\u003e **Security Note**: Replace placeholder values with your actual AWS credentials. For production, use IAM roles instead of hardcoded credentials.\n\n#### 3. Launch with Docker Compose\n\nStart all services in containerized environment:\n\n```bash\ndocker compose up --build\n```\n\n#### 4. Access the Web Interface\n\nOpen your browser and navigate to:\n\n```\nhttp://localhost:8501\n```\n\n---\n\n## 📖 Usage Examples\n\n### Security Query Examples\n\nThe AI agent understands natural language queries about your CloudTrail logs:\n\n#### Example 1: User Activity Analysis\n```\nanalyze the usage pattern of the user tarique in us-east-1 region in last one hour\n```\n\n**Response**: The agent will stream real-time analysis including:\n- API calls made by the user\n- Resources accessed\n- Unusual access patterns\n- Potential security risks\n\n#### Example 2: Threat Detection\n```\nshow me any suspicious login attempts in the last 24 hours\n```\n\n#### Example 3: Privilege Analysis\n```\nidentify any privilege escalation attempts in the last week\n```\n\n#### Example 4: Compliance Audit\n```\nsummarize all IAM policy changes made by admin users today\n```\n\n---\n\n## ☁️ Deploying to AWS Bedrock AgentCore Runtime\n\nFor production workloads, deploy your AI agent to AWS Bedrock AgentCore for fully managed, serverless hosting:\n\n### Deployment Steps\n\n#### 1. Run the Deployment Script\n\n```bash\n./deploy-on-agentcore.sh\n```\n\nThis script will:\n- Package your Strands agent configuration\n- Create AgentCore runtime resources\n- Deploy the agent to AWS infrastructure\n- Configure necessary IAM permissions\n\n#### 2. Verify Deployment\n\nOnce deployment completes, access the web UI at `http://localhost:8501`. The runtime indicator should show **AgentCore**.\n\n#### 3. Test Production Agent\n\nSubmit the same security queries. Responses will now be generated from the AgentCore runtime, providing:\n- **Higher Availability**: Managed AWS infrastructure\n- **Better Performance**: Optimized agent execution\n- **Auto-Scaling**: Handles variable workloads\n- **Cost Efficiency**: Pay only for usage\n\n### Cleanup Resources\n\nTo delete AgentCore deployment and associated resources:\n\n```bash\n./deploy-on-agentcore.sh --delete\n```\n\n---\n\n## 🔧 Configuration Options\n\n### Environment Variables\n\n| Variable | Description | Default | Required |\n|----------|-------------|---------|----------|\n| `AWS_ACCESS_KEY_ID` | AWS access key | - | Yes |\n| `AWS_SECRET_ACCESS_KEY` | AWS secret key | - | Yes |\n| `AWS_SESSION_TOKEN` | Temporary session token | - | No |\n| `BEDROCK_MODEL_REGION` | AWS Bedrock region | `us-east-1` | Yes |\n| `BEDROCK_MODEL_ID` | Bedrock model identifier | Claude 3.5 Sonnet | Yes |\n| `CLOUDTRAIL_REGION` | CloudTrail region to analyze | `us-east-1` | No |\n| `LOG_LEVEL` | Application logging level | `INFO` | No |\n\n### Supported AWS Bedrock Models\n\n- ✅ `us.anthropic.claude-3-5-sonnet-20241022-v2:0` (Recommended)\n- ✅ `anthropic.claude-3-sonnet-20240229-v1:0`\n- ✅ `anthropic.claude-3-opus-20240229-v1:0`\n- ✅ Other Bedrock-supported LLMs\n\n---\n\n## 🎯 Use Cases\n\n### Cloud Security Operations\n- **Real-time Threat Monitoring**: Continuous analysis of CloudTrail logs for security events\n- **Incident Response**: Quickly investigate suspicious activity with natural language queries\n- **Forensic Analysis**: Historical log analysis for post-incident investigations\n\n### Compliance \u0026 Auditing\n- **Compliance Reporting**: Generate audit reports for SOC 2, ISO 27001, PCI DSS\n- **Access Reviews**: Identify and review privileged access patterns\n- **Change Tracking**: Monitor infrastructure and configuration changes\n\n### DevSecOps\n- **CI/CD Security**: Integrate security checks into deployment pipelines\n- **Developer Activity Monitoring**: Track and analyze developer actions in AWS\n- **Automated Security Reviews**: Schedule periodic security assessments\n\n---\n\n## 🛡️ Security Best Practices\n\nWhen deploying the AWS CloudTrail Security AI Agent:\n\n1. **Use IAM Roles**: Prefer IAM roles over access keys for EC2/ECS deployments\n2. **Least Privilege**: Grant minimum required permissions for CloudTrail and Bedrock\n3. **Encrypt Credentials**: Store sensitive credentials in AWS Secrets Manager or Parameter Store\n4. **Network Security**: Deploy in private subnets with appropriate security groups\n5. **Audit Logging**: Enable CloudTrail for the agent's own AWS API calls\n6. **Regular Updates**: Keep dependencies and Docker images up to date\n\n\n---\n\n## 🔗 Related Resources\n\n- [AWS CloudTrail Documentation](https://docs.aws.amazon.com/cloudtrail/)\n- [AWS Bedrock Documentation](https://docs.aws.amazon.com/bedrock/)\n- [Strands AI Agent Framework](https://strandsagents.com/latest/)\n- [FastAPI Documentation](https://fastapi.tiangolo.com/)\n- [Streamlit Documentation](https://docs.streamlit.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarique-b-devops%2Faws-cloudtrail-security-ai-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftarique-b-devops%2Faws-cloudtrail-security-ai-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftarique-b-devops%2Faws-cloudtrail-security-ai-agent/lists"}