Search code examples
amazon-web-servicesamazon-rdsaws-vpc-peering

AWS - Help configuring Lightsail and RDS on same subnet for fastest speed


We have a Lightsail instance on us-west-2 with a public and private IP. We also have two RDS instances (core and RR) on us-west-2, but one is in subregion c and the other d.

Right now it takes on average 300ms for our Lightsail instance to establish a connection with the RDS instance. We want this down to 10ms or less. The problem is I can't figure out how to have them communicate directly through the AWS subnet.

So I went into Lightsail and enabled VPC peering for us-west-2. I also added the private IP to the security group inbound rules of the RDS.

The problem is no matter what I do, Lightsail goes outside to the public and back into the endpoint DNS of the RDS database. It works, but as mentioned above, is very slow.

If I remove the public IP from the inbound RDS instance rules and just have the private IP, the lightsail instance can't connect.

So the issue is getting the internal private IP of Lightsail to see and connect with the RDS endpoint via the AWS subnet.

The problem is I can't find any steps on what to do next. All the documentation and step by step guides I've seen say turning on VPC peering is all you need to do. There seems to be some other chat about adjusting the routing table of peering, but it requires CIDR IP ranges and RDS only provides DNS endpoints that based on my knowledge can change.

Any help on how to get Lightsail to connect with its internal IP to RDS instances in the same region within the AWS subnet would be greatly appreciated.


Solution

  • We found the issue. Our Backend developers hardcoded the DNS server in the Lightsail instance. Once that was removed, everything worked fine. sigh