Serverless vs. Containers Cost Calculator
Prices one steady workload for a 730-hour month on AWS Lambda, Fargate, Fargate Spot, EC2, Google Cloud Run and Cloudflare Workers. Lambda bills requests plus GB-seconds, which are duration rounded up to 1 ms times memory. Containers bill tasks × hourly rates × 730, with tasks = max(minimum, ⌈rate ÷ (target utilization × task capacity)⌉). The break-even is the request rate above which Lambda's bill stays higher than the always-on fleet's.
Prices last verified November 2, 2026. Figures are estimates in US dollars; confirm with each provider before committing.
Enter a steady request rate, how long each request takes and how much CPU it burns, and the table prices a month of that traffic in ten rows: AWS Lambda on x86 and Arm, Fargate on demand and on Spot, each on x86 and Arm, EC2 on a Savings Plan, Google Cloud Run with either billing mode, and Cloudflare Workers. Every always-on row also shows its break-even, the request rate above which Lambda stays the more expensive choice. The Arm rows and EC2 m7g, which runs on Graviton, are compared with Lambda on Arm, and the rest with Lambda on x86. It answers the question in the narrow sense of compute; running your own servers is a separate comparison.
From 100 ms slices to CPU milliseconds
AWS announced Lambda in preview on 13 November 2014. Jeff Barr's launch post priced it per request plus compute time "in units of 100 milliseconds", with 128 MB to 1 GB of memory, a 60-second limit and a free tier of one million requests and up to 3.2 million seconds a month. At 128 MB those 3.2 million seconds are 400,000 GB-seconds, the same allowance the pricing page lists today.
Containers got the same pay-per-use treatment three years later. AWS Fargate launched on 29 November 2017 in US East (N. Virginia), billed per second at $0.0506 per vCPU-hour and $0.0127 per GB-hour. Today's x86 rates are 80% and 35% of those. Fargate Spot followed on 3 December 2019 with discounts of up to 70%, and Google made Cloud Run generally available on 15 November 2019, billed to the nearest 100 milliseconds.
Lambda's own unit shrank in December 2020, when AWS began rounding duration up to the nearest millisecond. Danilo Poccia's example, 60 million calls of 28 ms, fell from $112 to $40 a month. In September 2021 Arm functions arrived with duration priced 20% below x86, and from 1 August 2025 AWS also bills the initialization phase of ZIP functions on managed runtimes, which was free before.
Cloudflare went further. Workers, introduced on 29 September 2017, runs JavaScript on Chrome's V8 engine instead of giving each customer a virtual machine or container. On 28 September 2023 Cloudflare announced billing on CPU time, "never for the idle time" spent waiting on I/O, with opt-in from 31 October and Workers Paid projects moved over automatically after 1 March 2024. On 12 October 2026 AWS added Lambda Web Functions, which serve up to 128 concurrent requests per environment; this page doesn't price them, because Lambda chooses how many environments run.
How the calculator works
A month is 730 hours, the AWS Pricing Calculator's convention, or 2,628,000 seconds. Lambda charges each request and each GB-second, after the free tier:
Lambda = max(0, requests − 1,000,000) × $0.0000002 + max(0, requests × ⌈ms⌉ ÷ 1,000 × MB ÷ 1,024 − 400,000) × rate per GB-s
The GB-second rate falls in tiers, counted separately on each architecture. The x86 tiers break at 6,000,000,000 and 15,000,000,000 GB-seconds a month, and the Arm tiers at 7,500,000,000 and 18,750,000,000:
| Lambda tier | x86 per GB-s | Arm per GB-s |
|---|---|---|
| First tier | $0.0000166667 | $0.0000133334 |
| Second tier | $0.000015 | $0.0000120001 |
| Above that | $0.0000133334 | $0.0000106667 |
Containers cost the same whether busy or idle, so the question is how many must run. John Little proved in 1961 that the average number of requests in the system equals the arrival rate times the time each one spends there, L = λW, and AWS sizes Lambda concurrency the same way:
in flight = requests per second × duration in seconds
One task can hold concurrency requests at once and supply its vCPUs' worth of CPU time. Autoscalers keep headroom, and Cloud Run's targets 60% of both limits by default, so the calculator scales capacity by your target utilization:
tasks = max(minimum, ⌈rate ÷ (utilization × min(concurrency ÷ duration, vCPUs ÷ CPU time))⌉)
On Fargate the vCPUs are the task's. An EC2 or Cloud Run instance serves with all of its own vCPUs, so those fleets can need fewer machines than Fargate needs tasks.
Fargate tasks then cost their vCPU-hours and GB-hours for 730 hours. The rates come from AWS's price list and Spot feed for us-east-1:
| Fargate, us-east-1 | per vCPU-hour | per GB-hour |
|---|---|---|
| On-demand x86 | $0.04048 | $0.004445 |
| On-demand Arm | $0.03238 | $0.00356 |
| Spot x86 | $0.01355399 | $0.00148833 |
| Spot Arm | $0.01084186 | $0.001192 |
EC2 runs one container per Graviton m7g instance on a 1-year, no-upfront EC2 Instance Savings Plan, picking the smallest size whose memory is larger than the task's, because platform overhead and the kernel take some of it. Cloud Run gets at least 1 vCPU, sized up until the task's memory fits. Its request-based mode bills an instance while it starts, while it shuts down and while at least one request is in flight. The calculator counts only the time in flight. Where Google rounds billable instance time up to the nearest 100 ms, the calculator rounds each request up to the next 100 ms and estimates busy time assuming random arrivals, so the row is an estimate that jumps at each 100 ms step. That row scales to zero like Lambda, with no minimum instances, while the instance-based row keeps the minimum. Workers charges $5 a month per account, then $0.30 per million requests over 10 million and $0.02 per million CPU milliseconds over 30 million.
Within the first GB-second price tier, once both free allowances are used up and before the fleet adds a task, the break-even has a closed form:
break-even = (fleet cost + free-tier value) ÷ (2,628,000 × (request fee + GB-s per request × rate per GB-s))
In general the fleet grows a task at a time, so the two bills can trade places more than once. The calculator searches every price segment up to 1,000,000 requests a second and reports the rate above which Lambda costs more at every higher rate. Take 1 vCPU, 2 GB tasks that hold one 100 ms request at a time, a minimum of one task and 100% target utilization, against a 1,024 MB function using 50 ms of CPU: x86 Lambda first costs more at 8.75 requests a second but stays dearer only from 30.8.
Worked example: the defaults
Twenty requests a second is 52,560,000 a month. At 512 MB and 100 ms each request uses 0.05 GB-seconds, 2,628,000 in all. After the 400,000 free GB-seconds, 2,228,000 at $0.0000166667 cost $37.13, and 51,560,000 billable requests add $10.31, so x86 Lambda costs $47.45 and Arm $40.02.
A 0.5 vCPU task can serve 800 requests a second by concurrency but only 50 by CPU at 10 ms each, and 60% of 50 is 30. Twenty requests a second need one task, but the minimum is two, which also keeps the service up through a task failure, the availability a single copy can't give. Each costs (0.5 × $0.04048 + 1 × $0.004445) × 730 = $18.02, so Fargate costs $36.04.
Lambda adds $2.7156 a month per sustained request a second, and its free tier is worth $6.87, so the x86 break-even is (36.04 + 6.87) ÷ 2.7156 = 15.8 requests a second. Two tasks carry 60 requests a second, so nothing changes before then. The rest of the table: Fargate Arm $28.84, Spot $12.07 and $9.65, two m7g.medium instances $39.42, Cloud Run $75.22 request-based and $99.90 instance-based, and Workers $27.68. Fargate Spot on Arm is cheapest, and Workers is the cheapest option with no capacity to manage.
What it leaves out
The rows price compute only, unless you pick a front door. Then each Fargate and EC2 fleet gets one Application Load Balancer at $0.0225 an hour, $16.43 a month, without load balancer capacity units, and Lambda gets API Gateway HTTP API at $1.00 per million requests, falling to $0.90 after 300 million, with no free allowance. Cloud Run's built-in endpoint is left as is. NAT gateways, public IPv4 addresses, logs, storage and data transfer out are left out of every row.
Prices are AWS us-east-1 and Cloud Run Tier 1, which includes Northern Virginia. Spot prices move, and the free allowances are monthly totals, so turn them off if other workloads already use them up. Lambda's default quotas are 1,000 concurrent executions and 10 times that in requests a second per region; the Lambda rows flag traffic above them. The model also leaves out Reserved Instances, x86 EC2, Fargate's 32 vCPU size, Lambda's Provisioned Concurrency and Managed Instances, and Compute Savings Plans, which on a 1-year, no-upfront term take about 20% off Fargate and 12% off Lambda duration. Cloud Run below 1 vCPU, allowed only with one request at a time, isn't offered, so both Cloud Run rows use the same size.
Prices change without notice and figures here are estimates of compute charges, not quotes; this site is not affiliated with any provider named above. See the site disclaimer.
Frequently asked questions
When does AWS Lambda cost more than Fargate?
At the defaults, a 512 MB function running 100 ms per request against two always-on 0.5 vCPU, 1 GB Fargate tasks, x86 Lambda costs more above 15.8 requests a second, about 41.5 million a month. Below that, the two tasks' flat $36.04 is the bigger bill. Put an Application Load Balancer in front of the tasks and the break-even rises to 21.8 requests a second; put API Gateway in front of Lambda as well and it falls to 11.1.
Does the Lambda free tier still apply on AWS's new Free and Paid plans?
Yes. AWS's free tier page for serverless lists Lambda's one million requests and up to 400,000 GB-seconds a month as an always-free service available on the Free or Paid plan. Free plan accounts get $100 in credits plus up to $100 more, and close after 6 months or when the credits run out. The Lambda allowance is worth $6.87 a month on x86; turn the checkbox off if other functions already use it up.
Why is Cloudflare Workers cheaper than Lambda here?
Workers bills CPU time, not the time a request spends waiting. 52.56 million requests at 10 ms of CPU each cost $27.68 on the Workers Paid plan, against $47.45 on x86 Lambda, which bills the full 100 ms. Each Workers isolate is limited to 128 MB of memory, so it suits light request handlers rather than memory-heavy work.
Is Fargate Spot safe for a production API?
Only mixed with on-demand tasks. On 2 November 2026 Spot ran 66.5% below on-demand in us-east-1, but AWS stops Spot tasks with a two-minute warning, Spot capacity can be unavailable when demand is high, and Fargate does not replace Spot capacity with on-demand capacity.
Why does Cloud Run cost more than Fargate at the defaults?
With more than one request per instance, Cloud Run needs at least 1 vCPU, twice the 0.5 vCPU task. Request-based billing also charges $0.40 per million requests and $0.000024 per vCPU-second while busy. The result is $75.22 request-based and $99.90 instance-based, against $36.04 for two Fargate tasks.
How much does Arm save on Lambda?
Duration costs $0.0000133334 per GB-second on Arm, 20% below x86's $0.0000166667, and requests cost the same. At the defaults the bill falls from $47.45 to $40.02, 15.7% less, because the $0.20 per million request fee does not shrink.
Sources
- AWS Lambda pricing, Amazon Web Services, 2026
- AWS Fargate pricing, Amazon Web Services, 2026
- Compute Savings Plans pricing, Amazon Web Services, 2026
- Elastic Load Balancing pricing, Amazon Web Services, 2026
- Amazon API Gateway pricing, Amazon Web Services, 2026
- Cloud Run pricing, Google Cloud, 2026
- About instance autoscaling in Cloud Run services, Google Cloud, 2026
- Pricing (Cloudflare Workers docs), Cloudflare, 2026
- Configure Lambda Event Function memory, AWS Lambda Developer Guide, 2026
- Understanding Lambda Event Function scaling, AWS Lambda Developer Guide, 2026
- Amazon ECS clusters for Fargate, Amazon ECS Developer Guide, 2026
- Reserving Amazon ECS Linux container instance memory, Amazon ECS Developer Guide, 2026
- AWS Free Tier, Amazon Web Services, 2026
- Free Serverless Computing on AWS, Amazon Web Services, 2026
- Pricing assumptions (AWS Pricing Calculator), Amazon Web Services
- AWS Lambda – Run Code in the Cloud, Jeff Barr, AWS News Blog, 2014
- Introducing AWS Fargate – Run Containers without Managing Infrastructure, Randall Hunt, AWS News Blog, 2017
- Introducing Cloudflare Workers: Run JavaScript Service Workers at the Edge, Kenton Varda, Cloudflare Blog, 2017
- AWS launches Fargate Spot, save up to 70% for fault tolerant applications, AWS What's New, 2019
- Cloud Run is GA, Oren Teich and Pali Bhat, Google Cloud Blog, 2019
- New for AWS Lambda – 1ms Billing Granularity Adds Cost Savings, Danilo Poccia, AWS News Blog, 2020
- AWS Lambda Functions Powered by AWS Graviton2 Processor – Run Your Functions on Arm and Get Up to 34% Better Price Performance, Danilo Poccia, AWS News Blog, 2021
- New Workers pricing — never pay to wait on I/O again, Cloudflare Blog, 2023
- AWS Lambda standardizes billing for INIT Phase, Shubham Gupta and Jeff Gebhart, AWS Compute Blog, 2025
- Announcing AWS Lambda Web Functions, Micah Walter, AWS News Blog, 2026
- A Proof for the Queuing Formula: L = λW, John D. C. Little, Operations Research, 1961