AWS Lambda exposes cost tradeoffs
- AWS Lambda still looks cheap and elegant for bursty APIs, but AWS’s own pricing and docs show the bill shifts fast once traffic stays hot. - The key lever is GB-seconds — memory size raises CPU and price together — while API Gateway, provisioned concurrency, extra storage, and logs pile on. - That matters because Lambda’s simplicity is real, but steady high-volume services often fit Fargate or containers better.
AWS Lambda is the cleanest on-ramp into serverless for a lot of teams. You write a function, wire it to API Gateway, and AWS handles the machines, scaling, and patching. That part is real. But the tradeoff is also real — Lambda’s price and latency model work beautifully for some workloads and get awkward fast for others. ### What are you actually paying for? Lambda pricing looks simple at first. You pay per request and for execution duration, measured in GB-seconds. The catch is that memory is not just memory — when you raise memory, AWS also gives you more CPU. So tuning for speed can lower latency but raise the per-millisecond rate at the same time. AWS also bills for extra ephemeral storage if you configure it beyond the included amount. (docs.aws.amazon.com) ### Why does that make costs slippery? Because the unit price is only one layer. A real Lambda API often sits behind API Gateway, which has its own per-call pricing. If you need lower cold-start risk, you may add provisioned concurrency, which is a separate charge on top of normal request and duration billing. The result is that a “tiny function” can turn into a stack of metered surfaces — function time, gateway calls, warm capacity, and usually logs. (aws.amazon.com) ### Where do cold starts enter the picture? Cold starts are the price of not paying for idle compute. Lambda creates execution environments on demand, and when no warm environment is available, startup work has to happen before your code runs. That setup time can add noticeable latency for user-facing APIs, especially when functions have large packages, heavy dependency loading, or runtime initialization work. (aws.amazon.com) ### Can AWS reduce that latency? Yes, but usually by moving the tradeoff rather than deleting it. Provisioned concurrency keeps execution environments pre-initialized so requests can land faster, and AWS positions it for interactive workloads that need consistent low-latency responses. SnapStart can also cut initialization time for supported runtimes by snapshotting an initialized function version. Both help performance, but one adds standing cost and the other adds design constraints you have to understand. (aws.amazon.com) ### So when does Lambda shine? Lambda is strongest when work is short-lived, event-driven, and uneven. Think webhooks, background jobs, scheduled tasks, light APIs, or traffic that comes in spikes instead of a flat all-day line. AWS’s own Lambda-versus-Fargate guide basically says the same thing — Lambda is built for short tasks, up to 15 minutes, and tends to be cost-effective when demand is sporadic rather than constant. (docs.aws.amazon.com) ### When do containers start looking better? When your service is busy all the time, needs predictable latency, or wants more control over runtime behavior. Fargate bills by vCPU, memory, operating system, architecture, and storage from image download until the task stops. That can look worse for bursty traffic, but better for long-running, steady-state services where you would otherwise keep paying Lambda request charges and concurrency premiums over and over. (docs.aws.amazon.com) ### Why does API Gateway matter so much? Because people often compare “Lambda cost” to “container cost” and forget the front door. API Gateway is convenient, fully managed, and deeply integrated, but it is not free once traffic grows. AWS also makes HTTP APIs cheaper than REST APIs by offering fewer features, which means architecture choices at the edge can materially change the bill before your function code even runs. (aws.amazon.com) ### What should teams measure first? Start with four numbers — request volume, average duration, memory setting, and p95 latency under warm and cold conditions. Then add the hidden-but-real extras: API Gateway calls, provisioned concurrency if you need it, extra storage, and log ingestion. Basically, Lambda is not “cheap” or “expensive” in the abstract. It is cheap when the workload matches the billing model. (aws.amazon.com) The bottom line is simple. Lambda exposes a clean operational bargain — less infrastructure work in exchange for more sensitivity to workload shape. If your traffic is spiky and your code is short-lived, that bargain is great. If your service is hot all day and users notice every cold start, the convenience can turn into a tax. (aws.amazon.com)