Search code examples
amazon-web-servicesamazon-rdsamazon-vpc

Can't connect to RDS instance from local computer (outside VPC)


I have created 2 RDS instances inside a VPC with 3 public and 3 private subnets. Both have the public accessible option set to yes, yet i can only connect to one of them from my computer. The other one can only be accessed from an ec2 instance that is inside the VPC

My understanding is that one of the RDS instances ended up inside a public subnet, while the other (the one i can't access from home) ended up inside a private subnet.

Question - Can I guarantee, on creation, that the instance will be inside a public subnet? If not, can i put the instance in a public subnet later, without changing the subnet from private to public?

I have checked this article from aws knowledge center, but i didn't fully understand the solution. It seems the solution is to change a private subnet to public, which i ended up not doing since i have other ec2 instances inside the VPC that cannot be in public subnets. What I did so far was creating another VPC with public subnets only and recreating the RDS instance there.


Solution

  • When launching an Amazon RDS database, you must select a DB Subnet Group. This is a list of subnets where RDS is allowed to launch the database. The group must contain subnets from at least two Availability Zones.

    If you wish to ensure that the database is launched in a public subnet, then make sure that the DB Subnet Group only contains public subnets.

    If you have not started using the databases, I recommend that you terminate the databases, correct the entries in the DB Subnet Group and launch new databases. This will ensure that they are always in a public subnet.