将EC2实例连接到另一个AWS账户上的RDS卷

时间:2022-06-25 02:46:35

I have two different AWS accounts running EC2 instances and RDS volumes set up in the following way:

我有两个不同的AWS账户运行EC2实例和RDS卷以下列方式设置:

AWS Account #1

AWS账户#1

  • EC2 1(Production)
  • EC2 1(生产)
  • RDS 1(Production)
  • RDS 1(生产)

AWS Account #2

AWS账户#2

  • EC2 2(Development)
  • EC2 2(开发)
  • RDS 2(Development)
  • RDS 2(开发)

The reason I separated the development and production was to take advantage of the AWS free tier usage while we test our app.

我将开发和生产分开的原因是在我们测试应用程序时利用AWS免费套餐的使用。

My question is whether it's possible for me to access the RDS 2 (Production) from EC2 1 (Development) for testing purposes, and if so how I'd go about doing it. I've been playing around with the VPC settings and can't seem to get it work.

我的问题是我是否可以从EC2 1(开发)访问RDS 2(生产)以进行测试,如果是这样,我将如何进行测试。我一直在玩VPC设置,似乎无法让它工作。

Basically can I access the RDS of one AWS account from an EC2 of another AWS account that I own?

基本上我可以从我拥有的另一个AWS账户的EC2访问一个AWS账户的RDS吗?

1 个解决方案

#1


3  

If you want to keep your traffic inside the VPC realms, then you need to create a Peering Connection between the 2 VPCs. Peering Connections can be created across different AWS accounts very easily by referencing the VPC ID in the other account, and then you will need to login to that account and Accept/Approve the connection.

如果要将流量保留在VPC域内,则需要在2个VPC之间创建对等连接。通过引用其他帐户中的VPC ID,可以非常轻松地跨不同的AWS账户创建对等连接,然后您需要登录该帐户并接受/批准连接。

Then you need to create rules in your routing tables to let the 2 networks communicate.

然后,您需要在路由表中创建规则以让2个网络进行通信。

#1


3  

If you want to keep your traffic inside the VPC realms, then you need to create a Peering Connection between the 2 VPCs. Peering Connections can be created across different AWS accounts very easily by referencing the VPC ID in the other account, and then you will need to login to that account and Accept/Approve the connection.

如果要将流量保留在VPC域内,则需要在2个VPC之间创建对等连接。通过引用其他帐户中的VPC ID,可以非常轻松地跨不同的AWS账户创建对等连接,然后您需要登录该帐户并接受/批准连接。

Then you need to create rules in your routing tables to let the 2 networks communicate.

然后,您需要在路由表中创建规则以让2个网络进行通信。