ACD
ACD

Reputation: 1431

AWS EC2 suddenly cannot connect to RDS?

Suddenly, wordpress cannot connect to my RDS. all configurations and inbound/outbound rules are correct. I also tried creating basic php function to connect.. I tried it on my local machine and it's working but not on my EC2 server.

$mysqli_connection = new MySQLi('xxxx.xxxxx.ap-southeast-1.rds.amazonaws.com', 'db_user', 'db_pass', 'db_name');
if ($mysqli_connection->connect_error) {
   echo "Not connected, error: " . $mysqli_connection->connect_error;
}
else {
   echo "Connected.";
}

Error: php_network_getaddresses: getaddrinfo failed: Name or service not known

Just this morning this happened, I didn't do anything at all. Maybe this is an Apache error or something? any help please?

Upvotes: 0

Views: 942

Answers (1)

ACD
ACD

Reputation: 1431

To those who might be facing the same issue. Rebooting the EC2 instance fixed the problem.

Also, check if your volume is not full. run df -a in your ec2 through ssh to check

Upvotes: 1

Related Questions