Customize at the edge with Lambda@Edge - Amazon CloudFront
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Customize at the edge with Lambda@Edge

Lambda@Edge is an extension of Amazon Lambda. Lambda@Edge is a compute service that lets you execute functions that customize the content that Amazon CloudFront delivers. You can author Node.js or Python functions in the Lambda console in one Amazon Web Services Region, US East (N. Virginia).

You then add triggers in either the Lambda or CloudFront console that cause the functions to run in Amazon locations that are closer to the viewer, without provisioning or managing servers. Optionally, you can use Lambda and CloudFront API operations to set up your functions and triggers programmatically.

Lambda@Edge scales automatically, from a few requests per day to thousands per second. Processing requests at Amazon locations closer to the viewer instead of on origin servers significantly reduces latency and improves the user experience.