MCP Library updated 15 min read

AWS MCP Servers: Cloud Infrastructure Management with AI

Manage AWS infrastructure using AI. Learn how to query S3, manage EC2, monitor CloudWatch, and automate cloud operations with AWS MCP servers.

Rajesh Praharaj

· Updated

Contents 15 sections
  1. TL;DR - AWS MCP Quick Start
  2. AWS MCP Landscape
  3. Prerequisites
  4. S3 MCP Configuration
  5. EC2 MCP Configuration
  6. CloudWatch MCP Configuration
  7. Practical Workflows
  8. Example Prompts
  9. Multiple AWS Accounts
  10. Security Best Practices
  11. Combining with Other MCPs
  12. Troubleshooting
  13. Related MCP Servers
  14. Summary
  15. Frequently Asked Questions

TL;DR - AWS MCP Quick Start

Manage your cloud infrastructure with AI - Query S3, monitor resources, and automate operations across the official awslabs/mcp ecosystem (over 60 specialized AWS MCP servers maintained by AWS Labs at awslabs.github.io/mcp). When architecting cloud control planes for frontier reasoning models evaluated on our LLM Benchmarks using our AI System Design Generator, AWS MCP servers cut cloud troubleshooting and Terraform generation latency by 45% to 65% while keeping per-server tool schema overhead between 900 and 2,400 tokens.

2026 AWS Official MCP Architecture & Token Overhead Summary
  • Official awslabs/mcp Suite: Includes awslabs.core-mcp-server, awslabs.aws-api-mcp-server, awslabs.eks-mcp-server, awslabs.ecs-mcp-server, awslabs.cfn-mcp-server, awslabs.terraform-mcp-server, and awslabs.cost-explorer-mcp-server executed via uvx.
  • Safe Mutating Operations: AWS_API_MCP_ALLOW_UNRESTRICTED_LOCAL_FILE_ACCESS=false and read-only IAM roles prevent unintended state mutations in production VPCs.
  • Latency & Cost Profile: Typical STS + SDK API calls complete in 85ms to 320ms within region, and filtering CloudWatch Log Insights queries prior to LLM return saves 78% of context window tokens.

Quick Setup (S3 Example):

{
  "mcpServers": {
    "aws-s3": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_REGION": "us-east-1",
        "AWS_ACCESS_KEY_ID": "AKIA...",
        "AWS_SECRET_ACCESS_KEY": "..."
      }
    }
  }
}

What you can do:

  • S3: List, read, and manage objects
  • EC2: Query instances and status
  • CloudWatch: Read metrics and logs
  • Lambda: Check function status
  • DynamoDB: Query tables

Example conversation:

You: List all S3 buckets and their sizes

Claude: Here are your S3 buckets:

        | Bucket Name         | Size    | Objects | Region    |
        |---------------------|---------|---------|-----------|
        | prod-assets         | 45.2 GB | 12,340  | us-east-1 |
        | backup-data         | 128 GB  | 5,678   | us-west-2 |
        | dev-uploads         | 2.1 GB  | 890     | us-east-1 |

Security First: Always use least-privilege IAM credentials.


AWS MCP Landscape

Several MCP servers exist for different AWS services:

ServerServicesMaintainer
mcp-server-aws-s3S3 buckets and objectsCommunity
mcp-server-aws-ec2EC2 instancesCommunity
aws-kb-retrieverKnowledge bases, BedrockAnthropic
mcp-server-cloudwatchMetrics and logsCommunity
Various othersLambda, DynamoDB, etc.Community

Note: The AWS MCP ecosystem is growing. Check mcp.so for the latest servers. For an introduction to MCP, see the MCP Introduction guide.

2025: AWS Official MCP Servers

ServerDescriptionRelease
Amazon EKS MCPKubernetes cluster managementNov 2025
Amazon ECS MCPContainer service orchestrationNov 2025
AWS Lambda MCPServerless function integration2025
AWS API MCPNatural language AWS API accessJul 2025

Amazon Q Developer: Integrates with MCP servers for AI-powered infrastructure management. For more on AI agents, see the AI Agents guide.


Prerequisites

1. AWS Account and Credentials

You’ll need AWS credentials. The recommended approach:

Option A: IAM User Credentials

  1. Create an IAM user in AWS Console
  2. Attach appropriate policies
  3. Generate access keys
  4. Configure in MCP

Option B: AWS CLI Profile

aws configure --profile mcp-access
# Enter access key, secret, region

Option C: IAM Role (EC2/Lambda) If running on AWS infrastructure, use IAM roles.

2. Creating Least-Privilege Access

For S3 Read-Only:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListAllMyBuckets",
        "s3:GetBucketLocation",
        "s3:ListBucket",
        "s3:GetObject"
      ],
      "Resource": [
        "arn:aws:s3:::*",
        "arn:aws:s3:::*/*"
      ]
    }
  ]
}

For EC2 Read-Only:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeInstances",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeVpcs",
        "ec2:DescribeSubnets"
      ],
      "Resource": "*"
    }
  ]
}

3. Node.js v18+

node --version  # Should be v18+

S3 MCP Configuration

Configuring an Amazon S3 MCP server allows AI agents to inspect bucket policies, enumerate object prefixes, audit lifecycle transition rules, and retrieve configuration manifests without leaving your IDE. In production AWS environments, you should pair awslabs.s3-tables-mcp-server or mcp-server-aws-s3 with short-lived AWS IAM Identity Center (SSO) session tokens rather than long-lived static AKIA IAM user keys. Furthermore, restricting s3:GetObject to specific prefix ARNs ensures that an autonomous coding agent cannot inadvertently ingest multi-gigabyte Parquet files or sensitive PII objects into its context window. You can validate your IAM policy JSON syntax using our JSON Formatter & Validator before attaching it to your execution role.

Installation

{
  "mcpServers": {
    "aws-s3": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_REGION": "us-east-1",
        "AWS_ACCESS_KEY_ID": "AKIA...",
        "AWS_SECRET_ACCESS_KEY": "your-secret-key"
      }
    }
  }
}

Using AWS Profile

{
  "mcpServers": {
    "aws-s3": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_PROFILE": "mcp-access",
        "AWS_REGION": "us-east-1"
      }
    }
  }
}

Available S3 Operations

OperationDescriptionExample Prompt
List bucketsShow all S3 buckets”List my S3 buckets”
List objectsObjects in a bucket”What’s in prod-assets bucket?”
Get objectRead object content”Read config.json from bucket”
Get metadataObject size, type, date”Get metadata for this file”

EC2 MCP Configuration

Connecting your AI assistant to Amazon EC2 and VPC metadata enables rapid network topology verification, security group ingress auditing, and right-sizing analysis across hundreds of compute instances. Instead of running separate shell commands to cross-reference DescribeInstances, DescribeSecurityGroups, and DescribeSubnets, an agent equipped with the official awslabs.aws-api-mcp-server or mcp-server-aws-ec2 correlates instance ENIs, security group rules, and NAT Gateway routes in a single turn. Because ec2:Describe* actions do not support resource-level permissions in AWS IAM, always enforce aws:RequestedRegion condition keys and tag-based access control (aws:ResourceTag/Environment) if you ever enable start, stop, or reboot actions.

Installation

{
  "mcpServers": {
    "aws-ec2": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-ec2"],
      "env": {
        "AWS_REGION": "us-east-1",
        "AWS_ACCESS_KEY_ID": "AKIA...",
        "AWS_SECRET_ACCESS_KEY": "..."
      }
    }
  }
}

Available EC2 Operations

OperationDescriptionExample Prompt
List instancesAll EC2 instances”Show my EC2 instances”
Instance detailsSpecific instance info”Details of i-1234567890”
Security groupsList security groups”What security groups exist?”
VPC infoVPC configuration”Show VPC details”

CloudWatch MCP Configuration

Observability and incident response are among the highest-ROI use cases for AWS MCP servers in production engineering teams. By deploying awslabs.cloudwatch-logs-mcp-server or mcp-server-cloudwatch, site reliability engineers allow Claude or Cursor to execute structured CloudWatch Logs Insights queries (fields @timestamp, @message | filter @message like /ERROR/ | limit 50), correlate metric anomalies across Lambda and RDS, and inspect active composite alarms. Enforcing server-side limit clauses and metric period aggregation (such as 300-second p99 rollups) is critical so a noisy log group does not flood the model context with 50,000+ raw log tokens during an outage.

Installation

{
  "mcpServers": {
    "cloudwatch": {
      "command": "npx",
      "args": ["-y", "mcp-server-cloudwatch"],
      "env": {
        "AWS_REGION": "us-east-1",
        "AWS_ACCESS_KEY_ID": "AKIA...",
        "AWS_SECRET_ACCESS_KEY": "..."
      }
    }
  }
}

Available CloudWatch Operations

OperationDescriptionExample Prompt
List metricsAvailable metrics”What metrics are available?”
Get metric dataRetrieve metric values”CPU usage for last hour”
List log groupsCloudWatch log groups”Show log groups”
Query logsSearch log data”Errors in API logs today”

Practical Workflows

Workflow 1: Infrastructure Inventory

Get a complete view of your AWS resources:

You: Give me an inventory of my AWS infrastructure

Claude: Querying AWS resources...

        **AWS Infrastructure Inventory**
        
        **EC2 Instances (12):**
        | Name          | Type      | State   | IP            |
        |---------------|-----------|---------|---------------|
        | prod-api-1    | t3.medium | running | 10.0.1.45     |
        | prod-api-2    | t3.medium | running | 10.0.1.46     |
        | prod-web-1    | t3.large  | running | 10.0.2.12     |
        | staging-api   | t3.small  | running | 10.0.3.22     |
        | dev-server    | t3.micro  | stopped | -             |
        ...
        
        **S3 Buckets (8):**
        - prod-assets (45 GB)
        - prod-backups (320 GB)
        - logs-archive (12 GB)
        ...
        
        **Monthly Estimate:** ~$485

Workflow 2: Cost Analysis

Understand your AWS spending:

You: Analyze my S3 storage costs by bucket

Claude: Analyzing S3 storage...

        **S3 Cost Analysis**
        
        | Bucket           | Size    | Storage Class | Monthly Cost |
        |------------------|---------|---------------|--------------|
        | prod-backups     | 320 GB  | Standard      | $7.36        |
        | media-archive    | 850 GB  | Glacier       | $3.40        |
        | prod-assets      | 45 GB   | Standard      | $1.04        |
        | logs-archive     | 12 GB   | IA            | $0.15        |
        | dev-uploads      | 2 GB    | Standard      | $0.05        |
        
        **Total Monthly:** ~$11.95
        
        **Recommendations:**
        - Move prod-backups older than 90 days to Glacier (-$4/mo)
        - logs-archive could use Glacier Deep Archive (-$0.10/mo)

Workflow 3: Security Audit

Review security configurations:

You: Audit my EC2 security groups for overly permissive rules

Claude: Auditing security groups...

        **Security Group Audit**
        
        ⚠️ **Issues Found (3):**
        
        1. **sg-abc123** (web-servers)
           - Port 22 open to 0.0.0.0/0
           - Recommendation: Restrict to VPN IP range
        
        2. **sg-def456** (legacy-app)
           - Port 3306 open to 0.0.0.0/0
           - CRITICAL: MySQL exposed to internet!
           - Recommendation: Restrict to app security group
        
        3. **sg-ghi789** (dev-testing)
           - All ports open to 0.0.0.0/0
           - Recommendation: Delete or restrict this SG
        
        ✅ **Compliant (15):**
        - All other security groups properly restricted

Workflow 4: Log Analysis

Search and analyze CloudWatch logs:

You: Find all ERROR logs in the API log group from the last hour

Claude: Querying CloudWatch logs...

        **Error Logs (Last Hour)**
        
        Found 23 errors in /aws/lambda/api-handler:
        
        | Time     | Error Type          | Count |
        |----------|---------------------|-------|
        | 14:45:32 | TimeoutException    | 12    |
        | 14:52:18 | ValidationError     | 8     |
        | 15:01:45 | DatabaseConnection  | 3     |
        
        **Top Error:**

TimeoutException: Task timed out after 30 seconds at /var/task/handlers/process.js:45 Affected requests: 12


**Recommendation:** 
Consider increasing Lambda timeout or optimizing 
the database query causing delays.

Workflow 5: Resource Monitoring

Real-time resource monitoring:

You: How are my production EC2 instances performing?

Claude: Fetching CloudWatch metrics...

        **EC2 Performance Dashboard**
        
        | Instance    | CPU | Memory* | Network I/O | Status |
        |-------------|-----|---------|-------------|--------|
        | prod-api-1  | 45% | 72%     | 125 MB/s    | ✅ OK  |
        | prod-api-2  | 52% | 68%     | 118 MB/s    | ✅ OK  |
        | prod-web-1  | 23% | 41%     | 45 MB/s     | ✅ OK  |
        | prod-db-1   | 78% | 89%     | 234 MB/s    | ⚠️ High |
        
        **Alerts:**
        - prod-db-1: CPU and memory elevated
        - Recommendation: Consider scaling or query optimization
        
        *Memory requires CloudWatch agent

Example Prompts

S3 Operations

# Bucket listing
"List all my S3 buckets"
"Show buckets in us-west-2"
"Which buckets have public access?"

# Object operations
"List objects in prod-assets bucket"
"Show files uploaded today to uploads/"
"Read the config.json from settings bucket"

# Analysis
"How much storage am I using across all buckets?"
"Which bucket has the most objects?"
"Find large files over 1GB"

EC2 Operations

# Instance listing
"Show all running EC2 instances"
"List instances by tag 'Environment=Production'"
"Which instances are in the us-east-1a availability zone?"

# Instance details
"Get details of i-0abc123def456"
"What security groups are attached to my web servers?"
"Show the launch configuration for prod instances"

# Cost and sizing
"Which instances are over-provisioned?"
"Show instance hours for this month"
"List instances that have been stopped for over 30 days"

CloudWatch Operations

# Metrics
"Show CPU utilization for the last 24 hours"
"Get memory usage for prod-api instances"
"What's the average latency for my API?"

# Logs
"Search for errors in the last hour"
"Find logs mentioning 'timeout'"
"Show logs from the payment service"

# Alarms
"List active CloudWatch alarms"
"Which alarms are in ALARM state?"
"Show alarm history for this week"

Multiple AWS Accounts

Enterprise cloud architectures following the AWS Well-Architected Framework isolate workloads across dedicated organizational units (Production, Staging, Shared Services, and Security Tooling) managed via AWS Organizations and AWS IAM Identity Center. When configuring MCP servers for multi-account operations, never share a single IAM user credential across accounts; instead, register distinct named MCP server instances bound to isolated AWS_PROFILE definitions in ~/.aws/config that assume cross-account roles via sts:AssumeRole with 1-hour session durations. Read-only SecurityAudit or ViewOnlyAccess policies should be enforced on production profiles, while sandbox or development profiles can permit scoped awslabs.cfn-mcp-server or awslabs.terraform-mcp-server validation calls.

For multi-account management:

{
  "mcpServers": {
    "aws-prod": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_PROFILE": "production",
        "AWS_REGION": "us-east-1"
      }
    },
    "aws-staging": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_PROFILE": "staging",
        "AWS_REGION": "us-east-1"
      }
    },
    "aws-dev": {
      "command": "npx",
      "args": ["-y", "mcp-server-aws-s3"],
      "env": {
        "AWS_PROFILE": "development",
        "AWS_REGION": "us-west-2"
      }
    }
  }
}

Then specify which account:

You: Using the production AWS account, list S3 buckets
You: Check EC2 instances in staging

Security Best Practices

Credential Management

✓ Do✗ Don’t
Use IAM users/rolesUse root account credentials
Apply least-privilegeGrant admin access
Rotate keys regularlyKeep old keys active
Use AWS profilesHardcode in config files
Audit access logsIgnore CloudTrail

For more on AI security best practices, see the Understanding AI Safety, Ethics, and Limitations guide.

IAM Policy Examples

Minimal S3 Read:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:ListBucket"],
      "Resource": ["arn:aws:s3:::my-bucket", "arn:aws:s3:::my-bucket/*"]
    }
  ]
}

EC2 Describe Only:

{
  "Effect": "Allow",
  "Action": "ec2:Describe*",
  "Resource": "*"
}

Audit Trail

Enable CloudTrail to track all API calls:

You: Show recent API calls made by the MCP IAM user

Claude: CloudTrail events for mcp-user (last 24h):
        
        - s3:ListBuckets (45 calls)
        - s3:GetObject (23 calls)
        - ec2:DescribeInstances (12 calls)
        
        No suspicious activity detected.

Combining with Other MCPs

The real operational leverage of AWS MCP servers emerges when you compose them with source control, incident alerting, and persistent architectural memory servers inside a unified DevOps agent loop. As detailed in our analysis of AI Agents vs Agentic AI, connecting cloud telemetry directly to code repositories and team communication channels eliminates manual context-switching during Severity-1 incidents. By pairing CloudWatch and EC2 servers with Slack, Filesystem, and Memory MCP servers, an SRE agent can detect a latency regression, correlate it with a recent container deployment, export a compliance report, and brief the on-call channel in under 45 seconds.

AWS + Slack

Alert team about issues:

You: Check for any AWS alarms in ALARM state and notify #ops

Claude: [Uses AWS to check alarms]
        [Uses Slack to notify]
        
        Posted to #ops:
        
        🚨 **AWS Alarm Alert**
        - HighCPU-ProdAPI: i-abc123 at 95% CPU
        - DatabaseConnections: RDS connections maxed

AWS + Filesystem

Export AWS data:

You: Export EC2 inventory to a CSV file

Claude: [Uses AWS to query EC2]
        [Uses Filesystem to save CSV]
        
        Saved to: /reports/ec2-inventory.csv
        - 12 instances documented
        - Includes: name, type, state, IPs

AWS + Memory

Remember infrastructure patterns:

You: Learn my AWS infrastructure and remember it

Claude: [Uses AWS to analyze resources]
        [Uses Memory to store patterns]
        
        Memorized:
        - 3 environments: prod, staging, dev
        - Naming convention: env-service-number
        - Regions: us-east-1 (prod), us-west-2 (dev)

Troubleshooting

Diagnosing AWS MCP server failures typically involves inspecting three layers: local runtime dependencies (uvx for Python-based awslabs servers or npx for Node.js servers), AWS STS credential resolution, and IAM policy evaluation logic. When an AWS API call fails, AWS returns a structured error code (AccessDeniedException, ExpiredTokenException, or ThrottlingException) that you can trace in AWS CloudTrail within 60 to 180 seconds of invocation. If a policy blocks an expected read call, run the IAM Policy Simulator or check whether a Service Control Policy (SCP) or VPC Endpoint Policy is restricting access from your workstation network.

Issue: “Access Denied”

Symptoms: Permission errors

Solutions:

CauseSolution
Missing IAM permissionsAdd required policies
Wrong credentialsCheck keys are correct
Wrong regionVerify region in config
Resource policy blockingCheck bucket/resource policies

Issue: “Credential not found”

Symptoms: Authentication fails

Solutions:

  • Check env variables are set
  • Verify AWS profile exists
  • Ensure credentials aren’t expired
  • Check AWS STS for temporary creds

Issue: “Rate limited”

Symptoms: Too many requests

Solutions:

  • Add delays between operations
  • Reduce query scope
  • Check AWS service limits

ServerComplements AWS By…
Cloudflare MCPEdge DNS, Workers, and R2 integration
Slack MCPAlerting and notifications
Filesystem MCPSaving AWS data locally
Memory MCPRemembering infrastructure
PostgreSQL MCPCorrelating with app data

Summary

AWS MCP Servers bring AI to cloud infrastructure:

  • ✓ S3 - Bucket and object management
  • ✓ EC2 - Instance monitoring and details
  • ✓ CloudWatch - Metrics and logs
  • ✓ Multi-account - Manage multiple environments
  • ✓ Secure - IAM-based access control
  • ✓ Official AWS (2025) - EKS, ECS, Lambda MCP servers

2025 AWS MCP Ecosystem:

  • Amazon EKS MCP - Kubernetes cluster management
  • Amazon ECS MCP - Container service orchestration
  • AWS Lambda MCP - Serverless function integration
  • AWS API MCP - Natural language AWS API access
  • Amazon Q Developer - AI-powered infrastructure

Best use cases:

  • Infrastructure inventory
  • Cost analysis
  • Security audits
  • Log analysis
  • Resource monitoring

Security checklist:

  • ☐ Create dedicated IAM user for MCP
  • ☐ Apply least-privilege policies
  • ☐ Enable CloudTrail logging
  • ☐ Rotate credentials regularly
  • ☐ Never use root credentials

Next: Learn about Cloudflare MCP Server → for edge infrastructure.

By pairing least-privilege IAM roles with the official AWS Labs servers, your engineering team can safely scale S3 AI automation and cloud automation AI across staging and production.


Questions about AWS MCP? Check the Official AWS Labs MCP Repository on GitHub, the AWS MCP Documentation Portal, or the Model Context Protocol Specification.

Frequently Asked Questions

What AWS services can MCP access?

AWS now offers official MCP servers for EKS, ECS, Lambda, and more (Nov 2025). Community servers support S3, EC2, CloudWatch, DynamoDB. Amazon Q Developer integrates natively with MCP.

Is it safe to give AI access to AWS?

When configured properly with IAM roles and minimal permissions, yes. Always use least-privilege access, never use root credentials, and prefer read-only access for exploration.

What credentials does AWS MCP need?

AWS MCP servers typically use standard AWS credential methods: environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), AWS profiles, or IAM roles.

Can AI create resources in my AWS account?

It can if you grant write permissions. For safety, start with read-only access and carefully consider before enabling create/delete operations.

Does this work with all AWS regions?

Yes! Specify the region in configuration. Most MCP servers default to us-east-1 but can be configured for any AWS region.

Can I use AWS SSO credentials?

Many AWS MCP servers support the standard AWS credential chain, which includes SSO credentials configured via AWS CLI.

How do I limit which resources AI can access?

Use IAM policies to restrict access. For example, limit S3 access to specific buckets or EC2 to specific instances using resource-based policies.

Are there costs for using AWS MCP?

AWS MCP itself is free, but AWS API calls may incur costs. Read operations are usually free or cheap, but actions like launching EC2 instances will incur normal AWS charges. Combining IAM-scoped tools with CloudTrail auditing enables secure S3 AI automation and enterprise cloud automation AI across multi-account AWS environments.

Written by Rajesh Praharaj

Product Leader & AI Builder

Product leader and AI builder focused on practical LLM systems, Model Context Protocol (MCP) integrations, agentic workflows, and free browser-based tools for product & engineering teams.

Was this page helpful?

Let us know if you found what you were looking for.