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_api_gateway_rest_api is a fully-managed REST API endpoint. Unlike load balancers, there's no per-hour cost. You pay per request plus data transfer out.
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_api_gateway_rest_api) are the original, most feature-rich, and most expensive. $3.50/M requests.
HTTP APIs (aws_apigatewayv2_api with protocol_type = "HTTP") are a newer, cheaper, simpler tier. $1.00/M requests — about 71% less. Lack a few advanced features (request validation, response transformations) but right for most modern use cases.
WebSocket APIs (aws_apigatewayv2_api with protocol_type = "WEBSOCKET") bill per connection-minute and per message. Different model entirely.
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_requests attribute on the API.
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_api_gateway_rest_api.
| 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_configuration includes PRIVATE, each VPC endpoint is billed separately. |
Optimization tips
Common ways to reduce aws_api_gateway_rest_api 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_api_gateway_rest_api. HTTP API is aws_apigatewayv2_api with protocol_type='HTTP'. They have different pricing ($3.50/M vs $1.00/M per request). c3x reads the type and applies the right rate.
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_wafv2_web_acl). If you associate WAF with API Gateway, c3x estimates the WAF Web ACL and rule charges independently.
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
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_api_gateway_rest_api.