5
votes

Am following this tutorial http://thoughtsandideas.wordpress.com/2012/05/17/monitoring-and-managing-amazon-rds-databases-using-mysql-workbench/

I am not able to Test DB Connection while creating new server instance to connect to the RDS database. It says Bad_Authentication[allowed_types=public_key], i have a tried different .pem files and have done through a lot of forums. I have also allowed access to my IP in the DB SecurityGroups for RDS and the Security Groups for EC2.

Please help me out. Thanks.

7
RDS doesn't use a public key. Are you trying to connect via SSH?datasage

7 Answers

31
votes

This worked for me. Assuming you have logged into AWS:

  1. Go to RDS -> Databases -> Select your database

enter image description here

  1. Make sure the Public Accessibility value is Yes enter image description here

  2. Check your IP address using http://checkip.amazonaws.com/. If it is not added to the Security Rule Groups, you should add it. this step is crucial

3.1. Click on the rule name. This will open up a new tab, then click in the name of the rule.

enter image description here

3.2. Click on Edit inbound rules

enter image description here

3.3. Click on Add new rule, and add a rule with the following values:

Type: MYSQL/Aurora.

Protocol: TCP (default)

Port range: 3306 (default)

Source: My IP -> This will be the IP Address you got at http://checkip.amazonaws.com/.

enter image description here

  1. Fill information in MySQL Workbench

enter image description here

Hostname: Use the value you have for Endpoint at Connectivity and Security

Port: Use the value you have for Port at Connectivity and Security, by default it is 3306.

Username: Use the value you have for master username at Configuration

Password: Use the value you set when you created the database instance.

If you forgot the password, you can change it by clicking on Modify in your database instance)

enter image description here enter image description here

I hope this also helps you.

1
votes

For RDS no need to use ssh. You can directly connect the RDS with MySql workbench. Follow the following steps-

Make sure that in Security Group you should have provide access for MYSQL

  1. Open MySQL workbench and setup New Connection.
  2. Provide a Connection Name.
  3. Connection Method is set to Standard (TCP/IP)
  4. In the HostName provide your RDS end point
  5. Port is 3306
  6. Enter the username what you have given in the RDS.
  7. Test Connection, and provide the password. That's it. For Reference GoTo This Link
1
votes

If you are not using EC2 Instance to connect with RDS DB Instance then DB Instance should have public access to connect.

  1. While launching DB Instance you need to set Publicly Accessible to yes. You will get Public IP to connect from outside network. That means outside of VPC.
  2. You need to launch DB Instance in Public Subnet which has directly access to Internet. To check Subnet has Internet access, you need to check Route Table which was attached with the subnet. In Route table, check Internet Gateway is attached to the subnet.
  3. You don't need to SSH into DB Instance. Though the option is not available also.
  4. In MySQL WorkBench, click on Setup New Connection.
  5. Give connection name. Choose Standard (TCP/IP) option. You are not trying to connect DB Instance over EC2 Instance so the option with SSH with not work out in this case. You have to provide MySQL hostname, username, password and port.
  6. To verify connection, click on Test Connection button.

If you want to use EC2 Instance and connect DB Instance over EC2 Instance, you have to use Standard (TCP/IP) over SSH option. Check the following link What would prevent me from connecting to a MySQL server on AWS RDS from an AWS EC2 VM?

1
votes

I had the same issue. I think you need to enable inbound traffic to the VPC. Follow the below article and you'll be fine. Default VPC is not allowing users to access 3306 by default and you need to allow traffic.

RDS and MySQL Connectivity

enter image description here

1
votes

Make sure Public accessibility should be yes.

Also, Inside security Group section, click on the security link and then add a new rule under inbound rule section which will whitelist your IP address with the below data :

Type: MYSQL/Aurora.

Protocol: TCP (default)

Port range: 3306 (default)

Source: My IP -> This will be the IP Address you got at http://checkip.amazonaws.com/.

Hope this will help to connect with AWS RDS successfully. Thanks!

0
votes

Based on the details in your question, it seems that you are trying to SSH into the RDS instance. This is not supported on RDS, it only works for EC2 based MySQL servers.

You should instead connect directly to the MySQL server, on port 3306 (or the one you set manually, if this is the case) and using the username and password you created when provisioning the RDS instance. This means using the Connection Type "Standard TCP/IP" in WB.

Also, the public IP address of the machine you're using MySQL Workbench on should be allowed in the RDS security group.

0
votes

Even I had the same issue, like after trying all the things out there. A thing worked is modifying the RDS database and making it publically accessible. That sorted things out.