Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to Amazon RDS MySql remotely

I'm trying to connect to MySql on Amazon RDS from my computer, using MySql WorkBench, or HeidiSql or even the console Mysql.exe and i'm getting this error all the time:

ERROR 2003 (HY000): Can't connect to MySQL server on 'MY-SERVER-NAME' (10060)

  1. In the Security group of the instance I created a new Inbound rule that allows all traffic, and applied it, and still - same error.
  2. I have no active Firewall on my computer, and have good internet access
  3. I am able to access the DB from the Amazon EC3 server, there I am connecting using HeidiSql, and the exact same settings (host, username, password) is just not working on my computer

Still, nothing is working. I'm pretty sure that my security groups is configured to allow outside connections, as can be seen on the next screenshot, there is another place with firewall rules? Screenshot of SecurityGroups

like image 670
Ron Gross Avatar asked Feb 27 '14 20:02

Ron Gross


People also ask

Can I SSH into RDS instance?

After the connection is configured, you can connect to your private RDS DB instance using an SSH tunnel.


2 Answers

I was having the same problem when using an RDS instance on a VPC that I wanted to connect to remotely. To fix the problem, I needed to do the following:

  • Go to the VPC Management Console in AWS
  • Go to Internet Gateways (on the left side)
  • Create and attach an internet gateway to my VPC. Make note of the ID of this gateway.
  • Go to Route Tables
  • Edit the route table associated with the subnets associated with your RDS instance
  • Add a route:
    • Destination: 0.0.0.0/0
    • Target: ID of your Internet Gateway

I didn't have this route in my table because I created my VPC manually and without using the wizard, but if you use the wizard it creates this route for you automatically.

Note: This assumes that your security groups are already configured to allow your IP to connect.

like image 162
Ondrej Balas Avatar answered Sep 29 '22 21:09

Ondrej Balas


The 2003 error is the Access-Denied Error I would be willing to bet that you haven't configured the RDS to accept your IP address.

This can be done by going to DB Security Groups -> Click Default -> and add a new CIDR/IP range. I believe that if you set it to 0.0.0.0/0 it will accept all ip addresses

like image 45
Zach Spencer Avatar answered Sep 29 '22 20:09

Zach Spencer