Skip to content

Instantly share code, notes, and snippets.

@EngineerLabShimazu
Created October 18, 2019 01:22
Show Gist options
  • Save EngineerLabShimazu/b7a4c11c6552eb29b7e22c0b255dd637 to your computer and use it in GitHub Desktop.
Save EngineerLabShimazu/b7a4c11c6552eb29b7e22c0b255dd637 to your computer and use it in GitHub Desktop.
Schedule upload to S3
#!/bin/bash
# $ crontab -l
# * 23 * * * bash /path/to/s3_uploader.sh
# $ which aws
# /usr/local/bin/aws
# Add path to aws cli
PATH=$PATH:/usr/local/bin
UPLOAD_FILE=/your/upload/file
UPLOAD_DESTINATION=s3://your-bucket-name
UPLOAD_LOG=/your/uploaded/log-file
export AWS_ACCESS_KEY_ID=YOUR_ACCESS_KEY
export AWS_SECRET_ACCESS_KEY=YOUR_SECRET_ACCESS_KEY
aws s3 cp $UPLOAD_FILE $UPLOAD_DESTINATION --acl private &> $UPLOAD_LOG
@EngineerLabShimazu
Copy link
Author

TODO

  • Delete UPLOAD_FILE after upload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment