I have an RDS instance running on one subnet without NAT, and an EC2 instance running on another subnet with an Internet Gateway configured, both located in the same VPC. I have configured the RDS instance to not be publicly accessible.
I am using the following command in my remote EC2 (running on the second subnet) to connect to the RDS instance:
mysql -h xxxx.eu-central-1.rds.amazonaws.com -P 3306 -u root -p
I have entered the correct password which I have set when configuring the RDS, but I get the following error:
Can't connect to MySQL server on xxxx.eu-central-1.rds.amazonaws.com
What am I doing wrong? Am I missing something?