Skip to content

Instantly share code, notes, and snippets.

@stollcri
Created December 4, 2015 13:11
Show Gist options
  • Select an option

  • Save stollcri/58535848d5bdc8e02415 to your computer and use it in GitHub Desktop.

Select an option

Save stollcri/58535848d5bdc8e02415 to your computer and use it in GitHub Desktop.
Synchronize files to AWS S3
$SRC_DIR=/var/www/htdocs
cd $SRC_DIR/images
DIR_SIZE=$(du . -hS | tail -n1 | awk '{print $1}')
echo "Syncing s3://BUCKET_NAME/images/ ($DIR_SIZE)"
/usr/local/bin/aws s3 sync . s3://BUCKET_NAME/images/ --storage-class STANDARD --exclude '.*' --exclude '*.php'
cd $SRC_DIR/images-old
DIR_SIZE=$(du . -hS | tail -n1 | awk '{print $1}')
echo "Syncing s3://BUCKET_NAME/images-old/ ($DIR_SIZE)"
/usr/local/bin/aws s3 sync . s3://BUCKET_NAME/images-old/ --storage-class STANDARD_IA --exclude '.*' --exclude '*.php'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment