简体   繁体   中英

How can access AWS RDS by CLI / PUTTY?

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

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

  1. Visit https://console.aws.amazon.com/ec2/home#s=SecurityGroups and create a new security group.
  2. Switch to the inbound tab and choose MYSQL from the dropdown.
  3. 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.
  4. Click the apply rule changes button

Assign the security group to your RDS

  1. Visit https://console.aws.amazon.com/rds/home#dbinstances : and select your RDS instance and under the Instance Actions menu select Modify
  2. Change the RDS security group to the one you just created
  3. Make sure to select the Apply immediately option at the bottom of this page
  4. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM