Last active
August 5, 2020 06:38
-
-
Save gojko/fb6b319c8ee2e92b13b2f39a10caaf3e to your computer and use it in GitHub Desktop.
deploy files to s3 for cloudfront web sites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# let aws-sdk guess content type and allow long cache for everything apart from JS, CSS and HTML | |
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*.html" --exclude "*.js" --exclude "*.css" --acl public-read | |
# set JS content type correctly so UTF chars can be included safely (otherwise browsers mess up UTF) | |
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*" --include "*.js" --acl public-read --content-type "application/javascript; charset=UTF-8" | |
# set CSS content type correctly so UTF chars can be included safely | |
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=86400000" --exclude "*" --include "*.css" --acl public-read --content-type "text/css; charset=UTF-8" | |
# 10-minute CDN cache for HTML files | |
aws s3 sync $WORKDIR/ s3://$BUCKET --cache-control="max-age=600" --exclude "*" --include "*.html" --acl public-read --content-type "text/html; charset=UTF-8" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment