AWS API Gateway offers three API types with vastly different pricing. Choosing REST API when HTTP API would suffice costs you 3.5x more per request. For high-volume APIs, this adds up to thousands of dollars monthly. Understanding which type you actually need is the first step to controlling costs.
TL;DR: HTTP APIs cost $1.00 per million requests — 71% cheaper than REST APIs at $3.50 per million. WebSocket APIs cost $1.00 per million messages plus $0.25 per million connection minutes. For most CRUD APIs and Lambda integrations, HTTP APIs are the right choice. REST APIs are only worth the premium when you need request validation, WAF integration, or API keys built in.
API Type Pricing Comparison
Request Pricing
| API Type | First 333M requests/mo | Over 333M | Over 667M | Over 1B |
|---|---|---|---|---|
| REST API | $3.50/million | $2.80/million | $2.38/million | $1.51/million |
| HTTP API | $1.00/million | $0.90/million | — | — |
| WebSocket | $1.00/million messages | — | — | — |
WebSocket Connection Pricing
| Component | Cost |
|---|---|
| Messages | $1.00 per million |
| Connection minutes | $0.25 per million minutes |
A WebSocket API with 10,000 concurrent connections for 8 hours/day for 30 days: 10,000 x 8 x 60 x 30 = 144M minutes = $36/month in connection charges alone.
Data Transfer
| Tier | Cost/GB |
|---|---|
| First 10 TB/month | $0.09 |
| Next 40 TB | $0.085 |
| Next 100 TB | $0.07 |
| Over 150 TB | $0.05 |
REST vs HTTP API Feature Comparison
| Feature | REST API | HTTP API |
|---|---|---|
| Price per million | $3.50 | $1.00 |
| Lambda integration | Yes | Yes |
| HTTP proxy | Yes | Yes |
| OIDC/OAuth 2.0 auth | Yes | Yes (native JWT) |
| API keys | Yes | No |
| Request validation | Yes | No |
| WAF integration | Yes | No |
| Caching | Yes ($0.02-$3.80/hr) | No |
| Usage plans/throttling | Yes | Basic throttling |
| Private APIs | Yes | No |
Bottom line: If you don't need API keys, request validation, caching, or WAF — use HTTP API and save 71%.
Real-World Cost Examples
| Scenario | REST API Cost | HTTP API Cost | Savings |
|---|---|---|---|
| 1M requests/month | $3.50 | $1.00 | 71% |
| 50M requests/month | $175 | $50 | 71% |
| 500M requests/month | $1,470 | $465 | 68% |
| 1B requests/month | $2,510 | $910 | 64% |
Hidden Costs
Caching (REST API Only)
| Cache Size | Cost/hour | Monthly |
|---|---|---|
| 0.5 GB | $0.020 | $14.60 |
| 1.6 GB | $0.038 | $27.74 |
| 6.1 GB | $0.200 | $146.00 |
| 237 GB | $3.800 | $2,774.00 |
Caching is often forgotten when estimating costs. A 6.1 GB cache adds $146/month.
CloudWatch Logs
Enabling execution logging generates CloudWatch Logs charges. At $0.50/GB ingested, verbose logging for a high-traffic API can cost more than the API Gateway itself.
Custom Domain Names
Custom domain names are free, but the underlying ACM certificate and Route 53 hosted zone have their own costs (minimal).
Cost Optimization Tips
1. Migrate REST APIs to HTTP APIs
If you're using REST API only for Lambda proxy integration without caching or WAF, switch to HTTP API. The migration is straightforward for most use cases.
2. Disable Execution Logging in Production
Use access logging (structured, cheaper) instead of full execution logging. Enable execution logging only for debugging specific issues.
3. Use Lambda Response Caching Upstream
Instead of API Gateway caching ($14-2,774/month), implement caching in Lambda with ElastiCache or DynamoDB DAX. This is often cheaper and more flexible.
4. Optimize Payload Sizes
API Gateway charges for data transfer. Enable gzip compression on responses to reduce transfer costs by 60-80%.
Related Guides
- AWS Lambda Pricing Guide
- AWS Step Functions Pricing Guide
- AWS Route 53 Pricing Guide
- AWS CloudWatch Pricing Guide
FAQ
Should I use REST API or HTTP API?
Use HTTP API unless you specifically need REST API features (API keys, request validation, WAF, caching, private APIs). HTTP API is 71% cheaper and sufficient for most serverless backends.
How do WebSocket API costs compare to polling?
For real-time applications with 10,000 users, WebSocket costs approximately $36/month in connection minutes plus message charges. HTTP polling the same users every 5 seconds would cost $262/month in API requests. WebSocket is cheaper for real-time use cases.
Is there a free tier for API Gateway?
Yes. The free tier includes 1 million REST API calls and 1 million HTTP API calls per month for the first 12 months of your AWS account.
Lower Your API Gateway Costs with Wring
Wring helps you access AWS credits and volume discounts to lower your API Gateway costs. Through group buying power, Wring negotiates better rates so you pay less per API request.
