Connecting to Amazon RDS


When trying to connect to an RDS mysql database the connection always times out, any advice?

Command used to connect is:
mysql -u root -p -h

Thanks in advance.



First, you have to make sure your RDS instance is publicly accessible :

  • In aws console go to your instances list
  • Select modify in the action toggle buton
  • Choose yes for “publicly accessible” parameter in the network & accesibility section
  • Scroll down, check the “apply immediatly” box
  • Validate by clicking on the continue button
  • Wait for your instance to restart

After that you have to grab the public IP of your cloud 9 instance :

  • In cloud 9 IDE, click on window > new terminal
  • Run the following command : dig +short
  • The returned value is the public IP adress of you C9 instance : copy it.

Finaly, you have to authorize your C9 instance to connect to the RDS instance :

  • In AWS console, go to the VPC attached to your RDS instance
  • In the inbound tab, click on add a new rule
  • For the type, choose, mysql/aurora in the dropdown menu
  • Leave other parameters by default, except for the source. The value must be a valide CIDR, so you can enter <ip_adress_of_my_cloud_9_instance>/32 . Of course, do not forget to replace by your real C9 instance IP adress value !!

To check everything is OK, you can go back to the teminal and enter the following command : mysql -h"<my_amazon_endpoint_url>" -u<database_username> -p<password>

Normally you should see the mysql command prompt…

Hope this will help…



Thanks!! they work :slight_smile:


Note that to make this work for real you have to add all the IPs to the whitelist.