Last active
April 2, 2019 08:54
-
-
Save andyj/4f59734802ea9d9941945e9836354111 to your computer and use it in GitHub Desktop.
Bash script to backup a MySQL RDS dump to S3
This file contains hidden or 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
# From Andy Jarretts post: | |
# http://www.andyjarrett.co.uk/2016/08/02/secured-bash-script-to-backup-a-mysql-rds-dump-to-s3/ | |
#!/bin/bash | |
SQLDUMP="$(date +'%Y%m%d%H%M').sql.gz" | |
echo "Creating backup of database to $SQLDUMP" | |
mysqldump --login-path=local --databases YourDatabaseName | gzip -9 > $SQLDUMP | |
echo "Dump Zipped up" | |
echo "Uploading zipped dump to the Amazon S3 bucket…" | |
s3cmd put $BACKUPNAME s3://bucketname/backup/folder/$BACKUPNAME | |
echo "Removing the backup file $SQLDUMP" | |
rm $BACKUPNAME | |
echo "WooHoo! All done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment