AWS Certified Developer – Associate — Question 228

An application uses an Amazon CloudFront distribution to deliver static content from Amazon S3 buckets that are set up in multiple AWS Regions around the world. A developer receives reports of problems with latency when cached content is updated.

The developer plans to address this problem by redirecting requests on cache misses to the S3 bucket in the Region that is nearest to the user's country. The developer configures the distribution to cache based on the CloudFront-Viewer-Country request header.

What should the developer do next to redirect requests on cache misses?

Answer options

Correct answer: B

Explanation

The correct answer is B because a Lambda@Edge function can be used to process requests at the origin request event, allowing the developer to redirect to the nearest S3 bucket based on the CloudFront-Viewer-Country header. Option A is incorrect because a CloudFront function cannot be associated with the origin request event. Options C and D are wrong as they associate the function with the viewer request event instead of the origin request event, which is not suitable for this use case.