Serverless Tip #15: Run code closer to your customers with Lambda@Edge
Lambda@Edge is a feature in AWS CloudFront that lets you run code closer to your customers. It reduces latencies by replicating your function(s) across edge locations of the AWS global Content Delivery Network.
With Lambda@Edge, you can, for example:
- Add headers to all incoming requests without modifying the client.
- Perform real-time image transformations and cache the results.
- Rewrite the request and response to work with legacy applications.
- Perform dynamic routing to different origins depending on user location.
- Serve prerendered SEO-optimized pages to bot traffic.
- Perform bot mitigation at the edge.
- Run A/B tests by sending a percentage of your traffic to another origin.
- Authenticate and authorize at the edge.