I created an AWS RDS MySQL database instance, tested the connection but keeps failing the connection test "unable to connect to localhost":

mysqlworkbench

That doesn't make sense because I'm not trying the connection to localhost, I'm trying it to the RDS endpoint which I replaced the default localhost with.

My endpoint public accessibility is enabled:

pb

And traffic on the rules is pretty much open:

sg

ob

VPC attributes DNS hostnames and DNS resolution are also enabled by default:

vpc

And since it's a default VPC, all default subnets are public subnets and will have a route to a default gateway (IPv4).

gateway

routes

I also tried this with and without useSSL=0 parameter, since I heard the 8.0.27 MySQL workbench has a bug with SSL. It doesn't seem to be related to this issue though.


Solution 1:

The issue is because an inbound rule has to be created, either on your individual IP, or ALL traffic if you wish to keep it flexible

Create Inbound Security Group: The default VPC security group created will not accept internal (inbound) connections when you try connecting to the endpoint in MySQL client. Therefore, you need to create an inbound security group as well as follows: a. Search and select EC2 service b. By default, you should land on the security group page. You can also navigate to the Security Groups page from the left-hand menu under “Network & Security” c. Click “Create Security Group” d. Fill out the basic details and then create the inbound rules e. Create security group

sg creation

Now associate the created security group with the RDS database instance

Go back/search for RDS service and click on the database instance identifier again and Click Modify Find the “Connectivity” module. a. Deselect the “Default” security group b. Search for and select the security group you created earlier

connectivity

c. Click Continue d. Review the changes in the “Summary of Modifications”, and from “Scheduling of Modifications”, choose “Apply Immediately” and click “Modify DB Instance”