This script allows uploading gzipped rds postgres backups to amazon s3. Database credentials are retrieved from aws parameter store.
ENVIRONMENT
allows tagging different environments, we use prod
and
dev
as possible values.
IDENTIFIER
is a database identifier, e.g. db
. The identifier is
used for querying configuration options and for naming the result in s3.
REGION
is the aws region to operate in.
/$ENVIRONMENT/cron/backup/$IDENTIFIER/host
: database host name/$ENVIRONMENT/cron/backup/$IDENTIFIER/name
: database name/$ENVIRONMENT/cron/backup/$IDENTIFIER/user
: database user name/$ENVIRONMENT/cron/backup/$IDENTIFIER/password
: database password/$ENVIRONMENT/cron/backup/$IDENTIFIER/bucket
: target s3 bucket
After completion, the script creates a gzipped backup in the target s3
bucket named $IDENTIFIER-YYYY-MM-DD.sql.gz
. All backups are stored in
STANDARD_IA
storage class.