exam questions

Exam AWS Certified Developer Associate All Questions

View all questions & answers for the AWS Certified Developer Associate exam

Exam AWS Certified Developer Associate topic 1 question 286 discussion

Exam question from Amazon's AWS Certified Developer Associate
Question #: 286
Topic #: 1
[All AWS Certified Developer Associate Questions]

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?

  • A. Create a CloudFront function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the CloudFront function with the distribution's origin request event.
  • B. Create a Lambda@Edge function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the Lambda@Edge function with the distribution's origin request event.
  • C. Create a Lambda@Edge function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the Lambda@Edge function with the distribution's viewer request event.
  • D. Create a CloudFront function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the CloudFront function with the distribution's viewer request event.
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
lrom
Highly Voted 2 years, 6 months ago
Selected Answer: D
https://aws.amazon.com/it/blogs/aws/introducing-cloudfront-functions-run-your-code-at-the-edge-with-low-latency-at-any-scale/
upvoted 5 times
...
Ankit1010
Highly Voted 2 years, 3 months ago
B - redirect to origin (s3) on cache miss. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-cloudfront-trigger-events.html The CloudFront events that can be used to trigger Lambda@Edge functions are the following: 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 CloudFront cache. Origin request: The function executes only when CloudFront forwards a request to your origin. When the requested object is in the CloudFront cache, the function doesn't execute.
upvoted 5 times
...
kyoharo
Most Recent 1 year, 7 months ago
Selected Answer: B
B. Create a Lambda@Edge function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the Lambda@Edge function with the distribution's origin request event.
upvoted 1 times
...
rushi0611
1 year, 11 months ago
Selected Answer: B
Lambda@Edge with origin request event is correct Cloudfront functions does not support origin request event..
upvoted 2 times
...
rcaliandro
1 year, 11 months ago
Selected Answer: B
B - "Create a Lambda@Edge function to redirect requests based on the value of the CloudFront-Viewer-Country header. Associate the Lambda@Edge function with the distribution's origin request event"
upvoted 2 times
...
Panos1313
2 years ago
I think it s D: CloudFront Functions can be useful to redirect traffic based on simple conditions. For instance, a user could choose to redirect traffic coming from a specific country of origin using the HTTP header CloudFront-Viewer-Country.
upvoted 1 times
...
Phinx
2 years, 4 months ago
Selected Answer: B
I think it's B.
upvoted 2 times
...
by116549
2 years, 5 months ago
also found this thread too: https://stackoverflow.com/questions/48633610/how-do-i-get-cloudfront-viewer-country-to-appear-in-response-headers
upvoted 1 times
...
bindukas
2 years, 6 months ago
Selected Answer: B
B. As explained in response to hamimelon comment
upvoted 4 times
...
hamimelon
2 years, 6 months ago
D. I was debating between A & D because I am not familiar with view/origin request. This link helped. https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-cloudfront-trigger-events.html
upvoted 1 times
bindukas
2 years, 6 months ago
Shouldn't it be A then? Since we only want to execute runction on cache misses, so on origin request?
upvoted 1 times
bindukas
2 years, 6 months ago
So it appears cloudfront function does not support origin request: "Similar to Lambda@Edge, CloudFront Functions runs your code in response to events generated by CloudFront. More specifically, CloudFront Functions can be triggered after CloudFront receives a request from a viewer (viewer request) and before CloudFront forwards the response to the viewer (viewer response). Lambda@Edge can also be triggered before CloudFront forwards the request to the origin (origin request) and after CloudFront receives the response from the origin (origin response). You can use CloudFront Functions and Lambda@Edge together, depending on whether you need to manipulate content before, or after, being cached." In this case it makes more sense to me to use Lambda@Edge, so I choose B answer. Otherwise it will always trigger function without checking cache first
upvoted 4 times
fe2
2 years, 5 months ago
very good explanation
upvoted 1 times
...
...
...
...
k1kavi1
2 years, 6 months ago
Selected Answer: B
Choosing B
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...