The serverless vs. traditional servers debate is usually framed wrong. It's not about which is cheaper — it's about which is cheaper at your current scale and usage pattern.
Here's the actual cost math across different scenarios.
What You Pay For
Traditional servers (EC2, Compute Engine, etc.):
- Fixed monthly cost regardless of usage
- You pay for idle time
- You manage scaling, patching, provisioning
Serverless (Lambda, Cloud Functions, Cloud Run):
- Pay per request and per GB-second of execution
- Scale to zero (no cost when not used)
- Managed infrastructure
AWS Lambda Pricing (2025)
| Component | Price |
|---|---|
| Requests | $0.20 per 1M requests |
| Duration (x86) | $0.0000166667 per GB-second |
| Free tier | 1M requests + 400,000 GB-seconds/month |
Example: 500ms average duration, 128MB memory, 5M requests/month:
- Requests: 5M × $0.0000002 = $1.00
- Duration: 5M × 0.5s × 0.125GB × $0.0000166667 = $5.21
- Total: $6.21/month
Equivalent EC2 t3.micro (2 vCPU, 1GB): $8.47/month
Lambda wins at this scale.
The Breakeven Analysis
| Monthly requests | Lambda cost | EC2 t3.small | EC2 t3.medium |
|---|---|---|---|
| 1M | $0.42 | $16.94 | $33.87 |
| 5M | $6.21 | $16.94 | $33.87 |
| 10M | $12.42 | $16.94 | $33.87 |
| 20M | $24.84 | $16.94 | $33.87 |
| 50M | $62.10 | $16.94 | $33.87 |
| 100M | $124.20 | $33.87 | $67.74 |
Lambda is cheaper up to roughly 15-20M requests/month for a basic function. Beyond that, a dedicated server becomes more economical.
Important: this ignores cold starts, VPC costs, and API Gateway.
The Hidden Lambda Costs
Pure Lambda pricing underestimates real costs:
| Additional cost | Amount |
|---|---|
| API Gateway | $3.50/M requests |
| Data transfer out | $0.09/GB |
| CloudWatch logs | $0.50/GB ingested |
| VPC NAT Gateway (if needed) | $0.045/hour = $32.40/month |
Adding API Gateway alone doubles the effective request cost. A function behind API Gateway processing 10M requests/month adds $35 before compute.
When Serverless Makes Sense
Ideal serverless workloads:
- Sporadic/bursty traffic (nights and weekends quiet)
- Event-driven processing (queue consumers, webhooks)
- Cron jobs and scheduled tasks
- Very new products with uncertain traffic
- Functions under 1 second execution time
Ideal traditional server workloads:
- Steady high-volume traffic (>20M requests/month)
- Long-running processes (ML inference, video processing)
- WebSockets / persistent connections
- Database-heavy workloads (cold start latency matters)
- Monolithic applications
Container-Based Middle Ground
AWS ECS Fargate and Cloud Run fill the gap between Lambda and full EC2:
- No fixed server management
- Pay per vCPU-second and GB-second
- No cold start penalty
- Better for workloads that run continuously
Cloud Run pricing: $0.00002400/vCPU-second + $0.00000250/GB-second
For a 0.5 vCPU / 256MB container handling steady traffic, Cloud Run often beats Lambda by 30-40% for continuous workloads.
The Architecture Decision
A useful rule of thumb:
- Under 1M requests/month: Serverless — it's free (mostly covered by free tiers)
- 1M-20M requests/month: Serverless with careful cost monitoring
- Over 20M requests/month: Evaluate containers or reserved EC2
Use the Server Cost Calculator and Cloud Cost Calculator to model your specific workload.