This page looks best with JavaScript enabled

Clear AWS cloudfront cache

 ·  β˜• 1 min read

Prepare

Preface

Because of CloudFront CDN cache (Host a static website on AWS S3)
When you add new post, the website may not be updated immediately, with a delay of up to 24 hours
If you want to see the updated content immediately, you can clear the cache

Invalidating Files

By Command: aws cloudfront

First, use list-distributions to find out distribution ID

1
aws cloudfront list-distributions | grep Id	# find your distribution ID

grep command can’t be used by CMD (Windows)
Cmder is recommended, remember add it to system path


When you find the ID, use create-invalidation command to clear cache

1
aws cloudfront create-invalidation --distribution-id YOUR_ID --paths "/*"

aws cloudfront create-invalidation

Done

Share on
Support the author with

JIHONGO
WRITTEN BY
JIHONGO
A Person