Which of the following are AWS CloudFront events that can trigger AWS Lambda@edge function? (choose 3 options)
Click on the arrows to vote for the correct answer
A. B. C. D. E.Answer: A, D, E.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-cloudfront-trigger-events.htmlAWS CloudFront is a content delivery network service provided by AWS, that enables faster delivery of static and dynamic content, such as HTML, CSS, images, and videos, from a web application to end-users around the globe. AWS Lambda@Edge is an extension of AWS Lambda, that allows developers to run serverless functions in response to CloudFront events, and execute custom logic for each end-user request.
There are several CloudFront events that can trigger a Lambda@Edge function, and based on the event type, different actions can be taken. Here are the explanations of the three CloudFront events that can trigger a Lambda@Edge function:
Viewer Request: This event occurs when a viewer (end-user) sends a request to CloudFront, and before the request is forwarded to the origin server. A Lambda@Edge function triggered by this event can inspect and modify the viewer request, and either allow or deny the request based on custom business logic. For example, you can use this event to block requests from certain IP addresses or to redirect requests to a different URL.
Origin Request: This event occurs when CloudFront sends a request to the origin server, on behalf of the viewer, to fetch the content. A Lambda@Edge function triggered by this event can modify the headers or parameters of the request before it is sent to the origin server. This can be used, for example, to add custom headers for authentication or to rewrite the URL to fetch a different version of the content.
Origin Response: This event occurs when CloudFront receives a response from the origin server, and before the response is forwarded to the viewer. A Lambda@Edge function triggered by this event can modify the response body or headers, and add or remove content. For example, you can use this event to compress the response body, to add security headers, or to customize the content for each viewer based on their location.
The following CloudFront events are not valid triggers for Lambda@Edge: