Connecting to an AWS RDS Database Using MySQL Monitor, or MySQL Workbench

Hi everyone,

For one of my projects, I’ve been playing around with AWS for some time. Amazon Web Services (AWS) is pretty much a huge collection of amazing computing, networking, databasing, etc. resources which you can use to create just about anything!

Among the many obstacles I’ve encountered along the way – wouldn’t be fun without them – my latest one was connecting to the RDS instance so I can actually see what’s happening. I mean, I can SSH into EC2, and probably access RDS from there. But I want the convenience of popping up a local terminal and running one command to get into my RDS instance. Even better, I want MySQL Workbench to access my RDS instance so that I can visualize things a little more easily (I’m not a SQL-guru yet). Anyway, it’s probably worth noting also that I provisioned all these resources (including RDS) through Elastic Beanstalk. Shouldn’t really make a difference, as this solution has nothing to with EB, really.

Here’s what you do:

  1. In your AWS Management Console, go to RDS
  2. Click on the RDS DB instance you are trying to access
  3. In the drop-down area, you should see additional details. Of particular interest is the RDS security group name. Click on that, and you should find yourself in the Security Groups area of EC2.
  4. Click on the RDS security group associated with the RDS instance instance you are interested in (you identified this in steps 2 and 3).
  5. The drop-down menu for that security group should present you with 3 tabs (Details, Inbound, Outbound). Click Inbound.
  6. If you created your RDS instance through EB also, then you should see a rule for your EB security group already. You pretty much need to add a new rule for your local computer.
  7. Find your public IP address. If you’re on linux (hopefully you are), run sudo apt-get install curl and then curl Your IP address should be echoed. If this is not suitable for you, just go to
  8. Back in the AWS console, choose “MySQL” in “Create New Rule”. You need to access port 3306, which should be applied correctly automatically if you chose the right rule. In the “Source” field, add your IP address, with a “/32″ (your CIDR) at the end – something like “″.
  9. Click “Add Rule”, and then “Apply Rule Changes”. Done!
  10. Now, back in a local terminal, follow this tutorial from AWS to get things working in your MySQL monitor. Just replace text where necessary, and it should work right away. Let me know if you have problems.
  11. If you are using MySQL Workbench, it’s pretty much the same thing as Step 10. Fire up the program, click “New Connection”, and fill in the appropriate details. The hostname is your RDS DB Instance endpoint (you’ll see it at the top of the drop-down in Step 3), port is 3306, and you should know your own username and password – feel free to tell me though, I promise not to do anything mean :) . Done!

That’s it, everything should work as planned now. The only thing I have yet to figure out is what happens when my public IP address changes. I’m not a sys-admin in any way, so I’m new to all this stuff. I’ll find out, and update this post at some point. But if anyone knows, please let me know also!

Posted in Mini Tuts
2 comments on “Connecting to an AWS RDS Database Using MySQL Monitor, or MySQL Workbench
  1. Mark Flinch says:

    This process applies to all MySQL client and Monitoring tools like Navicat, SQLyog and MONyog- MySQL monitor .. isn’t it?

    • Treehouse Projects says:

      Hmm, it should. I mean, you wouldn’t use mysql workbench for those I’m pretty sure, but configuring the security settings would be pretty much the same.

Leave a Reply to Treehouse Projects Cancel reply

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