Cloudflare Workers vs AWS Lambda: A Real-World Comparison
We migrated a production API from Lambda to Workers. Here's what happened to costs, latency, and reliability.
Why We Migrated from Lambda to Workers
Our client's API was running on AWS Lambda with API Gateway, processing about 500K requests per day. While Lambda worked, we were hitting three pain points: cold starts averaging 800ms, unpredictable costs that spiked during traffic peaks, and regional latency for international users.
We decided to migrate to Cloudflare Workers to see if edge computing could solve these problems. Spoiler: it did, and then some.
Cold Starts: The Biggest Difference
Lambda cold starts were our biggest frustration. Every time a function hadn't been invoked recently, the first request would take 800ms-2s depending on the runtime and package size. With Node.js and a few dependencies, cold starts averaged 1.2 seconds.
Cloudflare Workers have zero cold starts. Every request, whether it's the first in an hour or the millionth in a minute, starts in under 1ms. This alone improved our P99 latency from 2.1 seconds to 45 milliseconds.
Cost Comparison
Here's the real numbers from our migration:
- AWS Lambda + API Gateway: $2,400/month for 500K daily requests
- Cloudflare Workers: $680/month for the same traffic
That's a 72% cost reduction. The biggest savings came from eliminating API Gateway charges ($3.50 per million requests) and Lambda's per-GB-second pricing. Workers' pricing is simpler: $0.50 per million requests after the free tier.
Global Latency Results
We tested response times from 10 global locations before and after migration:
- US East: 45ms (was 120ms)
- US West: 38ms (was 180ms)
- Europe: 42ms (was 250ms)
- Asia: 40ms (was 350ms)
- Australia: 44ms (was 400ms)
Workers run on 300+ edge locations, so every user gets local-like latency. Lambda only ran in us-east-1, so international users paid a significant latency penalty.
What We Had to Change
The migration wasn't entirely seamless. Workers use the V8 runtime, not Node.js, so we had to:
- Replace Node.js-specific APIs (fs, path, crypto) with Web APIs
- Switch from Express to Hono.js (which is designed for edge runtimes)
- Migrate from RDS to Cloudflare D1 for database queries
- Replace S3 with R2 for file storage
The total migration took 3 weeks for a team of two developers.
When to Choose Lambda vs Workers
Workers win for: API endpoints, edge logic, low-latency global APIs, and cost-sensitive workloads.
Lambda wins for: Long-running tasks (>30 seconds), heavy compute workloads, deep AWS ecosystem integration, and when you need specific Node.js packages that don't work in V8.
For most web application APIs, Workers is the better choice in 2026.