AWS Takes Lambda to the Edge
Amazon Web Services Inc. (AWS) has extended the reach of its AWS Lambda service that enables serverless computing, in which code functions are automatically executed in response to events or calls from other services.
Called Lambda@Edge, the new service replicates Lambda functions around the globe so events -- HTTP requests, for example -- can be processed with the lowest latency, rather than from one dedicated AWS region.
Specifically, Lambda@Edge functions can now be authored in the US East (N. Virginia), after which they're replicated globally for invocation in response to events from CloudFront, the company's global content delivery network (CDN).
"You just upload your code to AWS Lambda and configure it to be triggered by Amazon CloudFront events (i.e., viewer request, viewer response, origin request, and origin response)," AWS explained in a post this week. "When a related request is received by CloudFront, it is routed to the optimal AWS location close to the viewer for execution. Lambda@Edge then executes your code, and scales with the volume of requests across CloudFront's global network."
In his own blog post, AWS spokesperson Jeff Barr detailed more capabilities of the service, including:
- Inspect cookies and rewrite URLs to perform A/B testing.
- Send specific objects to your users based on the User-Agent header.
- Implement access control by looking for specific headers before passing requests to the origin.
- Add, drop, or modify headers to direct users to different cached objects.
- Generate new HTTP responses.
- Cleanly support legacy URLs.
- Modify or condense headers or URLs to improve cache utilization.
- Make HTTP requests to other Internet resources and use the results to customize responses.
"Lambda@Edge allows you to create Web-based user experiences that are rich and personal," Barr said. "As is rapidly becoming the norm in today's world, you don't need to provision or manage any servers. You simply upload your code (Lambda functions written in Node.js) and pick one of the CloudFront behaviors that you have created for the distribution, along with the desired CloudFront event."
Lambda@Edge pricing is based on how many times functions are invoked and the amount of time that they run. There is no free tier for the service. Developer documentation is available for more information
David Ramel is the editor of Visual Studio Magazine.