Introduction
In today's cloud-first world, managing AWS infrastructure efficiently requires deep expertise and constant attention. What if you could have an AI assistant that understands AWS services, can monitor your resources, optimize costs, and even generate architecture diagrams on demand? That's exactly what I've built with the AWS Cloud Engineer Agent.
AI-powered AWS Cloud Engineer
MCP tools, diagram generation, AWS CLI access in one agent, and CDK-based AWS Fargate deployment
What is the AWS Cloud Engineer Agent?
The AWS Cloud Engineer Agent is an intelligent assistant that helps developers and cloud engineers manage their AWS infrastructure more efficiently. Built using the powerful Strands Agents SDK, this agent combines the reasoning capabilities of large language models with direct access to AWS services, documentation, and diagramming tools using MCP (Model Context Protocol).
Unlike traditional chatbots that simply respond to queries, the AWS Cloud Engineer Agent can:
- Monitor and analyze AWS resources across multiple services
- Identify security vulnerabilities and recommend best practices
- Find cost-saving opportunities in your infrastructure
- Generate AWS architecture diagrams from text descriptions (AWS MCP tool)
- Search AWS documentation for relevant information (AWS MCP tool)
- Execute AWS CLI commands directly through its interface
The Power of Strands Agents SDK: A Model-First Approach
At the heart of our AWS Cloud Engineer Agent is the Strands Agents SDK, a revolutionary framework for building AI agents with a model-first approach. But what exactly does "model-first" mean?
Traditional agent frameworks (LangChain, etc) often rely on hardcoded workflows and decision trees, where developers must explicitly define every possible path and action. In contrast, Strands Agents SDK puts the language model in the driver's seat.
Why Choose Strands Agents SDK?
For builders looking for an open source offering with more control and flexibility, Strands Agents is ready to go! Here are several compelling reasons to choose Strands Agents SDK for your next AI project:
- Clean simple Python interface - Create your first agent with just a few lines of code
- MCP integration out of the box - Immediate access to the best tools the agent world has to offer
- Add custom tools with a simple decorator on local functions
- Model choice on steroids - With models from Bedrock, LiteLLM, Anthropic, Meta, even bring-your-own provider (proprietary gateway? no problem for Strands)
- Powerful set of examples to get you moving fast (multi agents, agent swarm, MCP, AWS deployments, guardrails, and much more)
- Out-of-the-box support for OTEL observability - Letting you know exactly what your agent is doing and why, plus hooks to agent evaluations to help you iteratively optimize agent accuracy and latency
- Solid documentation to help you get started
The Agentic Loop Architecture
Strands Agents SDK implements what's called an "agentic loop" architecture:
- The agent receives a user request (e.g., "Find unattached EBS volumes that could be removed")
- The LLM analyzes the request and determines the best approach (e.g., "I need to list all EBS volumes and check their attachment status")
- The agent executes the appropriate tools as directed by the LLM (e.g., running AWS CLI commands)
- Results are fed back to the LLM for further analysis
- The process repeats until the task is complete
This architecture enables sophisticated reasoning and multi-step problem solving without requiring developers to anticipate every possible scenario. The LLM acts as the orchestrator, making decisions about which tools to use and when.
Here's a simple code snippet showing how easy it is to create an agent with Strands:
from strands import Agent
from strands.models import BedrockModel
from strands_tools import use_aws
# Create a model instance
bedrock_model = BedrockModel(
model_id="us.amazon.nova-premier-v1:0",
region_name="us-east-1",
temperature=0.1,
)
# Create the agent with tools and model
agent = Agent(
tools=[use_aws], # AWS CLI tool
model=bedrock_model,
system_prompt="You are an expert AWS Cloud Engineer assistant..."
)
# Execute a task
response = agent("Find unattached EBS volumes that could be removed")
With just a few lines of code, we've created an agent that can interact with AWS services and solve complex problems!
MCP Integration: Extending Agent Capabilities
One of the most powerful features of Strands Agents SDK is its native support for Model Context Protocol (MCP) servers. MCP is a protocol that allows language models to access external tools and data sources.
Our AWS Cloud Engineer Agent integrates with two specialized MCP servers:
AWS Documentation MCP Server: Provides access to comprehensive AWS documentation, allowing the agent to retrieve accurate information about AWS services, features, and best practices.
AWS Diagram MCP Server: Enables the agent to generate visual AWS architecture diagrams based on text descriptions.
Here's how we integrate these MCP servers in our code:
from strands.tools.mcp import MCPClient
from mcp import StdioServerParameters, stdio_client
# Set up AWS Documentation MCP client
aws_docs_mcp_client = MCPClient(lambda: stdio_client(
StdioServerParameters(command="uvx", args=["awslabs.aws-documentation-mcp-server@latest"])
))
aws_docs_mcp_client.start()
# Set up AWS Diagram MCP client
aws_diagram_mcp_client = MCPClient(lambda: stdio_client(
StdioServerParameters(command="uvx", args=["awslabs.aws-diagram-mcp-server@latest"])
))
aws_diagram_mcp_client.start()
# Get tools from MCP clients
docs_tools = aws_docs_mcp_client.list_tools_sync()
diagram_tools = aws_diagram_mcp_client.list_tools_sync()
# Add all tools to the agent
agent = Agent(
tools=[use_aws] + docs_tools + diagram_tools,
model=bedrock_model,
system_prompt="You are an expert AWS Cloud Engineer assistant..."
)
With this integration, our agent can now search AWS documentation and generate architecture diagrams without requiring any additional code to handle these specific tasks. The LLM decides when and how to use these tools based on the user's request.
Architecture Overview
The AWS Cloud Engineer Agent consists of several components working together:
Strands Agent: The core component built using Strands Agents SDK with AWS Bedrock's Amazon Nova Premier model, implementing the agentic loop architecture.
Streamlit UI: A user-friendly interface for interacting with the agent.
-
AWS Infrastructure: Deployed using AWS CDK with:
- ECR repository for the Docker image
- ECS Fargate service for running the agent
- Application Load Balancer for routing traffic
- IAM roles with appropriate permissions
MCP Servers: External tools that extend the agent's capabilities with AWS documentation search and diagram generation.
The architecture follows a serverless approach, making it scalable and cost-effective. The agent runs in an ECS Fargate container, which can scale based on demand.
Deployment
Deploying the AWS Cloud Engineer Agent is straightforward using AWS CDK. The project includes a complete CDK stack that provisions all necessary resources in your AWS account.
Here's how to deploy the agent:
Prerequisites: Ensure you have AWS CDK installed and bootstrapped in your account, and Docker installed locally.
Clone the repository:
git clone https://github.com/awsdataarchitect/cloudeng-strands-agent.git
cd cloudeng-strands-agent
Install dependencies:
# Install Python dependencies
pip install -r requirements.txt
# Navigate to the CDK directory
cd cloud-engineer-agent-cdk
# Install CDK dependencies
npm install
Build the CDK project:
npm run build
Deploy the stack:
cdk deploy
The deployment process will:
- Create a Docker image of the agent
- Push it to Amazon ECR
- Provision the necessary AWS resources (VPC, ECS cluster, Fargate service, etc.)
- Set up the Application Load Balancer
Once deployment is complete, the CDK output will provide the URL where you can access the agent's Streamlit interface.
Use Cases and Benefits
The AWS Cloud Engineer Agent offers numerous benefits for developers and organizations:
For Developers and Cloud Engineers
- Faster Troubleshooting: Quickly identify and resolve issues with AWS resources
- Knowledge Assistance: Get instant answers to AWS-related questions without searching through documentation
- Infrastructure Visualization: Generate architecture diagrams to better understand complex systems
- Security Checks: Identify potential security vulnerabilities in your AWS configuration
- Cost Optimization: Find opportunities to reduce AWS spending
For Organizations
- Reduced Operational Overhead: Automate routine cloud management tasks
- Improved Security Posture: Proactively identify and address security issues
- Cost Savings: Identify unused or underutilized resources
- Knowledge Democratization: Make AWS expertise more accessible across the organization
- Faster Onboarding: Help new team members understand existing AWS infrastructure
Real-World Example
Let's see the AWS Cloud Engineer Agent in action with a real-world example. Suppose we want to identify unattached EBS volumes that could be removed to save costs.
User query:
Find all unattached EBS volumes across all regions and calculate the potential monthly cost savings if they were removed.
Agent response:
I'll find all unattached EBS volumes across regions and calculate potential cost savings.
First, let me get a list of all AWS regions:
Regions:
- us-east-1
- us-east-2
- us-west-1
- us-west-2
...
Scanning for unattached EBS volumes in each region...
Found 3 unattached EBS volumes:
1. Region: us-east-1
Volume ID: vol-0a1b2c3d4e5f6g7h8
Size: 100 GB
Type: gp3
Monthly cost: $8.00
2. Region: us-west-2
Volume ID: vol-1a2b3c4d5e6f7g8h9
Size: 500 GB
Type: gp2
Monthly cost: $50.00
3. Region: eu-west-1
Volume ID: vol-2a3b4c5d6e7f8g9h0
Size: 200 GB
Type: io1 (1000 IOPS)
Monthly cost: $125.00
Total potential monthly savings: $183.00
Would you like me to generate AWS CLI commands to delete these volumes or snapshot them before deletion?
This example demonstrates how the agent can:
- Break down a complex task into steps
- Execute AWS CLI commands across multiple regions
- Analyze the results and calculate cost implications
- Provide actionable next steps
Cleanup
When you're done experimenting with the AWS Cloud Engineer Agent, you can easily clean up all the resources to avoid incurring any additional costs. AWS CDK makes this process simple with a single command:
cdk destroy
This command will:
- Remove the ECS Fargate service
- Delete the Application Load Balancer
- Remove the ECR repository (after confirming)
- Delete the VPC and associated resources
- Clean up all IAM roles and policies created for the agent
The CDK destroy process will show you a summary of all resources that will be removed and ask for confirmation before proceeding. This ensures you have a chance to review what's being deleted before finalizing the cleanup.
Conclusion
The AWS Cloud Engineer Agent showcases the power of combining large language models with specialized tools through the Strands Agents SDK. By adopting a model-first approach with an agentic loop architecture, we've created an assistant that can handle complex AWS management tasks with minimal code.
This project demonstrates how AI can augment cloud engineering work, making it more efficient and accessible. The integration with MCP servers further extends the agent's capabilities, allowing it to access documentation and generate visualizations on demand.
Ready to try it yourself? The AWS Cloud Engineer Agent is open-source and available on GitHub. You can deploy it to your AWS account using the provided CDK code or run it locally for development and testing.
Get started today and experience the future of cloud infrastructure management!
Want to learn more about building AI agents with open-source Strands Agents SDK? Check out the official documentation and join the community of developers building the next generation of AI assistants.
Top comments (0)