How can I connect, from the terminal, to AWS mysql DB instance

I am using Ubuntu. I deployed an app to AWS beanstalk following the instructions here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_sinatra.html

It’s up, running and viewable. However two major issues seem to be a problem.

  1. During the creation and deployment, on my local terminal, when it came to the “create DB instance” bit I selected “y”. After apparent successful deployment, I did “eb status” and got this for my DB instance (slightly modified below for security purposes):

    RDS Database: AWSEBRDSDatabase | aa1x1c7p9lu9xxt.cpv9i4mprkez.us-west-1.rds.amazonaws.com:3306

First question: which bit is the user, which bit the db name and I assume the password is the one I entered during the deployment process.

How can I connect to this from my terminal? I have tried a number of variations based on:

mysql -h aa1x1c7p9lu9xxt.cpv9i4mprkez.us-west-1.rds.amazonaws.com -u root -p aa1x1c7p9lu9uxt

I get the following error:

ERROR 2003 (HY000): Can't connect to MySQL server on 'aa1x1c7p9lu9xxt.cpv9i4mprkez.us-west-1.rds.amazonaws.com' (110)

What is the correct way to connect from the terminal?

The second issue is slightly more sinister. When I go to my AWS terminal the Elastic Beanstalk section says that I have no environments and no applications despite the fact that the app I deployed is up and running. Secondly, the RDS section says that I have no RDS DB instances.

I am very puzzled to say the least.

All help received gratefully.

Answer

As to the first part of your question, MySQL is unable to connect to the host at all (not even trying to authenticate), which means that you either got the hostname wrong or more probably haven’t allowed remote access to the MySQL.

See this answer for more information on what you need to do.

As to the second part, documentation indicates that you should follow eb init with an eb update to update your environment. Hope that helps.

Leave a Reply

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