🔷

AWS – CloudFront Functions

  • Lightweight JavaScript functions executed at CloudFront edge locations.
  • Optimized for high scale and low latency workloads, with sub-millisecond startup times and support for millions of requests per second.

Typical Use Cases

  • Viewer Request: modify or inspect requests after they arrive at CloudFront but before hitting the origin.
  • Viewer Response: alter responses before they are sent back to the client.

Architecture Notes

  • Built directly into CloudFront (no separate AWS service needed).
  • Ideal for simple, short-duration logic.
  • Deployed globally with CloudFront distributions.

Lifecycle Events Supported

  • Viewer Request
  • Viewer Response
  • (For Origin Request and Origin Response, use Lambda@Edge instead)