Cloudflare Workers is the better default for HTTP APIs, webhooks and edge logic, and AWS Lambda is the better choice for memory-hungry, long-running or AWS-bound work. Workers runs on V8 isolates, and Cloudflare says it has no cold starts, runs in 330+ cities, and bills only for CPU time. In the pricing model below, Lambda is cheaper at low volume and Workers is cheaper once you reach tens of millions of requests a month. For I/O-heavy functions that wait on slow downstream calls, the gap opens much earlier.
Don't miss new tech stories on Google
Add Tech Insider once in the Google app and our stories appear in your news suggestions.
Specs and Runtime Differences
Workers compiles your code into a V8 isolate that shares a process with other tenants. Lambda starts a Firecracker microVM per concurrent execution, isolated at the kernel level. That one architectural choice drives most of the rows below. Limits come from the Workers limits documentation, the Workers pricing page and the Lambda pricing page. Check them before committing, since limits change.
| Specification | Cloudflare Workers | AWS Lambda |
|---|---|---|
| Runtime architecture | V8 isolates (shared process) | Firecracker microVMs |
| Cold starts | None, per Cloudflare | Yes; Provisioned Concurrency available |
| Memory ceiling | 128 MB | 10,240 MB |
| Max execution time | 30 s (HTTP) / 15 min (Cron) | 15 min |
| Free tier (requests) | 100,000 / day | 1,000,000 / month |
| Free tier (compute) | 10 ms CPU/request | 400,000 GB-seconds / month |
| Paid plan entry | $5/month (10M requests included) | $0 (pay-as-you-go) |
| Per million requests | $0.30 (after 10M) | $0.20 |
| Per GB-second | $12.50 / million CPU-ms ($0.0000125) | $0.0000166667 |
| Bundle size (paid) | 10 MB compressed | 250 MB unzipped |
| Concurrent executions | Effectively unlimited | 1,000 default burst |
| Global locations | 330+ cities | 36 regions, ~13 Lambda@Edge POPs |
| Languages | JS, TS, WASM, Rust, Python (Pyodide) | Node, Python, Java, Go, .NET, Ruby |
| HTTP triggers | Built-in fetch handler | Function URLs or API Gateway |
| Storage primitives | KV, R2, D1, Durable Objects, Queues | S3, DynamoDB, RDS, EFS (separate billing) |
| WebSockets | Native via Durable Objects | API Gateway WebSocket APIs |
| Deployment CLI | wrangler | SAM, CDK, Serverless Framework |
Two rows matter most. Workers bills active CPU time, not wall-clock duration, so a function that awaits a slow API for 800 ms but uses 4 ms of CPU is billed for 4 ms, as the limits documentation framing of CPU time implies. Lambda bills the full 800 ms in GB-seconds. And the Workers memory cap rules out in-memory work on large files, heavy PDF generation or anything beyond small models, which Lambda’s much larger ceiling handles.
JavaScript and TypeScript
For JS and TS the two platforms are close on runtime features and far apart on deployment effort. Workers gives you the wrangler CLI, local dev with Miniflare and Smart Placement. Lambda gives you SAM, CDK or the Serverless Framework, which are stronger for multi-resource stacks and heavier to learn. Hono is the lightweight framework commonly used on Workers where the Node API surface is unavailable.
Python, Java and .NET
If your stack is Python, Java or .NET, choose Lambda. Workers supports Python through Pyodide, but it is a constrained sandbox and many PyPI packages with native extensions will not run. Lambda runs these languages as managed runtimes, and Java gets SnapStart to shorten cold starts.
Cold Starts and Isolation
Cold start latency is the most quoted difference. Cloudflare describes Workers as having no cold starts, because isolates start inside a process that is already running. Lambda has to boot a microVM, mount the bundle and initialise the language runtime before your code runs. It mitigates this with SnapStart for Java and with Provisioned Concurrency, which keeps environments hot but means paying for idle capacity, the thing serverless was meant to avoid.
| Behaviour | Cloudflare Workers | AWS Lambda | Lambda + SnapStart (Java) |
|---|---|---|---|
| Cold start | None, per Cloudflare | Yes, on first use of a new environment | Yes, but shortened |
| Isolation model | Shared-process V8 isolate | Kernel-isolated microVM | Kernel-isolated microVM |
| How to avoid it | Nothing to configure | Provisioned Concurrency (paid idle capacity) | Enable SnapStart |
The trade is isolation. Lambda’s kernel-level microVM isolation is the more conservative model for very sensitive data. Decide by who is waiting on the response: an interactive endpoint is where cold starts hurt, and an internal batch trigger is where they do not.
Pricing Breakdown at 1M to 1B Requests
The platforms bill different things. Lambda bills requests plus GB-seconds of wall-clock duration, listed at $0.20 per million requests and $0.0000166667 per GB-second on its pricing page. Workers bills requests plus CPU milliseconds; its pricing page covers the $5 paid plan with 10 million requests included and $0.30 per million after that. The table models six volumes from those published rates, with Lambda at 128 MB and 100 ms average.
| Monthly volume | AWS Lambda (128 MB, 100 ms avg) | Cloudflare Workers Paid | Savings |
|---|---|---|---|
| 1M requests | $0.00 (free tier) | $5.00 | Lambda wins |
| 10M requests | $1.83 | $5.00 | Lambda saves $3.17 |
| 50M requests | $18.34 | $17.00 | Workers saves $1.34 |
| 100M requests | $36.67 | $32.00 | Workers saves $4.67 |
| 500M requests | $183.33 | $152.00 | Workers saves $31.33 |
| 1B requests | $366.67 | $302.00 | Workers saves $64.67 |
From the table above, the crossover sits between 10M and 50M requests a month, and at 100 ms per request the dollar gap stays small: $64.67 of $366.67 at 1 billion requests, about 17%. The case for Workers on price is therefore not the headline rate. It is functions that wait. Lambda’s bill scales with wall-clock time, so a function awaiting a slow downstream API for 800 ms is billed for 8 times the 100 ms case in compute, while the Workers bill tracks CPU time only. The reverse also holds: heavy compute on Workers (image resizing, crypto, parsing large JSON) burns CPU milliseconds and pushes its bill up. A practical rule: below the crossover, or for CPU-heavy functions, Lambda’s model is cheaper; above it, or for functions that mostly wait, Workers is.
One more Lambda cost is easy to miss: API Gateway. Exposing functions as HTTPS endpoints adds a per-request gateway charge on top of the Lambda price, which can multiply the per-request cost. Function URLs avoid it but give up routing, throttling and authentication features. Workers includes HTTP, routing and TLS termination in the base price. Price your real architecture, gateway included, before comparing.
Storage Primitives: KV, R2, D1, DynamoDB, S3
Cloudflare bundles a storage stack with Workers that you would pay for separately on AWS. The most consequential piece is R2, an S3-compatible object store with zero egress fees. For any workload that serving media globally, egress is the line item that grows fastest, so this single design choice can outweigh the per-request price differences above. Check current egress rates for both on the vendors’ pricing pages.
| Use case | Cloudflare option | AWS option | Cost note |
|---|---|---|---|
| Object storage | R2 | S3 | R2 has zero egress; S3 charges for egress |
| Key-value | KV | DynamoDB | KV is eventually consistent; DDB has a strongly consistent option |
| SQL database | D1 (SQLite) | RDS, Aurora Serverless v2 | D1 suits small to mid workloads; RDS for heavy OLTP |
| Stateful coordination | Durable Objects | DynamoDB + SQS + Step Functions | DO simpler for coordination patterns |
| Message queue | Queues | SQS | SQS is the more established option |
| Vector search | Vectorize | OpenSearch, Bedrock Knowledge Bases | Compare for your RAG volume |
R2 is the strongest piece for serving static media. KV suits read-heavy config and feature flags but should not be your primary database. D1 fits small applications and cannot yet match RDS for heavy OLTP. Durable Objects are a single-threaded actor model with strong consistency that replaces coordination patterns you would otherwise build from several AWS services. DynamoDB remains the safer choice for large-scale key-value workloads.
Network Footprint and Data Locality
Cloudflare’s network footprint spans hundreds of cities in 100+ countries, and Workers run across it. Lambda runs in AWS commercial regions, with Lambda@Edge in a smaller subset of CloudFront locations. For users far from an AWS region, Workers is usually closer.
Proximity only helps if the function does not then call a database far away. A Worker near the user that queries a database in a single distant region spends the saved time on the round trip. Smart Placement addresses this by placing the Worker near the data source when that gives a faster overall response. The rule: Workers wins at the edge when your data is at the edge, and Lambda wins when your data is already in AWS, because a Lambda next to its database in one region will beat a distant Worker calling the same database.
HTTP APIs and Background Jobs
For HTTP APIs, Workers has the simpler path: a native fetch handler, no API Gateway charge, built-in routing and TLS. A Hono API deploys with wrangler. The Lambda equivalent needs a SAM template, an API Gateway resource, IAM execution roles and a log group.
// Cloudflare Workers HTTP API with Hono
import { Hono } from 'hono'
const app = new Hono()
app.get('/users/:id', async (c) => {
const id = c.req.param('id')
const user = await c.env.DB.prepare(
'SELECT * FROM users WHERE id = ?'
).bind(id).first()
return c.json(user)
})
export default app
# AWS Lambda equivalent (Python) with API Gateway
import json
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('users')
def lambda_handler(event, context):
user_id = event['pathParameters']['id']
response = table.get_item(Key={'id': user_id})
return {
'statusCode': 200,
'body': json.dumps(response.get('Item', {}))
}
The Workers version deploys with wrangler deploy. The Lambda version needs an API Gateway stage, a SAM or CDK deployment and IAM permissions for DynamoDB. For prototypes and small APIs the ergonomic gap decides it. For enterprise APIs with complex auth, throttling and observability needs, API Gateway’s feature set has no direct Workers equivalent.
Background processing reverses the picture. Workers’ HTTP time ceiling and memory cap do not fit long ETL, image processing or batch jobs, and Cron Triggers allow longer runs but still in a constrained environment. Lambda’s longer runtime and far larger memory handle those jobs. The pattern that follows is a split: a Worker accepts a webhook, validates it, writes to a Queue and returns 202 Accepted, then a Lambda function pulls from the queue and does the heavy work. SQS with Lambda is a particular strength, since Lambda scales consumers with queue depth, retries failures and dead-letters poison messages. It is a layered design, not an either/or choice.
Which to Pick for Five Scenarios
1. New API for a B2C product with global traffic. Pick Workers. No cold starts, no API Gateway charge, edge deployment and Hono make the fastest path to production. Start with D1 or KV and move to a heavier database if you outgrow them.
2. Internal tooling for an enterprise already on AWS. Pick Lambda. IAM, VPC connectivity and CloudWatch are too valuable to leave, and internal users will not notice a cold start. Use Function URLs if you want to skip the API Gateway bill.
3. Video encoding, image transformation or other compute-heavy batch jobs. Pick Lambda. The memory ceiling alone rules out Workers, and the longer runtime gives headroom. Pair it with S3 and Step Functions.
4. Webhook handlers, OAuth callbacks and payment dispatch. Pick Workers. These are latency-sensitive, geographically spread and light on memory, and CPU-time billing suits functions that wait on third-party APIs.
5. Real-time multiplayer state, collaborative editing, live cursors. Pick Workers with Durable Objects. Lambda can do it with API Gateway WebSocket APIs plus DynamoDB, but that stitches together services that Durable Objects provide natively.
Trade-offs at a glance
Workers gives you no cold starts, CPU-time billing, zero R2 egress, bundled storage, native HTTP and TLS, and Smart Placement. It costs you a low memory ceiling, a short HTTP time limit, a narrower language list, a smaller library ecosystem because many npm packages assume Node APIs, a still-maturing D1, thinner observability tooling and no first-class VPC connectivity. Lambda gives you large memory, long runs, deep AWS integration, six managed languages plus container images, SnapStart, and a mature operations ecosystem. It costs you cold starts on interactive paths, wall-clock billing for I/O-bound work, an API Gateway charge for HTTP-exposed functions, a smaller edge story, and paid idle capacity if you use Provisioned Concurrency. If you already run containers, the same layering logic applies in our Docker vs Kubernetes comparison, and for front-end hosting platforms see Vercel vs Netlify.
Migrating from Lambda to Workers
Migration is tractable for most JavaScript and TypeScript workloads. The main friction is the runtime API surface: Workers implements the fetch and Web Crypto APIs but not Node.js core modules, so code calling require('fs') or require('crypto') directly needs adapting. The usual path:
- Inventory your Lambda functions. Categorize by runtime, average duration, memory and external dependencies. Short, light functions with no Node-specific dependencies are candidates.
- Replace API Gateway with Workers routing. Use Hono or itty-router to express your routes. Workers’ fetch handler is the entry point.
- Rewrite IO dependencies. Replace
aws-sdkcalls with fetch calls to the appropriate APIs. For S3, consider R2 to remove egress costs. For DynamoDB, check whether KV or Durable Objects fit the access pattern. - Add wrangler.toml configuration. Define bindings for KV, R2, D1, Queues and environment variables. Set the compatibility date to a recent value.
- Run local dev with Miniflare. Validate end to end before deploying. Miniflare mirrors production closely but not perfectly, so test in staging.
- Deploy to a staging environment. Use version management to canary releases and route a percentage of production traffic to the new Worker.
- Cut over. Once metrics look stable, route all traffic to Workers and decommission the Lambda function. Keep it for two weeks as a rollback option.
Functions that do not migrate cleanly: anything calling Node.js native modules, anything beyond Workers’ memory or execution limits, anything needing private VPC access, and anything tied to AWS-native triggers such as SQS or DynamoDB streams. Leave those on Lambda.
Observability and compliance gaps
Observability is one of Workers’ weaker areas. Cloudflare offers Workers Analytics, Tail for real-time logs and Logpush to external sinks, but the ecosystem is shallower than Lambda’s CloudWatch, X-Ray, OpenTelemetry and third-party tooling. Logs can be shipped to OpenTelemetry-compatible backends, which is enough for many teams. For mission-critical workloads where deep tracing is required, weigh the gap.
On compliance, AWS has the broader portfolio, so regulated workloads in healthcare, finance and government often default to Lambda. If you are in a regulated industry, confirm the specific certification you need from each vendor’s compliance documentation before committing. The isolation difference noted earlier also feeds into that review: microVMs and shared-process isolates are different threat models.




