Ubuntu – EC2 Ubuntu with WordPress can’t connect to RDS

amazon ec2amazon-rdsamazon-web-servicesUbuntuubuntu-12.04

I have set up a WordPress website on a Ubuntu 12.04 Amazon ec2 machine by following this tutorial except the fact that I haven't created a MySQL database and I am using an amazon RDS MySQL service.

Everything works fine and I am able to create a configuration file during installation but when the installer asks for MySQL credentials. When I fill in the RDS credentials they don't work.
I even tried entering the credentials manually in the wp-confiq file and still it said it couldn't connect to the database .

I tried to test out the same credentials on another WordPress installation in a shared hosting environment and the result was the same.

Then on the ec2 WordPress server I installed MySQL and then provided the MySQL details during installation and everything worked fine hence proving its something to do with RDS only.

Additional Details:

  1. The DB security Group has only one security: the EC2 Security Group

  2. Both EC2 and RDS are located in AWS singapore southeast-1a regions

  3. EC2 Security: only port 22 (ssh) and 80 (http) opened

Best Answer

Check that you can connect to the instance with the command line. See instructions here:

http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToInstance.html

Maybe you have a problem with the credentials or with the network. Once you find the root cause it is easier to solve it.