
On this page
- What are you actually paying for in each model?
- When does Lambda stop being the cheap option?
- Why do serverless bills surprise teams?
- Is Fargate actually cheaper than managing EC2 yourself?
- What about the costs that never show up on the bill?
- How do you decide between serverless and containers?
- So what’s the honest default?
- Questions people ask
A serverless versus containers debate can end with one sentence before anyone opens a pricing page: “but Lambda is basically free.” Someone says it, half the room nods, and the architecture is decided.
The reflex runs both ways. The serverless camp quotes the free tier and the pennies-per-million-requests headline. The containers camp quotes surprise-bill horror stories and declares that a Fargate task you can reason about beats a function you can’t. Both are arguing with folklore, and folklore doesn’t pay the invoice.
The honest comparison isn’t Lambda versus Fargate as products. It’s a per-execution billing model versus a provisioned-capacity billing model, and the variable that decides between them is duty cycle: the share of time your service is doing real work.
What are you actually paying for in each model?
Lambda charges for execution and Fargate charges for provisioning, and that single difference drives every number in this article. One is a price for work done, the other a price for capacity held, so their headline rates aren’t directly comparable until you convert both into the same unit of work.
Lambda bills $0.20 per million requests plus $0.0000166667 per GB-second of execution on x86, with a free tier of one million requests and 400,000 GB-seconds a month (AWS Lambda pricing). Fargate bills $0.04048 per vCPU-hour and $0.004445 per GB-hour for every second a Linux/x86 task runs, working or not, with a one-minute minimum (AWS Fargate pricing).
Lambda (us-east-1, x86, on-demand, Oct 2026)
requests $0.20 per 1M
duration $0.0000166667 per GB-second
free tier 1M requests + 400,000 GB-seconds per month
Fargate (us-east-1, Linux/x86, on-demand, Oct 2026)
vCPU $0.04048 per vCPU-hour
memory $0.004445 per GB-hour
storage 20 GB ephemeral included per taskTwo footnotes matter on both sides. Arm pricing is about 20 percent lower for Lambda and for Fargate, and for code that already runs on Arm it’s an easy change to test. And Lambda’s memory setting also controls CPU: at 1,769 MB a function gets the equivalent of one vCPU (Configure Lambda memory), which is what makes an apples-to-apples capacity comparison possible.
When does Lambda stop being the cheap option?
When your traffic stops being spiky. Fully utilized, Lambda compute costs roughly twice the equivalent Fargate task, and because Lambda only bills while executing, the break-even sits a little under the halfway mark. Below roughly 46 percent duty cycle Lambda wins on raw compute; above it, the always-on container wins.
Here’s the arithmetic for an illustrative small API function, 512 MB with a 200 ms average duration, next to a small always-on Fargate task that could plausibly serve the same load:
Lambda, 512 MB, 200 ms average, x86, before the free tier
per call 0.5 GB x 0.2 s = 0.1 GB-s
0.1 x $0.0000166667 + $0.0000002 = ~$0.00000187
10M calls ~ $18.67 per month
Fargate, one task, 0.5 vCPU / 1 GB, running 24/7 (730 h)
vCPU 0.5 x $0.04048 x 730 h = $14.78
memory 1.0 x $0.004445 x 730 h = $3.24
total ~ $18.02 per monthTen million requests a month sounds like a lot. It averages under four requests per second, a load a single small container can often serve, depending on how much of each 200 ms is CPU. At that point the two bills already roughly match, and every additional request makes Lambda more expensive while the container’s price stays flat until it needs more capacity. The account-wide free tier can take up to $6.87 off the Lambda side, which moves the crossover without removing it. Is your “cheap” function really cheap, or is it just early?
There’s a cleaner way to see it. Using the 1,769 MB equals one vCPU equivalence, an hour of fully busy Lambda capacity costs about $0.106 before request charges, while a Fargate task with one vCPU and 2 GB costs about $0.049 an hour. That’s the same discipline I argued for in the real cost of an LLM call vs a SQL query: price the unit of work, not the brochure.
Think of it as a premium ladder. Per unit of fully used compute, on-demand EC2 is cheapest, Fargate sits above it, and Lambda sits on top. Each rung buys you out of a layer of management. The ladder inverts as utilization falls, because the lower rungs keep billing you for capacity that serves nobody.
Why do serverless bills surprise teams?
Because the Lambda line item is only part of the request path. The compute is priced plainly per GB-second; API Gateway requests, log ingestion and NAT data processing are priced separately and scale with the same traffic, so an estimate that prices only the function leaves real money out.
The usual suspects, at published AWS rates:
| Service | Published rate |
|---|---|
| API Gateway, HTTP APIs | $1.00 per million requests (first 300 million a month) |
| API Gateway, REST APIs | $3.50 per million requests (first 333 million a month) |
| CloudWatch Logs ingestion | $0.50 per GB in the Standard class; Lambda logs tier down from $0.50 to $0.05 per GB at high volume |
| NAT gateway (VPC-attached functions) | $0.045 per hour plus $0.045 per GB processed |
Put numbers on the ten-million-call function above. An HTTP API in front of it adds $10.00 a month and a REST API $35.00, against $18.67 of Lambda compute (Amazon API Gateway pricing). Assume each invocation writes 2 KB of logs, and that’s about 20 GB, or $10.00 of ingestion. A VPC-attached function that reaches S3 or DynamoDB through a NAT gateway also pays $0.045 for every gigabyte it moves that way, a charge gateway VPC endpoints remove entirely. None of these lines is large on its own, but together they can match or exceed the compute. The database layer has its own version of this, covered in database choices that quietly kill your AWS bill.
Containers carry overhead too: an Application Load Balancer bills $0.0225 an hour, about $16.43 a month, before its capacity-unit charges (Elastic Load Balancing pricing), a NAT gateway about $32.85 a month before data processing, and an EKS control plane adds $0.10 an hour, about $73 a month per cluster, before a single pod runs (Amazon EKS pricing). The difference is shape, not existence. Container overhead starts from a flat hourly floor; serverless overhead is almost entirely per request, which is exactly why it surprises people.
Is Fargate actually cheaper than managing EC2 yourself?
Per hour, no. At us-east-1 on-demand rates, the same vCPU and memory cost about 16 percent more on Fargate than on a compute-optimized c5.xlarge, and about 40 percent more than on a burstable t3.xlarge. But an EC2 cluster bills for its idle headroom, and below about 86 percent utilization the c5 fleet’s price per used vCPU passes Fargate’s.
The arithmetic: a c5.xlarge (4 vCPU, 8 GiB) lists at $0.17 an hour and a Fargate task of the same size costs $0.197; a t3.xlarge (4 vCPU, 16 GiB) lists at $0.1664 against $0.233 on Fargate, though a t3 runs above its baseline CPU only by spending CPU credits (Amazon EC2 On-Demand pricing). The premium buys you out of capacity planning, AMI patching and bin-packing arguments. Whether that’s worth 16 to 40 percent depends entirely on whether someone on your team was going to do that work well anyway.
Two levers move the Fargate number substantially before any architecture change:
- Fargate Spot runs interrupt-tolerant ECS tasks at up to 70 percent off.
- Compute Savings Plans apply one commitment across EC2, Fargate and Lambda for one or three year terms, with AWS documenting savings of up to 50 percent on Fargate and up to 17 percent on Lambda duration and provisioned concurrency (AWS News Blog). For steady workloads, a Savings Plan is a sensible first move on either side of this debate.
What about the costs that never show up on the bill?
The bill is the smaller half of the comparison. The larger half is paid in engineering time, and it lands on different teams depending on the model. Serverless charges you in cold starts and workarounds; containers charge you in operations. The cheaper tax is usually the one your team already knows how to pay.
On the serverless side, latency-sensitive endpoints grow provisioned concurrency, long-running jobs get chopped to fit the 15-minute execution ceiling, and local development becomes emulation. Each workaround is small; together they’re a tax on every feature that doesn’t fit the event-shaped mould. On the container side, the tax is base image patching, orchestrator upgrades, autoscaling policies that need tuning, and an on-call rotation that now includes infrastructure.
Picture two designs whose projected AWS bills differ by under ten percent, well inside the error bars of any traffic forecast. If one design’s 2 am failure modes are ones your team has already debugged, that can be a better reason to pick it than the gap on the invoice. The invoice never captures that.
How do you decide between serverless and containers?
Four questions settle most cases, and you can answer them from data you already have: traffic shape across a full day, duty cycle in compute terms, who runs your operations, and what sits around the compute. Read the answers together rather than separately, because the combination decides the model, not any single answer.
- What does your traffic look like across a full day? Pull the request graph. Spiky, bursty or near zero for long stretches means per-execution pricing is working for you. A steady band means you’re paying Lambda’s premium around the clock for elasticity you don’t use.
- What’s your duty cycle in compute terms? Estimate aggregate GB-seconds per month and divide by what an always-on task of equivalent capacity provides. Under roughly 46 percent, Lambda wins on raw compute; over it, containers do. This one question replaces most of the debate.
- Who is doing the ops? No platform team and no appetite for one points to Lambda, or Fargate if your workloads don’t fit functions. A capable platform team at steady scale points toward containers, and eventually toward managed capacity on EC2 underneath them.
- What sits around the compute? Price the whole request path: API Gateway or ALB, NAT or VPC endpoints, log ingestion and retention. Caching and read-path choices belong in the same spreadsheet; see read replicas vs caching vs both.
Spiky traffic, low duty cycle, thin ops bench: serverless, and spend your care on the supporting services. Steady traffic, high duty cycle, real platform capability: containers, and consider a Savings Plan once the baseline is stable. Mixed estates are normal, and running both deliberately is a sound outcome. If you’re still on the fence about the managed services underneath, the AWS services you’re probably paying for and don’t need is the next read.
So what’s the honest default?
Let each workload’s traffic shape pick its billing model. Spiky, event-shaped, often-idle work belongs on Lambda. Steady, always-busy services belong in containers: on Fargate while your scale is modest and your team small, on managed EC2 capacity when both grow. On either path, price the full request path.
Getting it wrong has a signature on each side. The serverless version is a bill that scales linearly with success, plus a provisioned concurrency line that quietly rebuilds the server you left. The container version is a fleet of non-production tasks that, if they’re used 40 hours a week, spend about 76 percent of their lives serving nobody. Both failures come from choosing the model on ideology and never re-checking it against a request graph.
So run the arithmetic in this article against your own numbers. The comparison only stays dishonest while nobody opens the rate card.
The services around the compute deserve the same scrutiny: AWS services you’re paying for and probably don’t need goes through them one by one, and the Cloud & DevOps section collects the rest.
Key takeaways
- Lambda bills per execution; Fargate bills for provisioned capacity, busy or not. Duty cycle, the share of time your service does real work, decides which model is cheaper.
- At published us-east-1 rates, fully utilized Lambda compute costs roughly twice the equivalent Fargate task. Below just under half utilization, Lambda wins on raw compute.
- The supporting services (API Gateway, CloudWatch Logs, NAT gateways) can cost as much as the compute line itself, on both sides of the debate.
- Fargate costs about 16 to 40 percent more per hour than comparable on-demand EC2 in us-east-1, and the idle headroom on an EC2 cluster can cancel that premium out.
- Decide with four questions: traffic shape, duty cycle, who runs your ops, and what sits around the compute.

Questions people ask
Is serverless cheaper than containers on AWS?
It depends on duty cycle. Lambda bills only while code executes, so spiky or idle-heavy workloads can cost far less than an always-on container. At steady traffic, a provisioned Fargate task delivers equivalent compute for roughly half Lambda's effective rate. Neither model is cheaper in every case, and traffic shape decides.
When is Fargate cheaper than Lambda?
Fargate wins when a service does real work for a large share of the day. At published us-east-1 rates, fully utilized Lambda capacity costs roughly twice the equivalent Fargate task, so once utilization passes about 46 percent, the always-on container becomes the cheaper option on raw compute.
What hidden costs inflate serverless bills?
API Gateway request charges, CloudWatch Logs ingestion and NAT gateway data processing are priced separately from the function and scale with the same traffic. For a function handling ten million requests a month, a REST API alone adds $35, more than that function's own compute in this article's example, so estimate the full request path before committing.
Is Fargate more expensive than EC2?
Per hour, yes. At us-east-1 on-demand rates, Fargate costs about 16 percent more than a c5.xlarge for the same vCPU and memory, and about 40 percent more than a t3.xlarge. The premium buys freedom from capacity planning and patching, and an EC2 cluster's idle headroom can cancel it: below about 86 percent utilization, the c5 fleet costs more per used vCPU.
Do AWS Savings Plans cover both Lambda and Fargate?
Yes. Compute Savings Plans apply one commitment across EC2, Fargate and Lambda for one or three year terms. AWS documents savings of up to 17 percent on Lambda duration and provisioned concurrency charges and up to 50 percent on Fargate, which makes a Savings Plan a sensible first cost lever for steady workloads.
Get the next article by email
One email when a new deep-dive is out: databases, cloud and AI, with the code. Unsubscribe in one click.
Email signups open soon. Until then, new articles are announced on Instagram.
