Issue
I am trying to connect to an AWS RDS MySQL instance (private subnet) via MySQL Workbench. My VPC contains:
I can access the RDS via EC2 but cannot connect to the RDS instance via my local machine. From what I understand, this is because I do not have a SSH key pair.
The EC2 instance was created when I created an ElasticBeanstalk application which hosts a REST API. It appears that an SSH key pair was not created. Without an SSH Key I cannot access the RDS instance from my local machine.
How do I create a new SSH Key pair and assign it to my EC2 instance?
Settings required to connect to MySQL instance via Standard TCP/IP over SSH with MySQL Workbench: Settings required to connect to MySQL instance via Standard TCP/IP over SSH with MySQL Workbench
EC2 warning stating that I do not have an associated key pair. EC2 warning stating that I do not have an associated key pair
Any help would be greatly appreciated!
Solution
First of all, just to clarify for future readers, you cannot connect to RDS from your local machine—not because there isn't an SSH Key Pair, but because your RDS instance is located in a private subnet.
In other words, even if you have associated a public IP with your RDS instance, you cannot connect to it because the route table for the private subnet does not route 0.0.0.0/0 traffic through an Internet Gateway.
Having clarified that, if you want to connect to your private RDS instance, you can use your public EC2 instance as a proxy: to do so, you'll need a new SSH key.
You have two options:
- The simpler one: create a new key pair, associate it with a new public EC2 instance during its creation, and then use this new EC2 instance to act as a proxy.
- Create a new key pair and associate to your existing EC2 instance.
Answered By - Filippo Testini Answer Checked By - Marie Seifert (WPSolving Admin)