DVA-C02 · Question #404
A developer manages a website that distributes its content by using Amazon CloudFront. The website's static artifacts are stored in an Amazon S3 bucket. The developer deploys some changes and can see
The correct answer is C. Set CloudFront to invalidate the cache after the artifacts have been deployed to Amazon S3.. When CloudFront continues serving stale content after S3 objects are updated, the CloudFront edge cache must be explicitly invalidated to force it to fetch the new versions.
Question
A developer manages a website that distributes its content by using Amazon CloudFront. The website's static artifacts are stored in an Amazon S3 bucket. The developer deploys some changes and can see the new artifacts in the S3 bucket. However, the changes do not appear on the webpage that the CloudFront distribution delivers. How should the developer resolve this issue?
Options
- AConfigure S3 Object Lock to update to the latest version of the files every time an S3 object is
- BConfigure the S3 bucket to clear all old objects from the bucket before new artifacts are uploaded.
- CSet CloudFront to invalidate the cache after the artifacts have been deployed to Amazon S3.
- DSet CloudFront to modify the distribution origin after the artifacts have been deployed to Amazon
How the community answered
(34 responses)- A9% (3)
- B15% (5)
- C74% (25)
- D3% (1)
Why each option
When CloudFront continues serving stale content after S3 objects are updated, the CloudFront edge cache must be explicitly invalidated to force it to fetch the new versions.
S3 Object Lock is a WORM (Write Once Read Many) compliance feature that prevents object deletion or overwriting; it has no mechanism to update CloudFront's edge cache.
Clearing old S3 objects removes them from the origin bucket but does not purge them from CloudFront's distributed edge cache, so the old content would still be served until TTL expires.
CloudFront caches objects at edge locations based on the configured TTL. When new artifacts are deployed to S3, existing cached copies are not automatically refreshed. Creating an invalidation (e.g., for /* or specific paths) instructs CloudFront edge nodes to discard cached versions and retrieve the updated objects from the S3 origin on the next request.
Modifying the distribution origin changes where CloudFront fetches content from and does not invalidate the existing cached objects at edge locations.
Concept tested: CloudFront cache invalidation after S3 artifact deployment
Source: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
Community Discussion
No community discussion yet for this question.