Sameera
Sameera

Reputation: 304

Unable to connect to Amazon RDS from EC2 Wordpress during setup

I have setup an RDS MySQL instance on Amazon RDS which will be accessed through EC2. When I enter my database details to WordPress setup and proceed with the installation, it returns with an error saying "Error establishing a database connection".

I thought this is because the Security Group of the database instance is not allowing the inbound traffic for EC2. Then I added the Security Group of my EC2 instance to the inbound rules of RDS instance's Security Group. Still the same issue.

Allowing All traffic also did not resolve the problem.

Although I found some people have encountered with similar problems, I could not resolve this problem with the suggested answers.

Error message

I appreciate if someone could help me to resolve this.

Upvotes: 0

Views: 328

Answers (1)

Jonathan Jacobson
Jonathan Jacobson

Reputation: 1518

This could result from so many reasons. It would be hard to give you a short answer.

First of all, did you check that the username and password are correct? Can you connect from elsewhere?

Secondly, security groups are not always enough. There could be a problem with network routing or ACLs. In order to verify that there is indeed connectivity between your EC2 instance and the RDS instance, run this from the EC2 instance:

nc -vz RDS_HOSTNAME 5432

Where RDS_HOSTNAME is the RDS instance endpoint. You should receive a message that the connection was successful.

Upvotes: 2

Related Questions