Skip to main content

Lambda Edge

Overview

Lambda@Edge is a feature of Amazon CloudFront that lets you run code closer to users of your application, which improves performance and reduces latency. With Lambda@Edge, you don't have to provision or manage infrastructure in multiple locations around the world. You pay only for the compute time you consume - there is no charge when your code is not running.

With Lambda@Edge, you can enrich your web applications by making them globally distributed and improving their performance — all with zero server administration. Lambda@Edge runs your code in response to events generated by the Amazon CloudFront content delivery network (CDN). Just upload your code to AWS Lambda, which takes care of everything required to run and scale your code with high availability at an AWS location closest to your end user.

Benefits

Lambda@Edge runs your code globally at AWS locations close to your users, so you can deliver full-featured, customized content with high performance, and low latency.
You can automatically scale and run your code at AWS locations around the world without requiring you to provision, scale, or manage origin servers at multiple locations, or set up any load balancing or domain name system (DNS) routing services. You can add new functionalities without making any changes to your existing applications running at your origin. Lastly by using Lambda@Edge and Amazon CloudFront, you have less origin infrastructure to manage than with traditional CDNs.
With Lambda@Edge, you can customize the content delivered through the Amazon CloudFront CDN, and you can customize your compute resources and execution time, based on your application performance needs.

Page topics

Use Cases

Use Cases

Open all

You can trigger a Lambda function to add HTTP security headers on all origin responses without having to modify your application code on your origin. This helps improve security and privacy for your users and content providers, while using CloudFront to deliver the content at low latencies.

Read the blog. >>

By combining Lambda@Edge with other AWS services, developers can build powerful web applications at the edge that automatically scale up and down—with zero origin infrastructure and administrative effort required for automatic scaling, backups, or data center redundancy.

You can use Lambda@Edge to improve search engine optimization (SEO) for your website. For example, you can trigger a Lambda function to deliver a pre-rendered HTML page stored in Amazon S3 when the user-agent is a search engine bot such as Googlebot or Bingbot.

Read the blog. >>

By using Lambda@Edge to dynamically route requests to different origins based on different viewer characteristics, you can balance the load on your origins, while improving the performance for your users. For example, you can route requests to origins within a home region, based on a viewer's location.

Read the blog. >>

Lambda@Edge can help you block unwanted bots at the edge, and let the authorized traffic go through. By intelligently mitigating these automated processes, you can help protect your origin infrastructure from unhelpful web crawlers and bots, while improving performance for real users.

You can customize your users' experience by transforming images on the fly based on the user characteristics. For example, you can resize images based on the viewer's device type—mobile, desktop, or tablet. You can also cache the transformed images at CloudFront Edge locations to further improve performance when delivering images.

Read the blog. >>

You can test and serve different versions of your website to the users without re-directs or changing the browser URL. This allows you to seamlessly release updates to your website to improve your website's overall experience while continuing to deliver responsiveness for users.

You can use Lambda@Edge to help authenticate and authorize users for the premium pay-wall content on your website, filtering out unauthorized requests before they reach your origin infrastructure. For example, you can trigger a Lambda function to authorize each viewer request by calling authentication and user management service such as Amazon Cognito.

Read the blog. >>

Lambda@Edge can help you to control and prioritize access to your website by routing users to different pages and experiences. For example, you can trigger a Lambda function that runs code to prioritize premium and paid users on your e-commerce website as the traffic surges during shopping sales. You can also redirect other shoppers to a temporary “waiting room”— an alternate site with branding and marketing deals where they can wait for a turn to access your main retail site.

Read the blog. >>

By using Lambda@Edge and Kinesis together, you can process real-time streaming data so that you can track and analyze globally-distributed user activity on your website and mobile applications, including click stream analysis.

Read the blog. >>