AWS CloudFront caches your website's content at its edge locations based on configured TTL values. This caching can result in users seeing outdated content if the cache is not cleared after updates. This is especially critical for files like CSS and JavaScript, which, if outdated, can break your website's layout or functionality.

To ensure your users see the most up-to-date content, you must clear or invalidate the cache. Cache invalidation removes specific objects from the cache, forcing CloudFront to fetch the latest version from your origin server. This process is essential for maintaining your website’s appearance and functionality after updates.

You can clear the cache by invalidating the necessary objects in your CloudFront distribution. This process can be done directly from the AWS Console. Invalidation ensures that stale content is no longer served to your users, improving their experience with your website.

Steps to clear AWS CloudFront cache:

  1. Go to CloudFront dashboard in AWS Console.

  2. Click on the CloudFront distribution that you want to delete the cache of.
  3. Click on the Invalidations tab of the distribution.
  4. Click on the Create invalidation button.
  5. Enter the paths of the objects to be invalidated based on the given examples.

    Using /* for the path will clear all cache.

  6. Click on the Create invalidation button.
  7. Wait for the Cloudfront cache to be completely cleared.
Discuss the article:

Comment anonymously. Login not required.