Last active
October 19, 2018 16:59
-
-
Save pindlebot/10fb3b54e73d92f3b2c43d6fdfa8f808 to your computer and use it in GitHub Desktop.
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
| #!/bin/bash | |
| DATE=`date +%m-%d-%Y` | |
| HOSTNAME=$(curl http://169.254.169.254/latest/meta-data/public-hostname) | |
| AWS_BUCKET=postgres-data | |
| AWS_REGION=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document|grep region|awk -F\" '{print $4}') | |
| export PGUSER=postgres | |
| pg_dumpall | aws --region $AWS_REGION s3 cp - "s3://$AWS_BUCKET/$HOSTNAME/$DATE.bak" | |
| echo "Backup saved on $(date)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment