Andrew
Andrew

Reputation: 20091

Amazon RDS db connects locally but not on production

I was able to connect to the amazon rds aurora database locally, and run queries.

But on production EC2 server, the connection returns 500 server error "SQLSTATE[HY000] [2002] Connection timed out".

How could it be working locally but not on production?

Upvotes: 0

Views: 585

Answers (2)

Andrew
Andrew

Reputation: 20091

It was a security group issue.

The default rds-setup-wizard security group was applied to my database instance, and this gave me local access. I guess it had my ip address or similar as an inbound rule.

I had to add a new security group and add that new group to the database instance.

My new security group needed an inbound rule that looked like this:

Type: MYSQL/Aurora
Protocol: TCP
Port Range: 3306
Source: my EC2's private ipv4 address with /32. Eg: 13.14.15.16/32

Upvotes: 0

Nitin Goura
Nitin Goura

Reputation: 11

Can you check your production server security group outbound rules. if it is connecting from local and not connecting from production machine , so should be some outbound traffic timeout.

Upvotes: 1

Related Questions