API Gateway vs ALB vs CloudFront cost: what to compare (requests, transfer, add-ons)
People often compare API Gateway, ALB, and CloudFront as “three ways to serve traffic”. Cost comparisons go wrong when you compare only one line item (like request price) and ignore transfer, caching, and add-ons.
Start with the same inputs
- Requests/month (baseline + busy-month scenario)
- Average response size over the wire (compressed)
- Cacheability (expected cache hit rate if using a CDN)
- Traffic path (internet vs private/VPC, cross-region boundaries)
What you pay for (high-level)
| Option | Primary drivers | Common “hidden” drivers |
|---|---|---|
| API Gateway | Requests + transfer | Access logs, WAF, downstream compute (Lambda), retries |
| ALB | Hours + processed data / capacity units | Cross-zone, logs, WAF, upstream compute, health check traffic |
| CloudFront | Edge bandwidth + edge requests | Origin egress (cache misses), invalidations, logs/analytics |
Why CloudFront can change the answer
CloudFront doesn’t replace an API by itself; it changes the traffic profile. If responses are cacheable, a CDN can reduce the number of origin/API requests and the amount of origin transfer, which often matters more than the per request price.
- Origin requests/month ~= edge requests/month × (1 - cache hit rate)
- Origin egress GB/month ~= edge bandwidth GB/month × (1 - cache hit rate)
Related: CloudFront cache hit rate.
A fast comparison workflow
- Estimate requests/month: request volume methods.
- Estimate transfer from response size: response size to transfer.
- Model API request + transfer with API Gateway cost calculator.
- Model CDN bandwidth/requests with CloudFront cost calculator (or generic CDN).
- Model ALB with AWS load balancer cost calculator.
- Add add-ons as separate line items: WAF, logs, custom domains, and any downstream compute.
Common pitfalls
- Comparing only request fees and ignoring transfer (often dominates for non-trivial payloads).
- Using uncompressed payload sizes (overstates transfer).
- Assuming a cache hit rate without validating cacheability and caching headers.
- Ignoring retries/timeouts (can multiply requests and bytes during incidents).
- Forgetting log/analytics costs (CloudWatch, S3, Athena, SIEM ingestion).
Validation checklist
- Validate a real week of requests and transfer from metrics/logs (not only peak RPS).
- Validate cache hit rate with a test distribution before committing to a CDN-driven savings claim.
- Confirm pricing boundaries: region, internet egress vs internal transfer, and which layer emits logs.
Sources
- API Gateway pricing: aws.amazon.com/api-gateway/pricing
- Elastic Load Balancing pricing (ALB): aws.amazon.com/elasticloadbalancing/pricing
- CloudFront pricing: aws.amazon.com/cloudfront/pricing
Related guides
API Gateway cost optimization: reduce requests, bytes, and log spend
A practical playbook to reduce API Gateway spend: identify the dominant driver (requests, transfer, or logs), then apply high-leverage fixes with a validation checklist.
CloudFront vs Cloudflare CDN cost: compare the right line items (bandwidth, requests, origin egress)
A practical comparison checklist for CloudFront vs Cloudflare pricing. Compare bandwidth ($/GB), request fees, region mix, origin egress (cache fill), and add-ons like WAF, logs, and edge compute. Includes a modeling template and validation steps.
Estimate WAF request volume (CDN/LB to monthly requests)
How to estimate WAF request volume for cost models: from CDN/LB metrics, from logs, and what to do about bot spikes.
API Gateway pricing: what to model (requests + transfer)
A practical API Gateway pricing checklist: request charges, data transfer, and the add-ons that can show up on the bill.
ECS vs EKS cost: a practical checklist (compute, overhead, and add-ons)
Compare ECS vs EKS cost with a consistent checklist: compute model, platform overhead, scaling behavior, and the line items that often dominate (load balancers, logs, data transfer).
Lambda vs Fargate cost: a practical comparison (unit economics)
Compare Lambda vs Fargate cost with unit economics: cost per 1M requests (Lambda) versus average running tasks (Fargate), plus the non-compute line items that often dominate (logs, load balancers, transfer).
Related calculators
CDN Cost Calculator
Estimate total CDN cost from bandwidth and request pricing.
CDN Bandwidth Cost Calculator
Estimate monthly CDN bandwidth cost from GB transferred and $/GB pricing.
CDN Request Cost Calculator
Estimate CDN request fees from monthly requests and $ per 10k/1M pricing.
Data Egress Cost Calculator
Estimate monthly egress spend from GB transferred and $/GB pricing.
API Response Size Transfer Calculator
Estimate monthly transfer from request volume and average response size.
VPC Data Transfer Cost Calculator
Estimate data transfer spend from GB/month and $/GB assumptions.
FAQ
Which is cheaper: API Gateway or ALB?
It depends on request volume, payload size, and which features you need. For large payloads, transfer and caching usually matter more than the per-request price.
Where does CloudFront fit in?
CloudFront is a CDN layer. It can reduce origin/API traffic via caching and can change the cost outcome by cutting origin requests and origin transfer.
What's the fastest way to compare options?
Use the same traffic inputs (requests/month, average response size, cache hit rate) and price each option as a simple model. Then add feature add-ons (WAF, logs, custom domains) as separate line items.
Last updated: 2026-01-27