简体   繁体   中英

Connecting an EC2 instance to an RDS volume on another AWS Account

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

AWS Account #1

  • EC2 1(Production)
  • RDS 1(Production)

AWS Account #2

  • EC2 2(Development)
  • RDS 2(Development)

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

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.

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

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.

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

This answer is not directly connected to your question but for all those who want to connect VPCs (or other resources) across different AWS accounts within AWS Organizations, this should be the right way to do that:

https://aws.amazon.com/blogs/networking-and-content-delivery/vpc-sharing-a-new-approach-to-multiple-accounts-and-vpc-management/

More about AWS Resource Access Manager:

https://docs.aws.amazon.com/ram/latest/userguide/what-is.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM