Accessing Amazon RDS Instances from your Desktop

Whilst we are huge fans of the Amazon RDS database service (particularly the Multi-AZ setup), one thing that can be a problem is accessing your databases from the desktop. The standard trick of running an SSH tunnel to your EC2 instance doesn’t work here. 

After much searching I found the following on an AWS discussion forum and it works perfectly:

ssh-add YourKey.pem
ssh -l <username> -L 33060:<ec2_rfc_ip>:3306 -N <ext_hostname> 

Then connect your local MySQL client to localhost, port 33060 

<username> is the login user on the EC2 instance from where you normally access the RDS MySQL DB. <ec2_rfc_ip> is the RDS instance’s IP address and <ext_hostname> is the external hostname of one of your EC2 instances. 

A couple of notes:
  1. You have to use the internal AWS IP address of the RDS instance, not its name or its external IP
  2. We’ve only tested it on an Ubuntu desktop running inside VirtualBox on Windows
  3. It works fine with the MySQL GUI tools
  4. We haven’t been able to figure out how to do it directly with Putty on Windows. Anyone know how?

One thought on “Accessing Amazon RDS Instances from your Desktop

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>