Cloudflare Workers vs AWS Lambda@Edge: Where Each Wins
Moving header-injection logic from Lambda@Edge to Workers removes container cold starts. Here's when that swap pays off and when it doesn't.
Key takeaways
- Pick Cloudflare Workers for request shaping, redirects, A/B headers and edge auth, because V8 isolates avoid Lambda-style cold starts and Workers list prices are lower at high request volume.
- Keep Lambda@Edge when the function needs IAM roles, AWS services, or should run only on CloudFront cache misses.
On this page
Use Cloudflare Workers for request shaping, redirects, A/B headers and auth at the edge: V8 isolates avoid Lambda-style cold starts, and at high request volume Workers list prices come out lower. Keep Lambda@Edge when the function is really an extension of your AWS backend, needs an IAM role, or should only run on cache misses.
Verified against
Cloudflare Workers Standard pricing and platform limits, Lambda@Edge quotas and restrictions, against developers.cloudflare.com, the CloudFront Developer Guide and the AWS Lambda pricing page. Checked October 2026.
Our A/B header-injection logic lived in a Lambda@Edge function triggered on viewer-request. It did a few milliseconds of real work: read a cookie, pick a bucket, set a header. But tail latency for that hop was dominated by cold starts in the smaller regions, and users in São Paulo and Mumbai felt it worst. That function was the whole reason we started looking at Workers.
The comparison at a glance
| Cloudflare Workers (Paid) | AWS Lambda@Edge | |
|---|---|---|
| Runtime model | V8 isolates, web-standard APIs, nodejs_compat flag | Node.js or Python Lambda in a micro-VM |
| Request price (Oct 2026) | $5/month includes 10M, then $0.30 per million | $0.60 per million |
| Compute price (Oct 2026) | 30M CPU ms included, then $0.02 per million CPU ms | about $0.00005001 per GB-second (billed per 128 MB-second) |
| CPU / timeout limit | 30 s CPU default, up to 5 min; Free plan 10 ms | 30 s function timeout |
| Trigger points | Every request (gate with the Cache API) | Viewer request/response, origin request/response |
| AWS integration | Static credentials or an API in front | Native IAM execution role |
The runtime is the real difference
Lambda@Edge runs a real Node.js or Python Lambda, with the standard library and /tmp. The price is cold starts: a trivial function still pays init cost when a location hasn't run it recently, and Lambda@Edge executes in AWS's regional edge caches, not in every edge location. It also carries Lambda baggage with restrictions of its own: functions must be created in US East (N. Virginia), you deploy numbered versions (never $LATEST), and environment variables, layers, VPC access and arm64 are not supported.
Workers run on V8 isolates. There is no container or process to boot, so an isolate starts far faster than a micro-VM, and the script runs across Cloudflare's whole network. The tradeoff is that you're not in Node. You get web-standard APIs (fetch, Request, crypto.subtle, URL), and the nodejs_compat flag fills in much of the Node API but not native addons. If you're unsure what breaks, our list of what you can't do in an edge runtime is the checklist we use. Each isolate gets 128 MB of memory on both plans.
Here's the Worker that replaced our Lambda:
export default {
async fetch(request) {
const cookie = request.headers.get("cookie") || "";
const bucket = cookie.includes("exp_v2=1") ? "b" : "a";
const res = await fetch(request);
const out = new Response(res.body, res);
out.headers.set("x-exp-bucket", bucket);
return out;
},
};
Same logic, deployed with wrangler deploy. After a week the cold-start-shaped spikes had disappeared from our traces. If you're staying on Lambda and want to attack cold starts there instead, measuring and fixing Lambda cold starts covers the knobs.
What Lambda@Edge still does better
Lambda@Edge earns its keep when you're already deep in AWS. If your function needs to sign requests to a private S3 bucket with SigV4, read from DynamoDB in the same account, or assume an IAM role, Lambda@Edge does it natively with an execution role. Doing the same from a Worker means managing static credentials or fronting things with an API, which is more moving parts.
It also gives you four trigger points: viewer-request, origin-request, origin-response, viewer-response. Origin triggers only fire on cache misses, so expensive rewriting doesn't cost you per viewer request. Workers run on every request unless you gate them with the Cache API yourself.
Size limits differ in ways that bite. As of October 2026, CloudFront truncates the request body exposed to a viewer-request function at 40 KB (1 MB for origin requests), and a response generated by a viewer-event function is capped at 40 KB including headers. Workers on the Paid plan default to 30 seconds of CPU time per request, configurable up to 5 minutes, with no wall-clock limit on HTTP requests; the Free plan allows only 10 ms of CPU. What Cloudflare meters is CPU time, not wall time, and time spent waiting on fetch() doesn't count. That trips people up in both directions.
Pricing, worked from list prices
Lambda@Edge bills $0.60 per million requests plus duration at $0.00000625125 per 128 MB-second (about $0.00005001 per GB-second), as of October 2026. At 200M requests a month, the request charge alone is $120. Duration on top is small for a 128 MB function doing a few milliseconds of work, so request charges dominate.
Workers Paid is $5 a month including 10M requests, then $0.30 per additional million, plus $0.02 per million CPU ms beyond the 30M included. The same 200M requests cost $5 + $57 = $62 in request charges. At 3 ms of CPU each, that's 600M CPU ms, or $11.40 after the allowance, for about $73 a month. For high-volume, low-compute edge logic, Workers wins by a wide margin. For low-volume functions that do heavy work tied to AWS services, the gap narrows and can flip once you count the cost of moving credentials and data across clouds.
The migration gotchas
Two things tend to eat time in a migration. First, event.Records[0].cf.request.headers in Lambda@Edge is an object keyed by lowercased header name, each holding an array of {key, value} pairs, structurally nothing like the standard Headers object in Workers. Shared code assuming one shape breaks on the other. Second, CloudFront hides some headers from edge functions entirely (Connection, X-Amz-Cf-*, X-Forwarded-Proto and others) and makes others read-only, such as Host in viewer requests; adding one fails validation with a 502. Workers let you set almost anything, so a header your origin has never seen before can suddenly arrive and confuse it.
You also lose CloudWatch's automatic per-function metrics. Workers give you wrangler tail and Workers analytics, which are fine, but if your on-call runbooks assume CloudWatch dashboards, budget time to rebuild them.
Questions people ask
Is Cloudflare Workers cheaper than Lambda@Edge?
At high request volume, usually yes. As of October 2026, Lambda@Edge charges $0.60 per million requests, while Workers Paid charges $0.30 per million after 10M included for $5 a month, plus $0.02 per million CPU ms beyond 30M. At 200M requests of light logic, that's roughly $73 on Workers against $120 or more on Lambda@Edge. Heavy AWS-bound work narrows the gap.
Do Cloudflare Workers have cold starts?
Not in the Lambda sense. Workers run in V8 isolates rather than micro-VMs, so there is no container or runtime process to boot per location, and isolate startup is a small fraction of a Lambda init. Lambda@Edge functions pay a full init when a regional edge cache hasn't run them recently, which is exactly where tail-latency spikes come from for low-traffic regions.
What is the Lambda@Edge timeout?
As of October 2026, AWS lists a 30-second function timeout for Lambda@Edge, with memory following standard Lambda quotas. The tighter limits are on size: viewer-request functions see at most 40 KB of request body, and responses generated in viewer events are capped at 40 KB. Origin events allow 1 MB. Functions must live in us-east-1 and cannot use environment variables.
The call we'd make
If the work is request and response shaping, redirects, auth at the edge, or header logic that isn't chained to AWS-native services, Workers win on cold starts, coverage and cost. Move it. If your edge function is really an extension of your AWS backend, needs IAM, or only runs on cache misses where per-request cost matters, keep it on Lambda@Edge. We migrated the header and redirect logic to Workers and left one SigV4-signing origin function on Lambda. Splitting by dependency, not by ideology, was the right move.
Sources
Cite this article
Kiril Urbonas (2026). Cloudflare Workers vs AWS Lambda@Edge: Where Each Wins. DevOpsNess. Updated 2026-11-15. https://www.devopsness.com/blog/cloudflare-workers-vs-lambda-at-edge
[Cloudflare Workers vs AWS Lambda@Edge: Where Each Wins](https://www.devopsness.com/blog/cloudflare-workers-vs-lambda-at-edge) (Kiril Urbonas, DevOpsNess, updated 2026-11-15)
More from Cloud
Explore more articles in this category
Honeycomb vs Datadog: High-Cardinality Debugging and Pricing Compared
One tool is built to answer questions you didn't know you had. The other watches everything at once. Here is how they actually differ in practice.
AWS S3 Tutorial: Buckets, Permissions, and Common Pitfalls
Create your first S3 bucket, upload and download files, and set up the right access controls, without accidentally making everything public.
How to Reduce Datadog Costs Without Losing Coverage
Datadog bills climb quietly until finance forwards the invoice. Here's the playbook we run to cut spend hard while keeping every signal that matters.
You might have missed
Evergreen posts worth revisiting.