A global media site serves personalized images from S3 via CloudFront to 40 countries. It must rewrite viewer URLs, add country headers, and validate lightweight tokens at the edge for millions of requests with submillisecond startup and minimal cost. Which edge compute control meets the latency requirement for this token check?
Select an answer to reveal the explanation.
Short Explanation
You've got a paper-thin job that must run everywhere instantly, so reach for the lightest runner. CloudFront Functions spins up in submillisecond time for simple rewrites at viewer scale without the heavier Lambda bill.
Full Explanation
CloudFront Functions runs lightweight JavaScript at CloudFront edge locations with submillisecond startup, massive scale, and low per-invocation cost, making it ideal for viewer-request URL rewrites, header normalization, and simple token checks that do not need network or filesystem access. Lambda@Edge on viewer request also runs at the edge but uses a full Node.js or Python runtime with higher latency, higher cost, and longer replication time, so it misses the submillisecond and minimal-cost requirements for this simple logic. Lambda@Edge on origin request executes only after the cache miss path toward the origin, so it cannot provide consistent viewer-side personalization and adds origin latency. An Application Load Balancer Lambda target centralizes compute in one Region, forcing every global viewer through cross-region routing and losing edge latency benefits entirely. Exam caveat: choose CloudFront Functions for simple, short-lived viewer events and Lambda@Edge for heavier compute, origin manipulation, or SDK calls. Practical check: confirm the code needs no network access or extended execution before selecting CloudFront Functions.