I Built an MCP Server That Gives AI Agents Real-Time AWS Pricing Data
Source: Dev.to

The Problem
You’re building an AI agent that provisions cloud infrastructure.
User says: “Spin up a t3.medium in the cheapest region.”
The agent has no idea what that costs, which region is cheapest, or whether reserved instances would save money. This makes it impossible to answer the most basic question: “How much will this cost?”
The Solution: AWS Pricing MCP
I built an MCP‑compatible API that returns real‑time AWS pricing data. It’s live on RapidAPI.
What it does
- Query pricing for 20 AWS services (EC2, RDS, Lambda, S3, DynamoDB, ECS, EKS, etc.)
- Compare prices across all 18 AWS regions
- Provide on‑demand vs reserved instance breakdowns
- Estimate monthly costs for multi‑instance workloads
How It Works
The API follows MCP (Model Context Protocol) conventions, so any MCP‑compatible AI client can use it directly.
Basic Query
curl -X GET "https://aws-pricing-mcp.p.rapidapi.com/ec2/pricing?instance_type=t3.medium®ion=us-east-1" \
-H "X-RapidAPI-Key: YOUR_KEY"
Response
{
"instance_type": "t3.medium",
"region": "us-east-1",
"prices": {
"on_demand_hourly": 0.0416,
"on_demand_monthly": 30.37,
"reserved_1yr_no_upfront_monthly": 24.82,
"reserved_1yr_all_upfront_monthly": 21.90,
"reserved_3yr_all_upfront_monthly": 14.60
},
"vcpu": 2,
"memory_gb": 4,
"potential_savings": {
"reserved_1yr_percent": 27.9,
"reserved_3yr_percent": 51.9
}
}
Region Comparison
Find the cheapest region for any instance type:
curl -X GET "https://aws-pricing-mcp.p.rapidapi.com/ec2/compare-regions?instance_type=m5.xlarge"
Response
{
"instance_type": "m5.xlarge",
"cheapest_region": "us-east-2",
"cheapest_price_monthly": 140.16,
"most_expensive_region": "ap-northeast-1",
"most_expensive_price_monthly": 185.04,
"potential_savings_percent": 24.2,
"all_regions": [
{"region": "us-east-2", "monthly": 140.16},
{"region": "us-east-1", "monthly": 142.08}
// …
]
}
Multi‑Service Cost Estimation
Estimate costs for a complete workload:
curl -X POST "https://aws-pricing-mcp.p.rapidapi.com/estimate" \
-H "Content-Type: application/json" \
-d '{
"region": "us-west-2",
"resources": [
{"service": "ec2", "instance_type": "t3.medium", "count": 3},
{"service": "rds", "instance_type": "db.t3.medium", "count": 1},
{"service": "s3", "storage_gb": 100}
]
}'
Integration with AI Agents
If you’re building with Claude, GPT, or any MCP‑compatible system, the API responses are structured for easy parsing—no wrestling with AWS’s pricing API directly.
Example user prompt:
“What’s the cheapest way to run a 3‑node web tier with a managed database in AWS?”
Your agent can now answer with real numbers.
Services Supported
| Service | Pricing Data |
|---|---|
| EC2 | On‑demand, Reserved (1 yr/3 yr), Spot |
| RDS | All engines, Multi‑AZ |
| Lambda | Request + duration |
| S3 | Storage classes, transfer |
| DynamoDB | On‑demand + provisioned |
| ECS/EKS | Fargate + EC2 launch types |
| ElastiCache | Redis + Memcached |
| OpenSearch | Instance + storage |
| … | 20 services total |
Pricing
| Tier | Requests/Month | Price |
|---|---|---|
| Free | 100 | $0 |
| Pro | 5,000 | $49 |
| Ultra | 25,000 | $149 |
| Mega | 100,000 | $299 |
The free tier is enough to prototype and test.
Why I Built This
- AWS’s pricing API is painful. It requires complex filter queries and returns data in a format optimized for AWS, not developers.
- AI agents need structured data. Clean JSON with predictable schemas is essential—no XML, HTML scraping, or “check the console” workarounds.
Try It
The API is live on RapidAPI:
Free tier available. No credit card required to start.