Cloud Servers

CloudFront Functions Can Now Call Your APIs: cf.fetch() at the Edge — Who Should Move Off Lambda@Edge?

11 min read

CloudFront Functions Can Now Call Your APIs: cf.fetch() at the Edge — Who Should Move Off Lambda@Edge?

The Short Answer

Amazon CloudFront Functions can now make network calls during a request — the one capability that used to force teams onto Lambda@Edge or back to the origin. In its official announcement, checked today, AWS says two new methods do the work: cf.fetch() calls one of your API endpoints and lets the function act on the response, and cf.beacon() fires analytics events in the background without slowing viewers, even for content served from cache. Network calls run at all CloudFront edge locations and cost $0.10 per million calls, on top of normal CloudFront Functions invocation charges, with the fee waived in the Pro tier and above of CloudFront’s flat-rate plans.

For VPS and small-server readers, the honest framing matters: this does not replace your origin. It removes a specific, common reason to add Lambda@Edge — a lightweight edge check that needs live data, such as validating a token, checking a budget, or asking a fraud service for a verdict. If your edge logic is pure header rewriting, nothing changes. If you run Lambda@Edge mainly to call one API per request, this is now the cheaper, simpler home for that logic.

What AWS Announced

AWS announced network-call support for CloudFront Functions in its What’s New feed on November 18, 2026, as part of the pre:Invent wave ahead of the conference that opens November 30. CloudFront Functions is AWS’s lightweight JavaScript runtime at CloudFront edge locations: it customizes viewer requests and responses close to the viewer, without provisioning servers.

Until this launch, that runtime was deliberately isolated. A function could inspect and mutate the request in front of it, but it could not ask anyone else anything. The moment your logic depended on data held elsewhere — an entitlement check, a feature flag, a rate-limit counter, a fraud score — AWS’s guidance was to step up to Lambda@Edge or move the decision back to the origin. That split is now gone for the common case.

The two new methods are deliberately narrow. cf.fetch() is the synchronous path: the function calls an API endpoint you operate and uses the response to decide how to handle the current request — allow it, block it, challenge it, rewrite it. cf.beacon() is the fire-and-forget path: the function emits an event and moves on, which AWS positions for analytics on cached content, where the origin never sees the request. Both methods reuse the origin configuration already on your distribution, including origin access control (OAC), VPC origins, and connection reuse — so the call inherits your existing signing, private-origin, and keep-alive setup rather than opening a new egress path you have to secure separately.

AWS’s own examples tell you who this is for. First, checking an AI agent’s permissions and usage budget before a request reaches your API or MCP server — an edge gate in front of agent traffic, which is exactly the pattern our coverage of AWS’s API Portal and WAF AI security launch tracked from the firewall side. Second, sending request signals to a security or fraud-detection service to block or challenge bad traffic before it consumes origin capacity. Neither needs a general-purpose runtime. Both need one fast, authoritative answer at the edge.

How cf.fetch() and cf.beacon() Work

Think of the request lifecycle in three beats. A viewer request arrives at an edge location. Your CloudFront Function runs — today it can already normalize headers, redirect, or reject on static rules. Now, mid-function, it can pause, call your endpoint, read the verdict, and finish handling the request with that verdict applied. The viewer experiences one request; the origin, if the verdict is “block,” experiences none.

The destination is not the open internet. Hands-on reports from the first week describe the target as an origin already configured on the same distribution, addressed by origin ID and path — which matches AWS’s statement that calls reuse your distribution’s origin settings, OAC included. Your auth or fraud API sits behind CloudFront as an origin (an S3 bucket with OAC, a Lambda function URL, an ALB, a VPC origin), and the function calls it through the same machinery that serves your content. That is a meaningful security property: there is no arbitrary-URL fetch primitive to abuse, and the call can be signed and kept private the same way origin fetches already are.

cf.beacon() covers the opposite need. Cached content is, by design, invisible to your origin — which also makes it invisible to origin-side analytics. A beacon lets the edge report “this cached object was served” without waiting for an acknowledgment and without adding latency. If you have ever bolted a tracking pixel onto pages purely because CDN hits never reach your logs, this is the cleaner version of that workaround.

Two cautions belong here, because AWS’s announcement is short and the details live in the Developer Guide’s helper-methods section. First, treat the widely reported limits — one network call per function execution, a roughly one-second wait, small request and response bodies — as constraints to verify in the guide before you design around them. They point in a clear direction regardless: this is a verdict-lookup primitive, not a general HTTP client. Second, budget for testing against a real distribution with real origins; early hands-on write-ups note the console test tooling cannot exercise real network calls the way production traffic does.

What It Costs

AWS prices network calls at $0.10 per million, charged on top of CloudFront Functions invocation fees, and included at no additional cost in the Pro plan and above under CloudFront’s flat-rate plans. The arithmetic is simple enough to do honestly. If every viewer request makes exactly one call, 10 million requests a month adds $1 in network-call charges; 100 million requests adds $10. The invocation charge underneath still applies, and the origin you call still bills for its own compute — a Lambda function URL or an ALB-backed API is not free just because the edge asked politely.

The comparison that matters is not against zero. It is against the two alternatives this feature displaces. Lambda@Edge gives you a full runtime, more memory, longer execution, and access to AWS services — and bills accordingly, with replication and versioning overhead small teams consistently underestimate. Origin-side checks cost nothing extra at the edge but spend origin capacity and latency on traffic you may be about to reject. For a single small verdict call per request, $0.10 per million is cheap enough that the decision becomes architectural, not financial.

One honest limit: AWS’s announcement does not restate the underlying invocation price or the flat-rate plan prices, so this article does not either. Check the CloudFront pricing page for those figures before you model a migration — edge pricing has more than one line item, and the network-call fee is the smallest of them.

Option What runs where Best for Watch out for
CloudFront Functions + cf.fetch() Lightweight JS at the edge, one API verdict per request Auth, budget, fraud and routing checks on every request Narrow by design; verify call limits in the Developer Guide
CloudFront Functions + cf.beacon() Fire-and-forget event from the edge Analytics for cached content the origin never sees No response handling; delivery is best-effort by nature
Lambda@Edge Full Lambda runtime replicated to edge locations Heavy logic, AWS service calls, larger payloads Higher cost and operational overhead for a simple lookup
Origin-side check (your VPS/API) Decision made on your own server Complex logic you fully control Bad traffic reaches your origin; cached hits bypass the check

Who Should Move — and Who Should Not

Move if you run Lambda@Edge today mainly to call one internal API per request — token validation, entitlement or budget checks, feature-flag reads, fraud scoring — and the rest of the function is header and routing logic CloudFront Functions already handles. Move if you front an API or MCP server with CloudFront and want agent traffic gated before it reaches the origin. Move if your analytics blind spot is cached content: beacons close that gap without a pixel hack.

Wait or skip if your edge logic needs multiple dependent calls, large bodies, streaming, or direct AWS SDK access — that is still Lambda@Edge territory. Skip it if your current setup is a single VPS behind CloudFront with no edge functions at all: a check on the origin you already operate is simpler to debug. And skip it, for now, if the API you would call is not yet an origin on your distribution — that plumbing deserves its own staging pass.

There is also a middle path worth naming. Many small sites run a reverse proxy on a VPS — the same pattern behind our ELB for Envoy coverage, where the question was which proxy operations to outsource. CloudFront Functions with network calls is the edge equivalent: keep the decision logic you own, outsource the per-request plumbing.

What This Means for Server Buyers

This launch lands in a pre:Invent week dense with agent-infrastructure announcements — the same wave our re:Invent 2026 preview flagged for server buyers watching the November 30 keynotes. Read in that context, cf.fetch() is about where the agent-era gate sits. AWS is moving the “is this caller allowed, and can they afford this request” check as close to the caller as possible: WAF rules for AI endpoints, API discovery for shadow MCP servers, and now an edge function that can ask your own service for a verdict. For anyone selling API access — to humans or to agents — that edge gate is becoming the default architecture.

For the VPS-first reader, the takeaway is narrower. You do not need CloudFront Functions to run a fast site, and nothing here changes how you size or buy a server. What changes is the menu when a single VPS stops being the whole architecture: the first thing most growing sites add is a CDN, and the first thing they miss is the origin-side check the CDN bypasses. Network calls at the edge close that gap, at a price that will not decide the question. The limits will. Design for one small, fast verdict per request and this is a clean upgrade; design for a general-purpose edge HTTP client and you will be back on Lambda@Edge within the quarter.

FAQ

What are CloudFront Functions network calls?
A capability announced November 18, 2026 that lets CloudFront Functions — AWS’s lightweight JavaScript runtime at CloudFront edge locations — call your API endpoints during a request. cf.fetch() waits for the response and acts on it; cf.beacon() sends an event in the background without waiting.

How much do network calls cost?
$0.10 per million calls, on top of CloudFront Functions invocation charges, checked on AWS’s announcement on November 29, 2026. The fee is included at no additional cost in the Pro plan and above of CloudFront’s flat-rate plans. At one call per request, 100 million requests a month adds $10 in network-call charges.

What can cf.fetch() call?
Your API endpoints, through the origin configuration already on your distribution — including origin access control, VPC origins, and connection reuse. AWS’s examples are checking an AI agent’s permissions and usage budget before a request reaches an API or MCP server, and sending request signals to a security or fraud service.

Does this replace Lambda@Edge?
Only for the narrow case of one small verdict lookup per request. Lambda@Edge remains the choice for heavier logic, multiple calls, larger payloads, and direct AWS service access. If your Lambda@Edge function exists mainly to call one API, CloudFront Functions is now the simpler home for it.

Can I use this without AWS origins?
The calls reuse your distribution’s origin settings, so the endpoint you call needs to be reachable as an origin on that distribution. Your content origin can still be your own VPS or any HTTP origin you front with CloudFront; the verdict API itself must be wired in as an origin.

Where is it available?
At all CloudFront edge locations, per AWS’s announcement. There is no per-region rollout to wait for.

The Bottom Line

CloudFront Functions network calls remove the last structural reason to reach for Lambda@Edge for a simple per-request check. cf.fetch() puts one authoritative verdict — auth, budget, fraud, routing — at the edge for $0.10 per million calls, reusing the origin security you already configured; cf.beacon() finally lets cached content report itself. The feature is deliberately narrow, and its reported limits should be verified in the Developer Guide before you design around them, but narrow is the point: most edge checks were always one small question. For teams gating APIs and agent traffic, this is now the default place to ask it.

Sources: AWS What’s New, “Amazon CloudFront Functions now supports network calls” (aws.amazon.com, November 18, 2026) — pricing, availability, cf.fetch()/cf.beacon() behavior and origin-settings reuse checked November 29, 2026; Amazon CloudFront Developer Guide, “Helper methods for network calls” (docs.aws.amazon.com) for implementation details. Prices are USD, exclude invocation charges, origin compute and taxes, and can change — verify on the CloudFront pricing page before migrating.

One response to “CloudFront Functions Can Now Call Your APIs: cf.fetch() at the Edge — Who Should Move Off Lambda@Edge?”

Leave a Reply

Your email address will not be published. Required fields are marked *