Alex
Alex

Reputation: 7521

Cannot connect to RDS by ssh

I created the RDS basically following the terraform example: https://www.terraform.io/intro/examples/index.html

I used existent VPC and when I create an instance in this VPC I can ssh using the SSH key file - cloudeng.pem

The MySQL terraform created the RDS with the endpoint demo-rds.abc.us-east-1.rds.amazonaws.com.

So, I am trying to set the connection by MySQL workbench.

Workbench requires the following:

SSH Hostname:  not sure how to set, tried `172.31.96.233` from ping `endpoint dmo-rds.abc.us-east-1.rds.amazonaws.com`

SSH Username: ec2-user 

SSH Key file – cloudeng.pem

MySQL Hostname: endpoint dbmonitor-rds.cmufislueksi.us-east-1.rds.amazonaws.com

MySQL  Server port: 3306

Username: dbmonitor_user

Password: password

I am getting Tunnel Connection Error

Upvotes: 0

Views: 2292

Answers (2)

Adiii
Adiii

Reputation: 60084

I understand you question correctly you are trying to connect with RDS using SSH tunnel.

  • You need EC2 instance for tunnelling that is accessible from your machine and you able to ssh to EC2
  • EC2 able to communicate with RDS mean both should in same VPC

Before connecting to Workbench ssh tunnel I will recommend verifying SSH connection from the command line as it will give you more debug log.

ssh -i mykey.pem ec2-user@EC2_IP

Once you able to SSH to ec2 instance then you are good to go with MySQL workbench.

enter image description here

Upvotes: 2

Marcin
Marcin

Reputation: 238747

I wish to ssh into the RDS

You can't SSH into RDS. AWS manages RDS instances and does not allow access to them, except for connecting to the database endpoint.

However, you can establish ssh tunnel from your instance to the endpoint, not ssh from inside of the RDS instance:

Upvotes: 2

Related Questions