API Gateway Cost Calculator
Estimate API Gateway monthly spend across HTTP, REST, Private REST, and WebSocket traffic with request chunks, transfer, cache, and budget checks.| {{ header }} | Copy |
|---|---|
| {{ cell }} |
| {{ header }} | Copy |
|---|---|
| {{ cell }} |
| {{ header }} | Copy |
|---|---|
| {{ cell }} |
Introduction:
API Gateway bills are often planned too late, after an API has already settled into its traffic pattern. The headline request count matters, but it is only one part of the monthly charge. Payload size, response size, API family, cache choices, private connectivity, and long-lived WebSocket sessions can all move the result before any backend compute, database, logging, or security service is counted.
Amazon API Gateway is commonly used as the front door for Lambda functions, container services, private workloads, webhooks, mobile apps, and browser clients. Its pricing is tied to how traffic crosses that front door. A small JSON API may be mostly request charges. A file upload endpoint can be shaped by payload chunks. A chat service can spend on both messages and connection minutes. A private internal API can avoid public transfer while adding interface endpoint costs.
- API family
- HTTP API, REST API, Private REST API, and WebSocket API each have a different cost shape and feature set.
- Billable unit
- The metered quantity after traffic volume, payload chunking, streaming increments, retries, and allowances are applied.
- Response transfer
- Public HTTP and REST APIs can add data-transfer cost when responses leave AWS or cross the priced transfer path.
- PrivateLink
- Private REST access can require interface endpoints, which add endpoint hours by Availability Zone and data processing.
The most common planning mistake is treating every call as one request and then comparing API families only by the per-million headline rate. HTTP API request metering can increase when the average request exceeds a 512 KB chunk. WebSocket messages are metered in 32 KB chunks and also accrue connection minutes. REST APIs use call tiers, while response-streaming REST APIs can meter large streamed responses in 10 MB increments.
| Cost driver | Typical trigger | Why estimates drift |
|---|---|---|
| Traffic volume | Client requests or WebSocket messages per month | Retries, webhook replays, probes, and test traffic may not appear in the original forecast. |
| Payload size | Large request bodies, streamed responses, or message frames | Average size hides outliers that push traffic into multiple billable chunks. |
| Connectivity | Private APIs or long-lived WebSocket sessions | Endpoint hours, endpoint data, and connection minutes can keep accruing even when request count looks modest. |
| Optional add-ons | REST cache or API Gateway developer portals | Hourly and monthly add-ons can dominate small or low-traffic APIs. |
A useful API Gateway forecast separates the gateway bill from the wider application bill. The gateway estimate can explain request-meter changes, transfer charges, cache economics, and private endpoint cost, but it does not settle Lambda duration, CloudWatch logs, WAF rules, NAT gateways, databases, support fees, or backend scaling. Those neighboring costs should be modeled beside the gateway line instead of being hidden inside it.
How to Use This Tool:
Start with the API shape that best matches the workload, then check the ledger before trusting the total.
- Choose a
Workload presetto load a realistic starting point, or chooseCustomwhen you already have usage data. The summary should update to showMonthly gateway run rateafter valid traffic is present. - Set
API typetoHTTP API,REST API,Private REST API, orWebSocket API. This choice changes the primary meter, the visible fields, and the comparison shown inAPI Type Ladder. - Pick a
Region price profile. UseUS standard rate cardfor the default examples, or use the custom profile when you want to enter exact regional or contract rates inAdvanced. - Enter
Monthly requestsorMonthly messageswith the unit selector, then addAverage request size,Average response size, or WebSocket connection assumptions as they appear for the selected API type. - For REST workloads, set
REST response meteringandREST API cacheonly when those features are actually used. A cache hit rate changes backend-avoidance context, but it does not erase API Gateway request charges.The cache model shows backend requests avoided and cache break-even context; client calls through API Gateway still count toward the gateway request meter. - Use
Apply AWS free tier allowanceonly when the account and billing period qualify. Add aMonthly budget capwhen you want the summary andOptimization Reviewto call out over-budget or under-budget status. - Open
Advancedfor retry overhead, included response transfer, per-GB transfer rate, request-tier prices, WebSocket rates, cache hours, Private REST endpoint rates, and developer portal add-ons.If the summary showsCheck API Gateway assumptions, correct the named input before using the estimate. Traffic must be above zero, payload sizes cannot be negative, and WebSocket connected hours must stay within a day.
Interpreting Results:
The summary total is a gateway-facing monthly estimate in USD. Read it with the badges beside it: API family, metered units, region multiplier, budget status, cache status, endpoint Availability Zones, or response-streaming multiplier can explain why two workloads with the same raw traffic produce different totals.
Cost Breakdownshows the dollar amount for each active cost component and the assumption behind that component.Metering Ledgeris the audit trail for raw traffic, retry-adjusted traffic, payload chunks, allowances, paid units, transfer, endpoint data, connection minutes, and cache avoidance.Optimization Reviewturns the same numbers into budget, payload, cache, transfer, and scope checks.Gateway Cost MixandAPI Type Ladderhelp compare the current model with alternative API families, but they do not prove a migration is safe.
A cheaper API type in the ladder is only a cost signal. Feature requirements such as WebSocket sessions, private connectivity, usage plans, request transformation, authorization style, response streaming, and existing clients can make a higher-cost API family the right one.
A result under the budget cap is not a full application budget. Check the gateway estimate beside Lambda, backend compute, WAF, CloudWatch, custom domains, VPC links, NAT, storage, and support charges before using the number for finance approval.
Technical Details:
An API Gateway estimate begins by converting entered traffic into billable traffic. The conversion first expands the traffic unit, then applies retry or replay overhead, then applies the billing chunk or response-streaming increment for the chosen API family. The paid request or message units are the metered units left after any eligible allowance is subtracted.
After the primary request or message cost is calculated, secondary meters are added only when they apply. Public HTTP and REST APIs can include response data transfer. Private REST APIs replace that public transfer line with interface endpoint hours and endpoint data processing. WebSocket APIs add connection minutes. REST cache and developer portal costs are monthly or hourly add-ons rather than traffic discounts.
Formula Core:
The core estimate uses the following sequence before summing the active cost components.
x is the entered traffic value, Utraffic is the selected unit multiplier, r is retry overhead percent, k is the chunk multiplier, and Nallowance is the enabled request, message, or connection-minute allowance. HTTP APIs use 512 KB request chunks, WebSocket messages use 32 KB chunks, standard REST calls use a chunk factor of 1, and REST response streaming uses 10 MB response increments.
| Component | When it applies | Modeled rule |
|---|---|---|
| HTTP API request units | HTTP API | Paid units are priced through first-300M and over-300M request-unit tiers after 512 KB chunking. |
| REST API requests | REST API and Private REST API | Paid calls use the editable four-tier REST schedule. Response-streaming REST uses response-size increments when enabled. |
| WebSocket usage | WebSocket API | Message units are priced through first-billion and over-billion tiers, and connection minutes use average connections times connected hours over a 30-day month. |
| Response transfer | Public HTTP and REST APIs | Retry-adjusted requests times average response size, minus included transfer, then multiplied by the editable per-GB rate. |
| Private REST endpoint cost | Private REST API | Interface endpoint hours use Availability Zone count times hourly rate times 730 hours; endpoint data uses request plus response payload GB. |
| REST API cache | REST cache enabled | Cache cost is hourly rate times billed hours. Backend requests avoided are shown separately as a break-even clue. |
| Developer portal add-ons | Portal counts entered | Portal and extra product counts are multiplied by their monthly rates before the region multiplier is applied. |
Worked substitution: 25 million HTTP API requests with 2% retry overhead become 25.5 million retry-adjusted events. At 4 KB average request size, the HTTP chunk multiplier remains 1. With a 1 million allowance applied, request charges use 24.5 million paid request units before response transfer is added.
The comparison ladder reruns the same traffic assumptions against each API family. That makes cost pressure visible, but it can compare unlike architectures. Private REST adds endpoint assumptions that public APIs do not use, while WebSocket adds connection minutes that request-response APIs do not have.
Rounding is display-oriented. The JSON output keeps cost fields to four decimal places, while currency in the visible tables is formatted for readability. Very small component costs may disappear from the cost mix chart if they round close to zero, so the ledger is better for fine-grained checks.
Accuracy and Privacy Notes:
AWS prices vary by Region, date, account terms, and service mix. Treat the result as a planning estimate and variance review aid, not as an invoice parser or a substitute for the current AWS pricing pages.
- Verify current regional rates before using the estimate for purchasing, finance approval, or customer pricing.
- Use billing exports or CloudWatch data when available because traffic averages can hide bursty payloads, retries, and malformed clients.
- Keep gateway-only scope clear. Backend compute, logging, WAF, custom domains, data stores, NAT, support, and taxes are outside the monthly total.
- The estimate is calculated in the browser from entered values. Do not share copied results or configured URLs unless the traffic assumptions are safe to disclose.
Worked Examples:
HTTP launch traffic. A launch forecast of 25 million monthly HTTP API requests with 4 KB average request bodies should show a 1x payload chunk factor in Metering Ledger. If the summary badge reports about 25.5M metered units after retry overhead, the request line is being driven by volume rather than chunk multiplication.
REST cache review. A REST API with 100 million monthly calls and a 45% cache hit model still pays API Gateway request charges. Check REST API cache in Cost Breakdown against Backend requests avoided by cache in Metering Ledger before assuming the cache is saving money overall.
Private internal API. A Private REST service with 50 million monthly requests and two endpoint Availability Zones should show endpoint hours and endpoint data processing. If the API Type Ladder makes a public API look cheaper, confirm the private connectivity requirement before treating that lower number as actionable.
WebSocket collaboration workload. A chat or collaboration API with 60 million messages, 10,000 average active connections, and 0.5 connected hours per day adds connection minutes to message-unit cost. If the result is over budget, compare Message metering and WebSocket connection minutes rather than tuning only the message count.
FAQ:
Why can one request count as more than one billable unit?
HTTP API requests above 512 KB and WebSocket messages above 32 KB are metered in chunks. REST response streaming can also multiply billable requests when streamed responses exceed 10 MB increments.
Does REST API cache reduce API Gateway request charges?
No. The cache model adds hourly cache cost and estimates backend requests avoided, but client calls through API Gateway still count toward the gateway request meter.
Why does Private REST include endpoint costs?
Private REST APIs can be reached through interface VPC endpoints. The calculator models endpoint hours by Availability Zone and endpoint data processing when Private REST API is selected.
What should I do when the result says to check assumptions?
Use the validation message first. A valid estimate needs monthly traffic greater than zero, nonnegative payload sizes, and WebSocket connected hours no higher than 24 per day.
Can the API Type Ladder choose my API family?
Use it for cost comparison only. Feature needs such as WebSocket sessions, PrivateLink access, REST-specific behavior, authorization patterns, and existing clients can outweigh the cheaper modeled total.
Are my traffic assumptions sent to AWS?
No AWS pricing lookup runs from your entered values. The estimate is calculated in your browser, but copied output or configured URLs can still reveal assumptions if you share them.
Glossary:
- Request unit
- A billable API Gateway quantity after traffic, chunking, and allowances are applied.
- Response streaming
- A REST API behavior where large streamed responses can be metered in response-size increments.
- Connection minute
- A WebSocket billing measure based on active connections over time.
- PrivateLink
- A private connectivity service that can add interface endpoint hours and data-processing charges for Private REST access.
- Effective cost per million
- The modeled monthly total divided by metered units, expressed per million units.
- Cache hit rate
- The share of REST requests served from API Gateway cache rather than passed through to the backend.
References:
- Amazon API Gateway Pricing, Amazon Web Services.
- AWS PrivateLink Pricing, Amazon Web Services.
- Best Practices for Designing Amazon API Gateway Private APIs and Private Integration, Amazon Web Services.