Skip to content

Unable to connect to RDS MariaDB instance - connection hangs/times out

0

I'm unable to connect to my RDS MariaDB instance and need help troubleshooting the connection issue.

Environment:

  • Engine: MariaDB 10.11.15
    
  • Instance Class: db.t3.micro
    
  • Region: eu-west-1
    
  • Publicly Accessible: Yes
    
  • Multi-AZ: Yes
    

Problem: When attempting to connect using MySQL client, the connection just hangs and eventually times out:

mysql -h my-rds-endpoint.eu-west-1.rds.amazonaws.com \
    -u my_username \
    -p

What I've verified:

  • RDS Instance Status: Available and healthy
    
  • Security Groups: Added my public IP to inbound rules for port 3306 (MySQL/Aurora)
    
  • Network ACLs: Default ACL allows all traffic
    
  • VPC: Using default VPC with internet gateway attached
    
  • DNS Resolution: RDS endpoint resolves correctly to AWS IP
    
  • Credentials: Have the correct username and password
    
  • Local firewall: No blocking rules for outbound port 3306
    

Security Group Configuration: The instance has multiple security groups attached. I've verified that at least one security group has an inbound rule allowing TCP port 3306 from my public IP address (X.X.X.X/32).

Goal: I need to perform a one-time mysqldump of a specific table from this database.

Question: What additional troubleshooting steps should I take to diagnose why the connection is hanging? Are there any RDS-specific network diagnostics, CloudWatch logs, or AWS tools I can use to identify the root cause?

asked 25 days ago63 views

2 Answers
0

Based on your description, here are additional troubleshooting steps to diagnose the connection timeout issue:

Security Group Verification: Since you mentioned multiple security groups are attached to your RDS instance, verify that ALL security groups associated with the instance allow inbound traffic on port 3306 from your IP. If any security group has restrictive rules, it can block the connection even if another security group allows it. Check the RDS console to see exactly which security groups are attached and review each one's inbound rules.

Correct Endpoint and Port: Double-check that you're using the correct endpoint from the RDS console. Verify there are no typos in your connection string. Since you mentioned the instance is Multi-AZ, ensure you're connecting to the primary endpoint and not accidentally using an old or incorrect endpoint.

Network Path Testing: Use telnet or nc (netcat) to test basic TCP connectivity to port 3306:

telnet my-rds-endpoint.eu-west-1.rds.amazonaws.com 3306

or

nc -zv my-rds-endpoint.eu-west-1.rds.amazonaws.com 3306

If this times out, it confirms a network-level issue rather than a database authentication problem.

VPC Route Tables: Even though you're using the default VPC with an internet gateway, verify the route table associated with the subnet where your RDS instance resides. Ensure there's a route for 0.0.0.0/0 pointing to the internet gateway (igw-xxxxx).

Subnet Configuration: Confirm that your RDS instance is in a public subnet (one with a route to an internet gateway) if you're connecting from outside AWS. Check the subnet associations in the VPC console.

Corporate/ISP Firewall: Even though you've checked your local firewall, your corporate network or ISP might be blocking outbound connections to port 3306. Try connecting from a different network (such as a mobile hotspot) to rule this out. Alternatively, if your company has firewall rules blocking port 3306, you could recreate the instance using a different port.

CloudWatch Metrics: Check CloudWatch metrics for your RDS instance, particularly DatabaseConnections and FailedSQLServerAgentJobsCount, to see if there are any patterns or errors being logged.

RDS Event Log: Review the RDS Events in the console for your instance to see if there are any system-level issues or maintenance activities that might be affecting connectivity.

Enhanced Monitoring: If not already enabled, consider enabling Enhanced Monitoring for more detailed metrics about the instance's performance and resource utilization.

If these steps don't resolve the issue and the telnet/nc test fails, the problem is likely at the network layer—either with security group configuration, network ACLs, or routing. If the telnet/nc test succeeds but MySQL still times out, the issue may be with database-level configuration or authentication.
Sources
Troubleshooting connections to your MariaDB DB instance - Amazon Relational Database Service
Troubleshooting connections to your MySQL DB instance - Amazon Relational Database Service
Troubleshooting connection issues to your Amazon RDS DB instance - Amazon Relational Database Service

answered 25 days ago

EXPERT

reviewed 25 days ago

0

Most likely cause: The subnet is not configured as a "public subnet."

The "Publicly Accessible = Yes" setting merely determines whether a public DNS name or IP address is assigned to the RDS instance; it does not, on its own, guarantee external reachability. To ensure actual connectivity, the subnets where the RDS instances are deployed (at least two, given the Multi-AZ configuration) must be "public subnets" that have a route to an Internet Gateway.

Official AWS diagnostic tool: VPC Reachability Analyzer

This is precisely the "AWS-specific network diagnostic tool" referred to in your question. By simply specifying the source and destination, this tool automatically identifies which configuration element—such as a route table, security group (SG), or network ACL (NACL)—is causing the connectivity issue.

answered 22 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.