Problem
- When the origin (e.g., S3 bucket) content is updated, CloudFront will still serve the old cached version until the TTL (Time to Live) expires.
Solution
- You can manually trigger a cache refresh before TTL expiration using a CloudFront Invalidation.
How it works
- Invalidate all files with
/*
- Invalidate a specific file such as
/index.html
- Invalidate a directory pattern such as
/images/*
Example Use Case
- You update
index.html
and several files in/images/
on S3.
- You submit an invalidation request for:
/index.html
/images/*
- CloudFront removes those objects from all edge caches, and new versions are fetched from the origin on the next request.
This ensures fresh content delivery without waiting for cache expiration.