Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to Amazon RDS instance through EC2 instance using MySQL Workbench

In AWS I have a VPC set up with a Bastion Host. The bastion host is a single EC2 instance with a public address trough which you can SSH to any other server on the VPC.

I have created an RDS MySQL instance within the VPC and I would like to connect to it using MySQL workbench. I have followed the steps detailed here, however in "Step 6: Setting up remote SSH Configuration", it asks me to "Provide the Public DNS of the Amazon EC2 instance" (i.e. the bastion host).

MySQL workbench then does checks for certain MySQL resources on that server. However, this is not correct in my opinion as I have provided the bastion host's address, which does not have MySQL installed. As a result, the last two checks for "Check location of start/stop commands" and "Check MySQL configuration file" then fail.

I have then tried using the endpoint address of the RDS MySQL instance but with no success (as it is in the private subnet so is not publicly addressable).

It seems that many people have this up and running, but what am I doing wrong here?

like image 375
iamyojimbo Avatar asked Oct 02 '13 03:10

iamyojimbo


People also ask

How do I connect to AWS RDS MySQL?

Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Databases to display a list of your DB instances. Choose the name of the MySQL DB instance to display its details. On the Connectivity & security tab, copy the endpoint.

Is Amazon RDS compatible with MySQL?

MySQL is the world's most popular open source relational database and Amazon RDS makes it easy to set up, operate, and scale MySQL deployments in the cloud. With Amazon RDS, you can deploy scalable MySQL servers in minutes with cost-efficient and resizable hardware capacity.


1 Answers

I've been struggling with something similar for weeks now. Just figured it out a few minutes ago.

  1. In mysql workbench, create a new server instance.
  2. For the remote host address, enter your endpoint address (i.e. xxxxxx.us-east-1.rds.amazonaws.com)
  3. For connection method, select "Standard TCP/IP over SSH"
  4. The SSH Hostname is the public DNS of your EC2 instance
  5. I specified ec2-user (I believe it varies by EC2 Instance type) as the username and then specified the downloaded key file corresponding to the key pair the instance was using.
  6. The mysql hostname is the endpoint of the RDS instance.
  7. The username is the username for the RDS instance (i.e. ebroot)

Using that I was able to connect. However, I did not utilize VPC in my setup. Hope this helps. Good luck!

like image 88
AndrewSmiley Avatar answered Sep 23 '22 17:09

AndrewSmiley