Compare

AWS Lambda vs Cloudflare Workers

Lambda bills wall-clock time. Workers bills only active CPU time. That one difference decides which is cheaper for your workload.

TL;DR

Pick Cloudflare Workers for CPU-light, high-request-volume APIs (webhooks, edge logic, redirects) — the CPU-only billing model wins big. Pick AWS Lambda for I/O-heavy or long-running compute jobs already inside the AWS ecosystem.

Pricing model at a glance

ProviderBilling modelRequests
AWS Lambda$0.20/1M requests + $0.0000166667/GB-second (wall-clock)1M free/mo
Cloudflare Workers$0.50/1M requests + ~$0.02/1M CPU-ms (active CPU only)~3M free/mo

Use the serverless function cost calculator to model your own request volume and execution time against both providers.

Active CPU time vs total wall-clock time

The core difference is what gets billed. AWS Lambda charges for the entire time your function runs, from invocation to return — including time spent idle while waiting on a database call, an external API, or any other I/O. Cloudflare Workers only charges for time the CPU is actively executing code, so a function that spends most of its time waiting on I/O costs far less on Workers than the same function on Lambda.

At 100M requests/month with 5ms of CPU time each, that difference plays out as roughly $41/month on Cloudflare Workers versus about $121/month on AWS Lambda plus API Gateway — before egress, which Workers doesn't charge for and AWS does. Workers' free tier is also roughly 3M requests/month, about 10x Lambda's free allowance.

The math flips for I/O-heavy or long-running jobs: when wall-clock time greatly exceeds CPU time, Lambda's per-duration pricing can actually undercut Workers by 20-25% in some scenarios, since Workers' CPU-time billing doesn't apply the same way to compute-light, wait-heavy workloads. AWS Lambda SnapStart also cuts cold-start latency by up to 90% at no extra cost, narrowing one of Lambda's traditional weaknesses versus Workers' near-instant edge startup.

When to pick each

Pick Cloudflare Workers if…

You run CPU-light, high-request-volume workloads like webhooks, edge logic, or redirects, where the CPU-only billing model delivers a large cost advantage.

Pick AWS Lambda if…

Your jobs are I/O-heavy or long-running and already live inside the AWS ecosystem, where SnapStart cold-start improvements and deep AWS integration matter more than raw per-request cost.

Frequently asked questions

Is AWS Lambda or Cloudflare Workers cheaper?

Depends on workload shape — Workers wins for CPU-light, high-volume APIs (~$41 vs ~$121/mo at 100M requests), while Lambda can undercut Workers by 20-25% for I/O-heavy, wall-clock-dominated jobs.

What's the difference between CPU time billing and wall-clock billing?

Workers bills only active CPU execution time. Lambda bills total wall-clock time including idle time spent waiting on I/O like network or database calls.

Does Cloudflare Workers charge for egress bandwidth?

No, unlike AWS Lambda. Workers also offers a larger free tier — about 3M requests/month, roughly 10x Lambda's free allowance.

Related

Serverless function cost calculator · API gateway cost