I have both a Ubuntu based Instance/VM as well as a Ubuntu based container service running in Lightsail currently. Additionally I have a MsSQL RDS instance running in AWS in the same region in the regions default VPC.
I managed to successfully activate VPC peering in my Lightsail account. Additionally I have whitelisted connections from any Lightsail services by allowing connections from the full 172.26.0.0/16
IP range that Lightsail services use. This has allowed me to connect from my regular Instance/VM without issues. However from my Lighstail Container Service attempts to connect to the database timeout.
How can I get this working?
2
Answers
It turns out that my RDS MsSQL was not in the region's default VPC like I thought. Once I moved the instance to the correct VPC everything started working properly.
Make sure to verify that the routes are correctly set up in the subnet where your RDS instance is located. To do this:
• Go to the VPC settings in your AWS Console.
• Navigate to Subnets and select the subnet where your RDS instance is located.
• Click on Route Tables.
There should be a route similar to this:
• Destination: 172.26.0.0/16
• Target: pcx-******** (your VPC peering connection).
For some reason, when a peering connection is created, it doesn’t automatically add routes for subnets associated with an Internet Gateway (if that’s your case). You’ll need to manually add the route to enable communication.