Access an AWS RDS DB in a Private Subnet From MySQL Workbench

You put your database in a private subnet. How do you still “Connect to Database” from MySQL Workbench?

Serverless Guru
Serverless Guru

--

Photo by Yale Cohen on Unsplash

Follow this procedure if you’ve already created an RDS instance in a private subnet and an EC2 instance in a public subnet:

  1. In MySQLWorkbench, click Connect to Database in the Database menu.
  2. As the Connection Method, select Standard TCP/IP over SSH.
  3. As the SSH Hostname, type the IPv4 Public IP of your EC2 instance.
  4. As the SSH Username, enter ec2-user.
  5. As the SSH Key File, type the path to your EC2’s private key file.
  6. The MySQL Hostname is the Endpoint of your database instance.
  7. The Server Port is typically 3306. It shows as Port in your DB instance.
  8. Enter your database’s Username.
  9. Click Store in Keychain… to enter your database’s password.
  10. OK.
Made-up database names.

That’s it! If your RDS database isn’t in a private subnet yet, it’s time to ask…

--

--

Serverless Guru
Serverless Guru

We can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. https://www.serverlessguru.com