How can access AWS RDS by CLI / PUTTY?

amazon-web-services

Solution

RDS is not available to the world by default. It's also generally a bad idea to allow access to the RDS from anywhere except from inside your VPC. I recommend you do the following:

Create a security group that allows access to the RDS over port 3306 from your EC2 instance

- Visit https://console.aws.amazon.com/ec2/home#s=SecurityGroups and create a new security group.

- Switch to the inbound tab and choose MYSQL from the dropdown.

- Erase the 0.0.0.0/0 in the source field then click the input field. It will present you with a list of existing security groups. Choose the one that your EC2 instance belongs to.

- Click the apply rule changes button

Assign the security group to your RDS

- Visit https://console.aws.amazon.com/rds/home#dbinstances: and select your RDS instance and under the Instance Actions menu select Modify

- Change the RDS security group to the one you just created

- Make sure to select the Apply immediately option at the bottom of this page

- Click Continue and apply the new changes. (the change can sometimes take a couple of minutes)

SSH into your EC2 instance then run the mysql command in your question

Problem

I am new to AWS , I can access EC2 user by putty. Like this how can i connect AWS RDS by PUTTY ? I have AWS RDS Endpoint , If i try like the below ``` mysql -h testing.cx2wamr3cbzm.us-west-2.rds.amazonaws.com -P 3306 -u Username -p ``` I am getting some error like ERROR 2003 (HY000): Can't connect to MySQL server on 'testing.cx2wamr3cbzm.us-west-2.rds.amazonaws.com' (110) I think there is a problem with security group.I searched more, but its difficult to understand for me. I want to create database and assign rights ? Thanks

Original source