Free calculator
Fargate vs Lambda vs EC2 cost calculator
Three ways to run the same workload, priced against each other. Along with the hourly rate, the result depends on how much of the hour you actually use.
Set the workload once. The EC2 and Fargate columns price the same vCPU and memory for the same hours; the Lambda column prices the same work as events.
Fargate is sized to match.
Instances, or Fargate tasks.
730 is always on. 220 is roughly weekday working hours.
Lambda column only.
Billed to the millisecond.
Lambda cost scales linearly with this.
EC2 on demand
$60.74/month
$728.88/year · ≈ £47/month
Fargate
$144.16/month
$1,729.92/year · ≈ £112/month
Lambda
$13.50/month
$162.00/year · ≈ £11/month
Fargate is $0.04 per vCPU-hour plus $0.00 per GB-hour. Lambda is $0.00 per GB-second plus $0.20 per million requests, with the free tier left out. EC2 is on-demand list price. We estimate a one-year Savings Plan at 20% to 25% off the EC2 and Fargate columns, and arm64 at about 20% off all three.
The scan reads what you actually run rather than what you planned to run, including the Fargate tasks sized at 4 vCPU that use one.
How to read the result
- →Low duty cycle favours Lambda. Per-millisecond billing can beat anything that has to stay running, so cron jobs, webhooks and infrequent APIs are worth pricing on Lambda.
- →Steady load favours EC2 with a commitment. For anything that runs all month, price committed EC2 too. We estimate a one-year Compute Savings Plan at 20% to 25% off EC2 and Fargate.
- →Spiky load favours Fargate. Fargate charges per task-second with no instance to keep warm, so you do not pay for the spare capacity an EC2 cluster keeps to absorb a spike. A plain per-vCPU comparison misses this.
- →Count what surrounds the compute. A container needs a load balancer at about $18 a month and often a NAT gateway at $33. Lambda behind API Gateway pays from $1 per million requests on HTTP APIs. On small workloads these costs can exceed the compute they support.
- →Check Fargate task sizes. You pay for the vCPU and memory a task is defined with, so a 4 vCPU task that uses half a core still bills for 4. Fargate tasks need rightsizing too.
Frequently asked questions
Is Fargate more expensive than EC2?
It depends on the instance type and how busy it is, so compare your own size in the calculator. Fargate can win when utilisation is low or spiky, because you pay per task rather than per instance and have no spare capacity to fund.
When is Lambda cheaper than a container?
Often at low usage and for spiky traffic, because Lambda bills per millisecond with no idle charge while a container bills for as long as it runs. As usage rises, that advantage shrinks, and the calculator shows where the crossover sits for your numbers.
Does the Lambda free tier change the answer?
It can for a small workload. The free tier covers 1 million requests and 400,000 GB-seconds a month. This calculator leaves it out, so small Lambda workloads may cost less than shown.
What about Savings Plans?
Compute Savings Plans apply to EC2, Fargate and Lambda usage. Our conservative estimate for a one-year plan is 20% to 25% off, depending on upfront payment. This calculator uses on-demand rates, so it does not show that discount.
Does arm64 change the comparison?
We estimate about 20% off all three, so the ranking may not change. Test your own workload, as performance on arm64 can differ.