Skip to main content

AWS API Gateway Cost Calculator & Pricing Guide

API Gateway is the front door for Lambda-backed APIs โ€” but its pricing model has several components that can surprise teams at scale. This guide breaks down REST vs HTTP API costs, caching economics, data transfer charges, and when to switch to alternatives.

โœ“ REST vs HTTP vs WebSocket pricing โœ“ Caching cost-benefit analysis โœ“ API GW vs ALB vs CloudFront โœ“ Cost optimization strategies

API Gateway Pricing Comparison

API Type First Tier (per M req) Higher Volume Caching Available Key Features
REST API (v1)$3.50$2.80 (333M+)Yes ($0.02-$3.80/hr)Full features, WAF, usage plans
HTTP API (v2)$1.00$0.90 (300M+)NoJWT auth, CORS, 71% cheaper
WebSocket API$1.00/M msgs$0.80/M msgsNoReal-time bidirectional

Monthly Cost Estimator

Monthly Requests REST API Cost HTTP API Cost Savings with HTTP API
1 million$3.50$1.00$2.50 (71%)
10 million$35.00$10.00$25.00 (71%)
100 million$350.00$100.00$250.00 (71%)
1 billion$3,080.00$910.00$2,170.00 (70%)

Creating an HTTP API (Cheapest Option)

# AWS CLI โ€” create HTTP API (v2, $1/M requests)
aws apigatewayv2 create-api \
  --name my-http-api \
  --protocol-type HTTP \
  --cors-configuration AllowOrigins=["*"],AllowMethods=["GET","POST"],AllowHeaders=["Content-Type","Authorization"]

# Create Lambda integration
aws apigatewayv2 create-integration \
  --api-id $API_ID \
  --integration-type AWS_PROXY \
  --integration-uri arn:aws:lambda:us-east-1:123456789:function:my-function \
  --payload-format-version 2.0

# Serverless Framework โ€” HTTP API (default in v3)
functions:
  api:
    handler: src/handler.ts
    events:
      - httpApi:          # HTTP API (v2) โ€” $1/M
          path: /users
          method: GET
      # Use 'http' for REST API (v1) โ€” $3.50/M
      # - http:
      #     path: /users
      #     method: GET

API Gateway vs ALB vs CloudFront

Option Base Cost Per Request Best For
API GW HTTP API$0/mo min$1.00/MServerless APIs, low traffic
ALB + Lambda~$16/mo min~$0.008/LCU-hrHigh traffic, steady load
Lambda Function URL$0/mo minLambda cost onlyDirect Lambda, no routing needed

Cost Optimization: Enable Caching

# REST API with caching (reduces Lambda invocations)
# serverless.yml
provider:
  apiGateway:
    restApiId: !Ref ApiGatewayRestApi
    shouldStartNameWithService: true

custom:
  apiGatewayThrottling:
    maxRequestsPerSecond: 1000
    maxConcurrentRequests: 500

functions:
  getUser:
    handler: src/getUser.handler
    events:
      - http:
          path: /users/{id}
          method: GET
          caching:
            enabled: true
            cacheKeyParameters:
              - name: request.path.id
            ttlInSeconds: 300  # 5 min cache

# Cache size 0.5GB = $0.020/hour = $14.40/month
# If cache reduces 80% of 10M requests: saves $2.80/month on Lambda
# ROI: needs ~500K requests/day to justify 0.5GB cache
Share this tool: X / Twitter LinkedIn
โœ“ 60,000+ developers use DevPlaybook โ˜…โ˜…โ˜…โ˜…โ˜… 4.8 / 5 on Gumroad โœ“ MIT licensed ยท Instant download โœ“ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • โšก AI Code Review, Doc Generator & SQL Builder
  • โšก All premium templates & early access
  • โšก Member discounts on Gumroad products
Start Free Trial โ†’

$9/mo after trial ยท Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products โ€” grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro โ€” $79 โ†’

MIT licensed ยท Instant download ยท No subscription

See what's included โ†’ Browse all deals โ†’

Frequently Asked Questions

What is the difference between REST API and HTTP API in API Gateway?▼

REST API (v1) is the original API Gateway type offering full features: usage plans, API keys, request/response mapping templates, caching, WAF integration, and custom authorizers. HTTP API (v2) is a newer, cheaper, faster alternative with fewer features but 71% lower cost. HTTP APIs support JWT authorizers, Lambda integrations, and CORS natively. For most new Lambda-backed APIs, HTTP API is the better choice unless you need caching, usage plans, or complex mapping templates.

How much does API Gateway cost per million requests?▼

REST API costs $3.50 per million requests in us-east-1 (first 333M/month), then $2.80/million. HTTP API costs $1.00 per million for the first 300M/month, then $0.90/million. WebSocket API costs $1.00 per million connection-minutes plus $1.00/million messages. HTTP API is 71% cheaper than REST API for most workloads.

Does API Gateway charge for data transfer?▼

API Gateway charges for data transfer out to the internet at standard AWS rates ($0.09/GB for the first 10TB). Requests from within AWS (same region) to API Gateway are free. For high-bandwidth APIs returning large responses, this data transfer cost can exceed the per-request cost. Use compression (gzip/brotli), response pagination, and caching to minimize data transfer.

How does API Gateway caching work and what does it cost?▼

REST API (not HTTP API) supports response caching with a configurable TTL. Cache sizes range from 0.5GB ($0.020/hour) to 237GB ($3.800/hour). Caching can dramatically reduce Lambda invocations and latency. Cache hits return stored responses without invoking Lambda. Consider caching if you have repeated identical requests with stable responses โ€” the cache cost often pays for itself by reducing Lambda invocations.

Is API Gateway cheaper than ALB for Lambda backends?▼

Application Load Balancer (ALB) costs $0.008/LCU-hour plus $0.0065/hour base (~$4.75/month minimum). For low-traffic APIs (under 1M requests/month), API Gateway HTTP API is often cheaper โ€” no minimum hourly cost. For high-traffic APIs (10M+ requests/month), ALB becomes cost-competitive and offers features like sticky sessions and health checks. CloudFront + Lambda Function URL is another option for global APIs.

What are the API Gateway request and payload size limits?▼

API Gateway limits: Maximum integration timeout is 29 seconds (REST/HTTP API). Maximum request payload is 10MB (REST) or 10MB (HTTP). Maximum response payload is 10MB. For larger payloads or longer timeouts, use S3 pre-signed URLs for file uploads, and Step Functions or SQS for async long-running operations triggered via API Gateway.