If you’re experiencing a connection timeout when trying to access your RDS database, here are some simple steps to help fix the issue.
First, check the security groups attached to your RDS instance. Make sure all security groups allow incoming traffic on port 3306 from your IP address. If any group has rules that block this traffic, your connection won’t go through. Use the RDS console to see which security groups are linked and review their inbound rules.
Next, confirm that you are using the correct endpoint from the RDS console. Double-check for typos in your connection string, and ensure you’re connecting to the primary endpoint if your setup is Multi-AZ. Using an outdated or wrong endpoint can cause connection problems.
You can also test the network connection directly using tools like telnet or netcat (nc). Open your command prompt or terminal and run:
telnet your-rds-endpoint.us-west-2.rds.amazonaws.com 3306
or
nc -zv your-rds-endpoint.us-west-2.rds.amazonaws.com 3306
If these commands time out, it indicates a network issue rather than a database problem.
Then, look into your VPC route tables. Make sure there’s a route for 0.0.0.0/0 pointing to the internet gateway. Even if you’re in a default VPC, it’s good to double-check that the route exists for proper internet access.
Next, verify whether your RDS instance is in a public subnet—meaning it has a route to the internet gateway—especially if you’re connecting from outside AWS. You can check the subnet settings in the VPC console.
Also, consider whether firewalls or restrictions on your local network or internet service provider might block outbound connections to port 3306. Try connecting from a different network, such as a mobile hotspot, to see if that helps. If your workplace firewall is blocking this port, you might need to set up the RDS instance on a different port.
You should review CloudWatch metrics for your RDS instance. Key metrics like DatabaseConnections and FailedSQLServerAgentJobsCount can show if there are ongoing issues or patterns to why you’re experiencing timeout errors.
Don’t forget to look at the RDS event logs. They can help identify if recent system updates, maintenance, or errors could be affecting connectivity.
Lastly, if you haven’t already, consider enabling Enhanced Monitoring. This gives you detailed insights into the performance and resource use of your database, which can help pinpoint issues.
If after all these steps, your network tools (telnet or nc) still can’t connect, the problem is likely at the network level—such as security group settings, network ACLs, or routing issues. On the other hand, if your network test succeeds but the database still times out, look into the database configuration and authentication settings.
These troubleshooting tips should help you identify and fix the connection timeout problem. If issues persist, more in-depth network or AWS support might be necessary.
