Not able to connect AWS RDS instance?
Hello Guys,
if you have created a new DB in aws rds and trying to connect it and having an AWS RDS timeout error or somehow not able to connect to RDS then you can solve the problem using the below guide
When you launch the RDS instance in aws it is by default launched in Default VPC and default security group so if you have not changed any default setting for VPC and security group then RDS is in private VPC
it means AWS RDS is not accessible from the internet and only can accessed from same VPC resources so if you launch EC2 instance in Same VPC and try to connect RDS from that EC2 then it will connect without giving connection timeout error because its in Same VPC
and connecting RDS from the internet is not good idea because it contains data and it should not be directly accessible from the internet, so to connect secure RDS you can use SSH tunneling or Bastion host method.
If you still want to connect RDS from outside or local machine then here is the process
Step 1: RDS Publicly accessible check
Go to RDS which you have created and look at Connectivity & security tab, inside this tab you can find one parameter called Publicly accessible, if it yes then your RDS can be connected from the Internet and something else is still wrong here
Step 2 : Security Group Check
Your RDS is having a default security group if you have not changed, then it will not have the port open to allow connection from outside
so you have to check if the port is open or not, for that go to the same tab Connectivity and security, there you will find security group connected with RDS, now open the Security group and check for the Inbound rules
you can see their port for MySQL is open to the world, which means it can be connected from the internet, so you also have to edit inbound rules and select anywhere-ipv4, so your RDS can access from your local machine
Thanks for reading.
read more blogs on AWS here