Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDS to S3 using pg_dump directly (without intermediary)

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

like image 485
gusgard Avatar asked Feb 25 '14 14:02

gusgard


People also ask

Does RDS support PostgreSQL?

Amazon RDS for PostgreSQL currently supports PostgreSQL 9.6, 10, 11, 12, 13, and 14. Information about the supported minor versions is available in the Amazon RDS User Guide.


2 Answers

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.

like image 119
nerdwaller Avatar answered Sep 20 '22 14:09

nerdwaller


You should be able to access it as long as your db security group allows external access to port 5432 (default for postgres). Then you can just run:

pg_dump -h <database_host> -U <username> <database>

Keep in mind that your connection will not be encrypted.

AFAIK, there is no interface in AWS between RDS and S3, so you would have to use an intermediary to transfer the data to S3.

like image 42
Rico Avatar answered Sep 19 '22 14:09

Rico