

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: CloudFront CDN
incomplete
2: CloudFront Distributions
incomplete
3: CloudFront Invalidation
incomplete
4: Presigned URLs
incomplete
5: Why Use Presigned URLs?
incomplete
6: CloudFront With DNS
incomplete
7: Cleanup
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A CDN is a geographically distributed cache, which means it's one of the hardest things to deal with...
"There are 2 hard problems in computer science: cache invalidation, naming things, and off-by-1 errors."
– Leon Bambrick
If you update the favicon in your S3 bucket, it won't immediately update for users accessing it through CloudFront.
Similarly, if you use CloudFront to serve content like HTML, CSS, or JavaScript files for a website, users might not see the latest version of your site immediately after you make changes.
For that reason, you need to know how to invalidate cached content in CloudFront. This forces CloudFront to fetch the latest version from the origin (your S3 bucket) instead of serving the cached version. It basically says:
"Hey! There's new content, go update the cache!"
PatientPing has gone stylish. Marketing wants to use a new black and white version of the logo.
Upload the new logo to S3 and invalidate the CloudFront distribution cache so that users see the new logo immediately.
curl -o favicon.ico https://storage.googleapis.com/qvault-webapp-dynamic-assets/course_assets/patientping-bw-favicon.ico
The CLI tests check CloudTrail for your invalidation event. CloudTrail events can take a few minutes to appear, so wait 2-5 minutes after the invalidation completes before submitting.
Run and submit the CLI tests.
If you prefer to use the CLI, here is the command structure:
aws cloudfront create-invalidation \
--distribution-id YOUR_DISTRIBUTION_ID \
--paths "/favicon.ico"