dev · 2026-05-01

Container (ECS/EKS) vs Serverless (Lambda) cost

Compare monthly cost of running a workload on always-on containers vs serverless Lambda — break-even by request volume.

Lambda saves vs container
$206

Inputs

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

Supporting metrics

Container monthly cost$320
Lambda monthly cost$114
Break-even requests (M)140

About this calculator

Lambda or ECS — the volume crossover

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.

The math

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:

When containers win

When Lambda wins

The break-even

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.

What this calc misses

FAQ

What about Fargate?

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.

Don't I need API Gateway with Lambda?

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).

What if my Lambda is slow?

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.