Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sync a directory to S3 and invalidate the CloudFront cache for changed resources.
# output format is like this:
# upload: index.html to s3://$BUCKET/index.html
# so we grab the second item which is the file path and pass that via xargs to the
# cloudfront invalidation command
aws s3 sync --sse AES256 s3://$BUCKET/ site/ | awk '{print $2;}' | \
xargs aws cloudfront create-invalidation --distribution-id $CF_DISTRO_ID --paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.