$ sudo su postgres
$ cd ~
$ mkdir -p backups/{daily,weekly,monthly,yearly} scripts
Exit to a sudo user
$ exit
check python is installed (install pyton - http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-python)
$ python --version
check pip is installed
$ pip --help
install pip
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
$ sudo pip install awscli
$ sudo su - postgres
$ aws configure
$ aws s3 ls
login to AWS
manage s3
create bucket
create folder backups
create folders production and staging inside backups
$ cd ~/scripts
$ nano daily_backup.sh (copy, modify above scripts)
$ nano weekly_backup.sh (copy, modify above scripts)
$ nano monthly_backup.sh (copy, modify above scripts)
$ nano yearly_backup.sh (copy, modify above scripts)
Make sure script is executable by postgres
chmod 770 daily_backup.sh weekly_backup.sh monthly_backup.sh yearly_backup.sh
$ crontab -e
(Use above cron script)
$ crontab -e
change the daily backup to every minute
* * * * * ~/scripts/daily_backup.sh > ~/scripts/daily_backup.log 2>&1
check the daily_backup.log for any errors
#Check S3 Bucket login to AWS and verify the S3 bucket has the uploaded files
http://www.rubytreesoftware.com/resources/basic-postgresql-backup-and-restore