RDS to S3 using pg_dump directly (without intermediary)

独自空忆成欢 提交于 2020-02-18 09:47:44

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/22017596/rds-to-s3-using-pg-dump-directly-without-intermediary

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!