[AWS] Lambda@Edge

Lambda@Edge is a feature of Amazon CloudFront that lets you run code closer to users of your application, which improves performance and reduces latency.



  • Lambda@Edge runs code across AWS locations globally without provisioning or managing servers, responding to end-users at the lowest network latency.


There are 4 stages that you can attach Lambda functions.

  • Viewer Request: When an end- user makes an HTTP(S) request to CloudFront, and the request arrives at the edge location closest to that user.
  • Viewer Response: When the CloudFront server at the edge is ready to respond to the end-user
  • Origin Request: When the CloudFront edge server does not already have the requested object in its cache, and the viewer request is ready to be sent to your backend origin webserver
    • You can control the origin source based on the user’s location.
  • Origin Response: When the CloudFront server at the edge receives a response from your backend origin server.

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s