(2003, "Can't connect to MySQL server on 'xxxxxxxxxxx.ap-south-1.rds.amazonaws.com' (timed out)") from python program

0

When attempting to connect to my database instance using a Python program on my local computer, I encounter a timeout issue. Even though I have configured inbound rules in my security group to allow public access on the MySQL/Aurora port, the connection still times out.

However, when I modify the inbound rules of the security group associated with an EC2 instance, I am able to successfully connect to the MySQL database using that EC2-instance-connect. This issue has been challenging to resolve, please help me to resolve this issue.

2 Answers
1
Accepted Answer

Hello.

Is public access to RDS enabled?
If RDS is running on a private subnet, access will fail even if you enable public access.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/infrastructure-security.html

Also, is there a route destined for the Internet gateway added to the route table of the subnet running RDS?

For other reasons, please also check the network ACL of the security group or subnet.

It is not very good to place the database on a subnet that can be accessed by the public, so please also consider using the port forward function as described in the following document.
https://aws.amazon.com/jp/blogs/mt/use-port-forwarding-in-aws-systems-manager-session-manager-to-connect-to-remote-hosts/

profile picture
EXPERT
answered 8 months ago
  • I had tried making it public then also it was timin-out. What i have figured out is that, the network to which i was connected was blocking me.

  • One more question.... how to know whether my RDS is running on private subnet or not? Although I have subnet configured to default settings only.

0

Issue is resolved !!

Ensure that your network firewall or the local computer's firewall are not blocking traffic on port 3306. In my case, I was using institute's wifi which was blocking the port use.

Upvote it ** :)**

AV
answered 8 months 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.

Guidelines for Answering Questions