This docker image starts an hourly cron job.
The cron job creates a backup of the PostgreSQL database and uploads it to S3.
Build the container using
$ docker build ./ -t im/rds_backups
The container can be executed manually using
$ docker run -it im/rds_backups
Please mind the configuration below.
The execution role needs an S3 IAM policy.
An example looks like:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:Put*",
],
"Resource": [
"arn:aws:s3:::${s3_bucket_arn}",
"arn:aws:s3:::${s3_bucket_arn}/*"
]
}
]
}
s3_bucket_arn
, the ARN of the bucket to upload the backup to.
The container requires the following environment variables to be set:
POSTGRES_DATABASE
, name of the databasePOSTGRES_HOST
, the name of the RDS instancePOSTGRES_PORT
, the port of the RDS instance (default: 5432)POSTGRES_USER
, the database userPOSTGRES_PASSWORD
, the database user passwordS3_BUCKET
, the name of the S3 bucket to upload the backup toS3_PREFIX
, prefix which will be prepended to the upload path (default:backups
)
Please test your backups regularly.
Encrypt your database data! The backups are not encrypted to allow quick restore.
Initially this was a fork of rds-postgres-backup-s3-secure by Emanuel Jöbstl.