Marc
Marc

Reputation: 4851

Connect to RDS from VPS

I am trying to transfer an existing mysql database that is located on my VPS to AWS RDS.

I have RDS set up and I am able to connect to the server just fine by connecting to one of my ec2 instances through ssh and using this command:

mysql -uuser -p -hxx.xx.us-west-2.rds.amazonaws.com

However, when I try to connect from my VPS (through ssh) I receive an ERROR 2003, which I believe is permission denied.

It doesn't seem to matter how I set my security group. I set the inbound to allow port 3306 from my server ip and that did not work, I even tried allowing all traffic on all ports from anywhere on my inbound rules and I still am unable to connect. The outbound has always been completely open.

If anyone can see anything that I am missing I would really appreciate some help.

Thanks.

Upvotes: 2

Views: 953

Answers (2)

George Rushby
George Rushby

Reputation: 1345

Make sure your RDS instance is set to public if you want to access it externally. If in fact it's not publicly accessible then you'll need to recreate your instance and import your data, or take a snapshot and rebuild your RDS instance from the snapshot.

You only have ONE chance to modify it and that is at instance creation.

enter image description here

If you do this then make sure you security group only allows from a specific IP address or if you're using MySQL workbench rather use a SSH tunnel using SSH keys via an EC2 instance.

Upvotes: 3

Ben Whaley
Ben Whaley

Reputation: 34416

Is user a user you created manually in your RDS, or is it the admin user that was created when you created the instance? If the former, then make sure you have granted access to that user from your remote VPS.

Also, from your VPS, make sure you can open a TCP connection to the database. Try:

$ nc -v -z xx.xx.us-west-2.rds.amazonaws.com 3306

If the connection succeeds here but you still can't connect with the mysql CLI, you have a problem with the username/password/database connection info.

Upvotes: 0

Related Questions