Need Help With Cloud Development?

Work with our skilled Cloud developers to accelerate your project and boost its performance.

Hire Cloud Developers

Support On Demand!

AWS CloudFront Invalidation via Console

Step-by-Step:

1. Open the CloudFront Console:

Go to the AWS CloudFront console.

2. Select Your Distribution:

In the CloudFront dashboard, find the distribution you want to invalidate and click on its ID to open the distribution details.

3. Go to the Invalidations Tab:

In the distribution details page, click on the “Invalidations” tab.

4. Create Invalidation:

Click on “Create Invalidation”.
In the dialog that appears, specify the paths you want to invalidate. For example:

  • /* to invalidate all files.
  • /index.html to invalidate a specific file.

5.Confirm the Invalidation:

Click “Invalidate” to submit the request. The invalidation will be processed and should take a few minutes to propagate across the edge locations.

You can check the status of the invalidation in the Invalidations tab.

AWS CloudFront Invalidation via CLI

Prerequisites:
You need to have the AWS CLI installed and configured on your machine. If you haven’t set it up, you can follow the AWS CLI installation guide.

CLI Command Example:
To create an invalidation using the AWS CLI, follow these steps:

1. Run the following command:

aws cloudfront create-invalidation --distribution-id --paths "/*"
Replace with your CloudFront distribution ID.
Replace “/*” with the path you want to invalidate. For example, you can invalidate just one file like /index.html or all files with /*.

Example Command:
aws cloudfront create-invalidation --distribution-id E1A2BC3DEF456 --paths "/index.html" "/images/*"
This command will invalidate /index.html and all files under the /images/ directory.

2. Check Invalidation Status:

You can list invalidations for a specific distribution using this command:
aws cloudfront list-invalidations --distribution-id

Related Q&A