Amazon updates CloudFront to run lightweight code at the edge

Get a free Techzine subscription!

Amazon Web Services is improving its Amazon CloudFront content delivery network (CDN), to enable more lightweight customizations for users at the network edge. Amazon CloudFront is a fast content delivery network service used by customers to deliver data, apps, app programming interfaces, and videos.

CDNs do this securely with low latency and high transfer speeds, in addition to providing a developer-friendly environment.

The way it does this is by delivering content from the closest edge location in the global Amazon network of data centres. When a user requests content served by CloudFront, the request goes through the appropriate edge location with the lowest latency and in the shortest time.

Amazon CloudFront Functions

This is the new feature launched today that makes it easy for customers to deliver more personalized and valuable content for users in all locations, with low latency.

Users will be able to run JavaScript functions, designed to perform particular tasks, specific to one of the 218 CloudFront edge locations.

Some use cases Amazon provides include writing HTTP header manipulations, enabling requests to be directed to a specific language version of a website, based on the Accept-Language header of the incoming request, and URL redirects and rewrites.

Better options

The only way to deliver customization like this in Amazon CloudFront was through AWS Lambda@Edge. Danilo Poccia, the AWS Chief Evangelist, said that Lambda@Edge is better used for complex and compute-heavy tasks, rather than lightweight customizations addressed with CloudFront Functions.

With that in mind, Lambda@Edge functions are performed at a regional edge location where more compute power is available, rather than at the closest possible edge. This leads to slowed delivery and hampers customization uniqueness on each edge location.

The best part is that CloudFront Functions is cheaper, at a sixth of the price of Lambda@Edge Functions.