使用pg_dump直接使用RDS到S3(无中介)

时间:2021-08-18 03:16:10

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

可以在RDS或S3中运行pg_dump(不使用像ec2这样的中介来执行命令)

2 个解决方案

#1


10  

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:

只要数据库安全组允许外部访问端口5432(postgres的默认设置),您就应该能够访问它。然后你可以运行:

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.

AFAIK,RDS和S3之间的AWS中没有接口,因此您必须使用中介将数据传输到S3。

#2


7  

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

AWS CLI添加了对stdin上传的支持,因此您现在可以选择执行以下操作:

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.

这不是理想的,因为你正在流式传输到本地机器然后进入s3 - 但它至少是一个命令。

#1


10  

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:

只要数据库安全组允许外部访问端口5432(postgres的默认设置),您就应该能够访问它。然后你可以运行:

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.

AFAIK,RDS和S3之间的AWS中没有接口,因此您必须使用中介将数据传输到S3。

#2


7  

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

AWS CLI添加了对stdin上传的支持,因此您现在可以选择执行以下操作:

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.

这不是理想的,因为你正在流式传输到本地机器然后进入s3 - 但它至少是一个命令。