Friday 15 September 2017

Lambda@Edge is generally available now with more new features

Amazon Web Service last year had spoken about Lambda@Edge and explained that how it can be used to intelligently process the HTTP request at locations which close in latency wise to the customers. Developers have offered many helpful feedbacks who have gained access to the preview by making good use of it. With the preview, AWS had added the capability to create HTTP support and responses for CloudWatch logs and also updated the roadmap which is established on the feedback.

The features that are included in the Lambda@Edge are as follows:-

1.    Modify, drop or add headers to direct users to various cached objects.

2.    Check the cookies and Rewrite the URLs to carry out the A/B testing.

3.    Send the particular objects to the users established on the User-agent header.

4.    Utilize the Access control by selecting a specific header before passing the request to the origin.

5.    You can create new HTTP responses.

6.    It efficiently supports legacy URLs.

7.    You can condense or modify the headers or URLs to enhance cache utilization.

8.    You can make an HTTP request to the other internet resources and can utilize the result to make changes in the responses.

Amazon Web Service Lambda@Edge will enable you to generate web-based user experience that is personal and rich. As is quickly evolving into the norm in the today’s world where it is not necessary to manage or provide any servers. You just have to load the code and select on the CloudFront Behaviours that have generated for the distribution along with the preferred CloudFront event.

The following are the four different CloudFront Events:-

1.    The Viewer Request Event is triggered when the event appears from the viewer and has access to the HTTP request that is incoming. The CloudFront Edge Location manages a large cache of objects which will effectively respond to the redundant request. The event is triggered disregarding if the requested object is cached or not.

2.    The Origin Request Event is triggered when the Edge location is going to make a request to the origin where the requested object is not cached at the edge location. The access has the request which is made to the original request.

3.    The Viewer Response Event is triggered earlier than when the edge location makes a response to the viewer by having the access to the response.

4.    The Origin Response Event is triggered when the origins return the response to a request by having the access to the response from the origin.

The functions are globally duplicated and the request is automatically programmed to the optimal location for the execution. The code can be written once and with no apparent action on your part which has to be available at low latency to the users all over the world. The code will have full access to response and the request which includes cookies, headers, the HTTP method and the URL with the subject of few restrictions which can be modified to the existing headers and can insert a new one.

Lambda@Edge in Action

1.    First, generate a simple function that works in response to the Viewer Request Event. Open the AWS Lambda Console and built a new function. Select the Node.js 6.10 runtime and search for the CloudFront blueprints.

2.    After that select the CloudFront response generation and set up a trigger to notify the function.

3.    The AWS Lambda Console will generate some information about the operating environment of the selected function.

4.    Enter name and description for the function. The blueprint will consist of a fully operational function where it generates 200 HTTP responses with a simple body.

5.    This will be the starting point for the code which can gain some interesting values from displays and request in the table.

6.    Configure the Handler and request to generate new IAM Role with Basic Edge Lambda permissions.

7.    After that confirm the settings and click on the Create function. Your function will be created which will be attaching the trigger to the distribution and also launched the global duplication of the function. The duration of the replication will be 5 to 8 minutes. When the replication will be completed the status will change to deployed. You can then access the root of the distribution when the function runs.

During the Disaster recovery operation or maintenance, you can take an entire website offline and replace the critical pages with Lambda@Edge Functions. You can also create Weather reports, public safety pages or scoreboards and can make them available at the edge very quickly and also cost effective.

The Function that manages the Origin Response and Origin Request events must complete within 3 seconds or you may face time out same with Viewer response and Viewer request which has to be completed within 1 second. 

No comments:

Post a Comment

Empower Your Generative AI Innovation with Amazon Bedrock

  In the dynamic world of cloud computing, AWS has consistently set benchmarks with its innovative services and solutions. One of the inter...