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

Writing Functions for Lambda@Edge

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

The programming model for using Node.js with Lambda@Edge is the same as using Lambda in an AWS Region. For more information, see Programming Model(Node.js).

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.