Serverless charges per millisecond executed. For specific workloads, this math saves money. For others, the monthly bill exceeds the cost of equivalent containers. AWS Lambda pricing documentation details: $0.20 per 1 million requests plus $0.0000166667 per GB-second.
Where it saves
- Sporadic traffic: cron jobs, webhooks, nightly processing; a function running 2% of the time costs 2% of an idle container
- Unpredictable spikes: black friday, viral campaigns; scales to a thousand instances with zero capacity planning
- Glue code: transforms between systems, event enrichment, thumbnails; small functions are this workload's natural habitat
Where it costs a fortune
Constant heavy traffic flips the equation: a function running 24/7 with generous memory costs more than the equivalent reserved container. Per benchmarks published by AWS and observed in production, above 60-70% average utilization, containers win on cost. Sub-millisecond latency requirements never fit Lambda. Persistent connections (mass WebSocket, gRPC streaming) suffer under the request-response model.
Cold starts
Cold invocations cost hundreds of milliseconds on compiled runtimes, seconds on unoptimized Java. SnapStart and provisioned concurrency mitigate, both charging for the privilege. VPC networking adds initialization delay. AWS documentation indicates typical cold starts of 100-300ms on Node.js and Python, and 1-3 seconds on Java without SnapStart.
Lock-in
SQS triggers, DynamoDB streams, per-function granular IAM: coupling to the AWS ecosystem grows silently. Migrating later means rewriting entire integrations. Price this cost before deciding.
Observability
Distributed tracing across hundreds of ephemeral functions ships with nothing. Cold starts hide inside aggregate p95. Specialized tooling (Lumigo, Datadog Lambda layers) solves it, each with its own invoice.
Decision
Traffic sporadic or spiky? Does latency tolerate hundreds of ms? Does the team accept provider coupling? Three yeses: go serverless. Two nos: containers.
Enjoyed this content?
I build web products and AI solutions the right way — solid architecture, maintainable code, and real delivery.
Let's talk