Stuck with AWS MySQL error 10060? We can help you.
It is possible for a MySQL client to come across this error while trying to MySQL server over AWS cloud.
As part of our AWS Support Services, we assist our customers with several AWS queries.
Today, let us see how to fix the error “RDS: ERROR 2003 (HY000): Can’t connect to MySQL server (10060)”.
AWS MySQL error 10060
The error message MySQL server sends back is:
“RDS: ERROR 2003 (HY000): Can’t connect to MySQL server (10060)”.
It states that the inbound/outbound traffic from the AWS instance is not reachable to the current host where we run the MySQL client.
So we need to register the public IP address in the RDS security groups to get access over the RDS MySQL instance.
Configure public IP address in security groups
Moving ahead let us see a few steps and screenshots to fix the error.
- First and foremost we need to find the public IP address for the host machine where we run mysql-client.
- Here, we go to the security groups and add the public IP address for inbound traffic
- Then we add the same entry for outbound traffic by AWS services.
- Once done, we refresh the security groups and test the connection from any mysql-client.
For example, to test the connection we run the below command from any terminal where MySQL is configured:
mysql -h host-public-ip/DNS -P 3306 -u username -p password
Network ACLs
Network ACLs act as a firewall for resources in a specific subnet in a VPC. If we have ACLs, we ensure they have rules that allow all traffic to and from the DB instance.
Create a network ACL
We can create a custom network ACL. By default, a network ACL that we create blocks all traffic until we add rules.
- Initially, we open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, we choose Network ACLs.
- Then we choose Create Network ACL.
- In the Create Network ACL dialog box, optionally name the network ACL, and select the ID of the VPC from the VPC list.
- Then we choose Yes > Create.
Add and delete rules from a network ACL
If we add or delete a rule from an ACL, any subnets that associate with it are subject to change. We don’t have to terminate and relaunch the instances in the subnet. The changes take effect after a short period.
On the other hand, if we use the Amazon EC2 API or a command-line tool, we can’t modify rules. Here, we can only add and delete rules.
With the Amazon VPC console, we can modify the entries for existing rules. On our behalf, the console removes the existing rule and adds a new rule.
In order to change a rule in the ACL, we must add a new rule with the new rule number, and then delete the original rule.
-
Add rules:
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, we choose Network ACLs.
- Then in the details pane, we choose either the Inbound Rules or Outbound Rules, then choose Edit.
- In Rule #, we enter a rule number (for example, 100). The rule number must not already be in use in the network ACL.
Our Support Techs recommend leaving gaps between the rule numbers because it makes it easier to add a new rule without having to renumber the existing rules. - We select a rule from the Type list. For example, to add a rule for HTTP, choose HTTP. To use a protocol, not on the list, we choose Custom Protocol Rule.
- In case of a custom protocol rule, select the protocol’s number and name from the Protocol list.
- Then in the Source or Destination field, we enter the CIDR range that the rule applies to.
- From the Allow/Deny list, we select ALLOW to allow traffic or DENY to deny traffic.
- In case we want to add another rule, we select Add another rule and repeat steps 4 to 9 as required.
- Once done, choose Save.
-
Delete a rule:
- We open the Amazon VPC console at https://console.aws.amazon.com/vpc/.
- In the navigation pane, we choose Network ACLs and select the network ACL.
- In the details pane, select either the Inbound Rules or Outbound Rules tab, and then choose Edit.
- We can select Remove for the rule we want to delete, and then Save.
[Need help with any of the above? Feel free to contact us]
Conclusion
In short, we saw how our Support Techs go about AWS MySQL error 10060.
I got stuck when connecting to AWS EC2 instance from my windows desktop
C:\Users\npk61\Downloads>ssh -vvv -i “clouddemo.pem” ec2-user@ec2-3-111-36-125.ap-south-1.compute.amazonaws.com
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2
debug1: Reading configuration data C:\\Users\\npk61/.ssh/config
debug1: Reading configuration data __PROGRAMDATA__\\ssh/ssh_config
debug3: expanded UserKnownHostsFile ‘~/.ssh/known_hosts’ -> ‘C:\\Users\\npk61/.ssh/known_hosts’
debug3: expanded UserKnownHostsFile ‘~/.ssh/known_hosts2’ -> ‘C:\\Users\\npk61/.ssh/known_hosts2’
debug2: resolving “ec2-3-111-36-125.ap-south-1.compute.amazonaws.com” port 22
debug3: resolve_host: lookup ec2-3-111-36-125.ap-south-1.compute.amazonaws.com:22
debug3: ssh_connect_direct: entering
debug1: Connecting to ec2-3-111-36-125.ap-south-1.compute.amazonaws.com [3.111.36.125] port 22.
debug3: finish_connect – ERROR: async io completed with error: 10060, io:000001A505B58E00
debug1: connect to address 3.111.36.125 port 22: Connection timed out
ssh: connect to host ec2-3-111-36-125.ap-south-1.compute.amazonaws.com port 22: Connection timed out
Hello,
Please contact our support team via live chat(click on the icon at right-bottom).