Serverless Isn't Always Cheaper: When to Move Off Lambda
The Serverless Cost Myth
Serverless is marketed as the cheaper option because you only pay for what you use. That's true at low volumes. But Lambda pricing is linear: double the invocations, double the cost. Container pricing is step-function: you pay for capacity blocks, and each block handles a range of traffic. At some point, the lines cross, and Lambda becomes more expensive. We see this crossover more often than most teams expect.
The Math Nobody Does Upfront
Lambda costs $0.20 per million invocations plus $0.0000166667 per GB-second. A 256MB function running for 500ms costs about $0.0000021 per invocation. At 1 million requests per month, that's $2.10. At 100 million requests per month, that's $210. A Fargate task with 0.5 vCPU and 1GB memory running 24/7 costs about $30/month and can handle 200-500 requests per second depending on your workload, which is 500 million to 1.3 billion requests per month. The crossover point for this configuration is roughly 15-20 million requests per month. Beyond that, you're overpaying for serverless.
Hidden Costs That Add Up
Lambda's per-invocation cost is only part of the picture. API Gateway adds $3.50 per million requests. CloudWatch Logs charges for every log line Lambda emits. If you're using Provisioned Concurrency to avoid cold starts, you're paying for reserved capacity anyway, which negates the 'pay only for what you use' benefit. We audited one client who was spending $4,200/month on Lambda plus $2,800/month on API Gateway and CloudWatch for a set of APIs that could run on two Fargate tasks for $120/month.
Signs You Should Move Off Lambda
You should evaluate a migration from Lambda to containers when: your functions run consistently above 10 million invocations per month, you're using Provisioned Concurrency on more than 5 functions, your P95 latency requirements are under 100ms (cold starts make this unreliable), you need persistent database connections (Lambda's connection pooling with RDS Proxy adds cost and complexity), or your functions share significant code and would be simpler as a single service with multiple endpoints.
How We Handle the Migration
We don't recommend ripping out Lambda entirely. The move is surgical: identify the high-volume, latency-sensitive functions that are costing the most, containerize those as ECS Fargate services, and keep Lambda for the event-driven, bursty workloads where it still wins. On a recent engagement, we migrated 8 high-traffic Lambda functions to 3 Fargate services. Monthly compute cost dropped from $3,800 to $890, P95 latency improved by 60%, and the team stopped dealing with cold start complaints from users.