Skip to content
Automatically dump and archive PostgreSQL backups to Amazon S3
Shell
Branch: master
Clone or download

Latest commit

Latest commit 421f71c Aug 28, 2018

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Update documentation May 28, 2018
README.md Update documentation May 28, 2018
pg_dump-to-s3.conf.sample Update documentation May 28, 2018
pg_dump-to-s3.sh Remove prefix in filename Aug 28, 2018

README.md

pg_dump-to-s3

Automatically dump and archive PostgreSQL backups to Amazon S3.

Requirements

Setup

  • Use aws configure to store your AWS credentials in ~/.aws (read documentation)
  • Rename pg_dump-to-s3.conf.sample to pg_dump-to-s3.conf and 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 ~/.pgpass (read documentation)

Usage

./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
You can’t perform that action at this time.