This is a scrappy script I put together to invalidate AWS CloudFront paths that have been uploaded to AWS S3.
If you host a static website on Amazon S3 and CloudFront, you need to create a CloudFront cache invalidation every time you upload files to Amazon S3.
For example, when I run aws s3 sync website/ s3://n12v.com
, it may only upload
website/index.html
. Now I need to invalidate /index.html
on CloudFront.
AWS CLI doesn't provide an easy way to do that.
Expected directory structure: my-project/website/
.
Usage:
my-project $ ./sync.rb