Skip to content

Instantly share code, notes, and snippets.

@mouthzipper
Forked from kellyrmilligan/s3Sync.sh
Created February 28, 2020 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouthzipper/70b31649718b66feb9a3ce59e6330aaa to your computer and use it in GitHub Desktop.
Save mouthzipper/70b31649718b66feb9a3ce59e6330aaa to your computer and use it in GitHub Desktop.
Sync files to s3 and set cache control headers
#!/bin/bash
if [[ "$1" != "" ]]; then
S3BUCKETNAME="$1"
else
echo ERROR: Failed to supply S3 bucket name
exit 1
fi
aws s3 sync build s3://$S3BUCKETNAME --delete --cache-control max-age=31536000,public
aws s3 cp s3://$S3BUCKETNAME/service-worker.js s3://$S3BUCKETNAME/service-worker.js --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type application/javascript --acl public-read
aws s3 cp s3://$S3BUCKETNAME/index.html s3://$S3BUCKETNAME/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html --acl public-read
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment