aws_ api_ gateway_ rest_ api cost estimation
A REST API endpoint. Priced per request, with no base hourly fee. Cheaper than ALB at low volume.
An aws_
REST API requests are billed at roughly $3.50 per million requests (US regions), with bulk discounts at very high volume. Data transfer out of API Gateway to the public internet is billed at standard AWS egress rates (~$0.09/GB for first 10 TB).
API Gateway has three product tiers and they're priced differently:
REST APIs (aws_
HTTP APIs (aws_
WebSocket APIs (aws_
Optional features add cost: caching (per hour per cache size), request validation (free), usage plans + API keys (free), private endpoints (PrivateLink-style, billed separately), and CloudWatch Logs (separate).
c3x reads the API type from the resource. Request volume is usage-based via c3x-usage.yml's monthly_
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "aws_api_gateway_rest_api" "main" {
name = "production-api"
description = "Production REST API"
endpoint_configuration {
types = ["REGIONAL"]
}
}
resource "aws_api_gateway_resource" "users" {
rest_api_id = aws_api_gateway_rest_api.main.id
parent_id = aws_api_gateway_rest_api.main.root_resource_id
path_part = "users"
}
resource "aws_api_gateway_method" "get_users" {
rest_api_id = aws_api_gateway_rest_api.main.id
resource_id = aws_api_gateway_resource.users.id
http_method = "GET"
authorization = "AWS_IAM"
}
resource "aws_api_gateway_deployment" "main" {
rest_api_id = aws_api_gateway_rest_api.main.id
triggers = {
redeployment = sha1(jsonencode(aws_api_gateway_rest_api.main.body))
}
}
resource "aws_api_gateway_stage" "prod" {
deployment_id = aws_api_gateway_deployment.main.id
rest_api_id = aws_api_gateway_rest_api.main.id
stage_name = "prod"
}Pricing dimensions
What you actually pay for when you provision aws_.
| Dimension | Unit | What's being charged |
|---|---|---|
| API requests | per 1M requests | Each API call (regardless of method or response size). Bulk discounts at high volume. $3.50/1M requests for REST API (first 333M/month) |
| Data transfer out | per GB | Bytes returned from the API to clients. Standard AWS egress rates apply. |
| Caching | per cache-hour | Optional response cache, priced by cache size (0.5 GB through 237 GB). Continuous billing while enabled. $0.020/hour for 0.5 GB cache |
| Private API endpoints | per hour + per GB | If endpoint_ |
Optimization tips
Common ways to reduce aws_ cost without changing the workload.
Use HTTP API (v2) instead of REST API when features allow
71% on requestsHTTP APIs are 71% cheaper per request and support most common use cases (JWT auth, OIDC, simple proxy integrations, CORS). Use REST API only if you specifically need request validation, response transformations, or API Gateway request signing.
Skip caching unless you have a real cache hit story
$14-$2,500/month depending on cache sizeThe smallest cache is $14/month. Cache only pays back if hits exceed ~4M/month at REST API rates. Most APIs don't have cacheable enough traffic to make it worthwhile.
Use ALB for sustained high-RPS workloads
Volume-dependentAPI Gateway is cheaper for low volume but linear with traffic. At ~30M requests/month, ALB's $16 base + LCU charges become cheaper. The crossover depends on payload size and LCU profile but happens earlier than people expect.
Move to Lambda Function URLs for single-function APIs
100% of API Gateway costFor a Lambda exposed at one HTTPS endpoint, Lambda Function URLs are free. Skip API Gateway entirely. Loses request validation, throttling, custom domains, but right for internal services.
FAQ
What's the difference between REST API and HTTP API in c3x?
REST API is aws_
Are CloudFront-attached API Gateway requests billed twice?
Yes. If you put CloudFront in front of API Gateway, you pay both CloudFront request fees and API Gateway request fees for every uncached request. Cache hits at CloudFront skip API Gateway entirely.
Does c3x include WAF cost?
WAF is a separate resource (aws_
What about API Gateway free tier?
1 million REST API requests per month are free for the first 12 months. HTTP API has the same. c3x can apply this via account-level free tier settings in the usage file.
Related resources
More AWS resources
Further reading
- API gateway cost compared: API Gateway vs API Management vs Cloud endpoints
AWS API Gateway, Azure API Management, and GCP's API Gateway/Cloud Endpoints price API management differently, per-request vs tiered subscription vs per-call. The cheapest depends on volume and feature needs. This compares them.
- AppSync vs API Gateway cost: GraphQL vs REST pricing
AWS AppSync (managed GraphQL) and API Gateway (REST and HTTP) are priced differently and suit different workloads. AppSync bills per query and real-time message; API Gateway bills per request. Here is how they compare and when each is cheaper.
- GCP Apigee cost: an always-on platform priced by tier and calls
Apigee is a full API management platform priced by subscription tier (or pay-as-you-go per API call), with a significant baseline for the standard tiers. It is powerful but not cheap. Here is how it prices and when a lighter gateway suffices.
- Estimating AWS Lambda costs from Terraform
Lambda is the most mis-estimated AWS service. Here's why cost tools show $0 by default, what data to feed them for accurate numbers, and the four optimization levers that actually move the bill.
Estimate this resource in your own Terraform
Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_.