Automatically dump and archive PostgreSQL backups to Amazon S3.
- AWS cli:
pip install awscli
aws configureto store your AWS credentials in
pg_dump-to-s3.confand set your PostgreSQL's credentials and the list of databases to back up
- If your PostgreSQL connection uses a password, you will need to store it in
./pg_to_s3.sh # * Backup in progress.,. # -> backing up my_database_1... # ...database my_database_1 has been backed up # -> backing up my_database_2... # ...database my_database_2 has been backed up # * Deleting old backups... # -> Deleting 2018-05-24-at-03-10-01_my_database_1.dump # -> Deleting 2018-05-24-at-03-10-01_my_database_2.dump # # ...done!
Restore a backup
pg_restore -d DB_NAME -Fc --clean PATH_TO_YOUR_DB_DUMP_FILE