Invalidate in CloudFront

Invalidate the content in CloudFront to force the removal of objects

  1. Back to Amazon CloudFront service management console.

  2. Select your distribution and go to Invalidations tab. Create an invalidation request. CDN

  3. At the Create invalidation page:

  • Paste:
/test.html
/cf-test-image.png
  • Click on “Create invalidation” button CDN

Now let’s update the HTML page in the S3 bucket. We are going to update the test html version to 4. Save the file locally and then upload to your S3 bucket.

  • Update file test.html from 2 to 4. CDN
  • Reupload file to S3. CDN
  • Open test.html from S3 URL, the content should be version 4. CDN
  • And the content in return from CloudFront should be version 4 as well. CDN

To summarize, content updates are now reflected immediately on S3 and the CDN every 20 seconds, rather than every 24 hours.