How to resolve CloudFront serving outdated S3 content?
Short answer
C Set CloudFront to invalidate the cache after the artifacts have been deployed to Amazon S3.
Question
Key Takeaways
This question tests the understanding of Content Delivery Network (CDN) caching behavior and the specific mechanism required to force a refresh, contrasting it with S3 configuration options that do not affect the CDN's edge cache.
When content in an S3 origin is updated, CloudFront may continue serving cached versions until the cache expires or is invalidated. The community agrees that creating a CloudFront invalidation is the necessary step to force an immediate update of the cached files.
Common mistake: Selecting option B (clearing old objects) is a common mistake because managing S3 storage does not trigger CloudFront to refresh its edge caches, which operate independently of the origin's file history.
Expert Analysis
Why the Answer Is Correct
CloudFront caches content at edge locations to reduce latency. When files in the S3 origin are updated, the edge locations retain the old versions until the Time To Live (TTL) expires. Option C is correct because invalidating the cache explicitly tells CloudFront to remove the old files from the edge locations and fetch the updated versions from S3. This ensures users see the changes immediately rather than waiting for the cache to expire naturally.
Why the Other Options Are Wrong
Option A is incorrect because S3 Object Lock is designed to prevent objects from being deleted or overwritten for a fixed amount of time, which is unrelated to CloudFront caching. Option B is incorrect because manually clearing S3 objects before upload does not send a signal to CloudFront to purge its cache. Option D is incorrect because modifying the distribution origin is unnecessary when only the content within the existing origin has changed; this action could even disrupt service.
Community Comment Notes
Community comments strongly support option C, citing the specific AWS CLI command for creating invalidations. Commenters highlight that while caching improves performance, it creates a delay in content visibility. The consensus is that invalidation is the standard mechanism to resolve the discrepancy between the origin (S3) and the CDN (CloudFront).
Official Reference
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html
This link opens the official vendor documentation in a new tab.
Exam Strategy
Remember that CloudFront acts as a middle layer. If the origin changes but the user sees old data, the issue is almost always the cache. Always look for 'invalidation' as the solution for immediate updates, rather than changing origin settings or modifying S3 bucket policies.
Community Votes
100% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
rdiaz 👍 2 Answered CBy invalidating the CloudFront cache, you ensure that the latest artifacts in your S3 bucket are delivered to users, resolving the issue of outdated content being displayed.
-
komorebi 👍 2C. Set CloudFront to invalidate the cache after the artifacts have been deployed to Amazon S3.
-
albert_kuo 👍 2 Answered Caws cloudfront create-invalidation --distribution-id EXAMPLE_DIST_ID --paths "/*"
-
preachr 👍 1 Answered CWhen a user requests content from a website, CloudFront checks if the content is available in its cache. If the content is available in the cache, CloudFront delivers the content to the user from its cache. This speeds up the delivery of the content and reduces the load on the website’s servers. However, if the content has changed on the website, the cached content in CloudFront will be outdated. To ensure that users receive the latest content, the cached content in CloudFront needs to be invalidated. This means that the cached content is removed from the CDN, and the next time a user requests the content, it is fetched from the website’s servers.
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →