RDS to S3 using pg_dump directly (without intermediary)

gusgard picture gusgard · Feb 25, 2014 · Viewed 8.5k times · Source

It's possible run pg_dump in the RDS or in a S3 (without using a intermediary like ec2 to execute the command)

Answer

nerdwaller picture nerdwaller · Apr 3, 2017

The AWS CLI added support for uploads from stdin, so you now have the option of doing something like this:

pg_dump ...dbargs... | aws s3 cp - s3://my-bucket/backup-$(date "+%Y-%m-%d-%H-%M-%S")

It's not ideal, as you are streaming to your local machine and then into s3 - but it's at least a single command.