Overview

Invalidation in CloudFront allows you to remove cached content from the edge locations, ensuring that the latest version of your content is served. This is especially useful for scenarios like updating static assets (e.g., images, CSS, JS) or correcting errors in previously cached files.


Key Features

  1. Targeted Clearing: You can invalidate specific objects (e.g., /style.css) or use wildcard patterns (e.g., /assets/*).
  2. Immediate Effect: Once processed, the invalidated content is immediately fetched from the origin on the next request.
  3. Cost:

How Invalidation Works

  1. Request Submitted:
  2. Next Request:
  3. Updated Cache:

Practical Example

Scenario

Your website deployed a new main.css file, but CloudFront is still serving the older cached version. You need to invalidate this file.

Steps to Invalidate a File

  1. Go to the AWS Management Console > CloudFront.
  2. Navigate to your Distribution.
  3. Select the Invalidations tab > Create Invalidation.