Configure EC2 connection to RDS


I have an application server running on EC2 in VPC A under one cloud account. I have an RDS Oracle instance in VPC B under diffent cloud account. There is TGW between both clouds. What do you normally have to do on the EC2 machine or networking to be able to connect and forward traffic to the RDS in VPC B? I have oracle client software installed on EC2 machine in order to connect to oracle server.

1 Answer

Assuming that the Transit gateway is all setup, confirm that the route tables are correctly configured so that the subnet in VPC A containing the EC2 instance has a route to the subnet(s) in VPC B that form the subnet group in which the RDS instance is provisioned (and vice versa)

Then setup security groups (or network ACLs, but SGs are more common) to allow outbound access from the EC2 on port 1521/tcp to the subnets in the subnet group that have the RDS instance running. And similarly, that the RDS instance has a security group with an inbound rule on port 1521/tcp for traffic coming from the EC2 instance.

profile picture
answered 11 days ago
profile picture
reviewed 11 days ago
  • Excellent Answer! I am not very clear on proper setup of Route tables. Is there a good link or video that shows how do you normally setup those AWS entries correctly?

  • As long as you understand routing tables within a single VPC, it's really just an extension of that.

    The theory behind it is here

    And a more practical working through of it is here

  • Great Info. It seems to me the routing should be configured as this so that traffic from application/web server in VPC1 can be forwarded to private RDS in VPC2. Does this seem correct?

    1. Update the route table for private subnet where the source Application server is to forward outbound traffic to TGW. If the IP for outbound traffic is for the RDS instance in another account it will go to the TGW.

    Destination Target Local TGW (foreward any traffic that is not local)

    1. The TGW Route table should have an entry to forward traffic to second VPC where the RDS is located.

    Destination Target RDS Subnet IP Range VPC#2

    The TGW also will have attachments defined to first and second VPC.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions