Writing content of a Lambda@Edge function - Amazon CloudFront

Writing content of a Lambda@Edge function

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.