AWS Certified Solutions Architect – Professional — Question 882

A company has developed a single-page web application in JavaScript. The source code is stored in a single Amazon S3 bucket in the us-east-1 Region. The company serves the web application to a global user base through Amazon CloudFront.
The company wants to experiment with two versions of the website without informing application users. Each version of the website will reside in its own S3 bucket. The company wants to determine which version is most successful in marketing a new product.
The solution must send application users that are based in Europe to the new website design. The solution must send application users that are based in the
United States to the current website design. However, some exceptions exist. The company needs to be able to redirect specific users to the new website design, regardless of the users' location.
Which solution meets these requirements?

Answer options

Correct answer: D

Explanation

Using a single CloudFront distribution with Lambda@Edge allows you to inspect incoming request attributes, such as the viewer's country header (CloudFront-Viewer-Country) and custom headers or cookies for specific user overrides. Based on these attributes, Lambda@Edge can dynamically alter the origin request to point to either the current or new S3 bucket without changing the URL or requiring multiple distributions. Other options like Route 53 geolocation routing cannot handle individual user overrides based on request attributes like cookies or query strings, and redirecting via paths would expose the change to the user.