Amazon CloudFront
Developer Guide (API Version 2016-09-29)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Writing Functions for Lambda@Edge

There are several resources to help you with writing Lambda@Edge functions:

The programming model for using Node.js or Python with Lambda@Edge is the same as using Lambda in an AWS Region. For more information, see Building Lambda Functions with Node.js or Building Lambda Functions with Python.

In your Lambda@Edge code, include the callback parameter and return the applicable object for request or response events:

  • Request events – Include the cf.request object in the response.

    If you're generating a response, include the cf.response object in the response. For more information, see Generating HTTP Responses in Request Triggers.

  • Response events – Include the cf.response object in the response.