dev · 2026-05-01
Compare monthly cost of running a workload on always-on containers vs serverless Lambda — break-even by request volume.
| Monthly requests (millions) | 50 |
| Avg request duration (ms) | 250 |
| Avg memory per request (MB) | 512 |
| Container fixed monthly cost | $320 |
| Lambda $/GB-second | $0 |
| Lambda $/request | $0 |
| Container monthly cost | $320 |
| Lambda monthly cost | $114 |
| Break-even requests (M) | 140 |
Lambda is cheap at low volumes (often free) and expensive at high volumes. Containers are expensive at low volumes (always-on bill) and cheap at high volumes. The break-even depends on request rate, duration, and memory.
GB-seconds per request = memory MB ÷ 1024 × duration ms ÷ 1000
total GB-seconds = requests × GB-seconds per request
Lambda cost = total GB-seconds × $0.0000166667 + requests × $0.0000002
Default scenario: 50M requests/mo × 250ms × 512MB:
Default scenario: $320 / per-request cost ($0.00000228) = ~140M requests/mo before Lambda exceeds container cost. Above 140M req/mo: containers cheaper. Below: Lambda cheaper.
Fargate is between Lambda and EC2. Per-second billing for the container's exact CPU/memory. About 30-50% more expensive than EC2 for sustained workloads but no infrastructure management. Best for workloads that don't fit Lambda (long duration, high memory) but where ops simplicity matters.
For HTTP APIs: yes. API Gateway adds $1/million requests for REST or $0.90/million for HTTP. Lambda Function URLs are FREE alternative for simple HTTP endpoints — skip API Gateway when you don't need its features (auth, request validation, etc).
Lambda costs scale with duration. A 5000ms function uses 20x more compute than 250ms. If your Lambda is slow due to inefficient code, OPTIMIZE — same revenue at 1/10 cost. If slow due to inherent work (image processing), containers are usually cheaper. Lambda's sweet spot is sub-1-second functions.