Correct Answer – B, C and D
Refer to
https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html
https://medium.com/buildit/a-b-testing-on-aws-cloudfront-with-lambda-edge-a22dd82e9d12
for how Lambda works with CloudFront Lambda@Edge:
Option A is incorrect: Because CloudFront cache cannot be configured with a Lambda.
Option B, C and D are CORRECT: In this case, Lambda should be configured in Viewer request or Origin request or Origin Response to choose which version of application to route to.
Viewer Request : The function executes when CloudFront receives a request from a viewer, before it checks to see whether the requested object is in the edge cache.
Origin Request: The function executes only when CloudFront forwards a request to your origin. When the requested object is in the edge cache, the function doesn`t execute.
Origin Response : The function executes after CloudFront receives a response from the origin and before it caches the object in the response. Note that the function executes even if an error is returned from the origin.
The function doesn`t execute in the following cases:
• When the requested file is in the edge cache
• When the response is generated from a function that was triggered by an origin request event
Refer page 298 on the below link
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AmazonCloudFront_DevGuide.pdf
Option E is incorrect: Viewer response is the response which CloudFront forwards to the viewer. They are not the points to decide which version to send the request to.