skip to Main Content

I have Aws EC2 (Nginx Debian) and RDS, with a simple php script

if ($mysqli_connection->connect_error) {
   echo "Not connected, error: " . $mysqli_connection->connect_error;
}
else {
   echo "Connected.";
}

sometimes get this error:

Not connected, error: php_network_getaddresses: getaddrinfo failed: Name or service not known

I have already reboot EC2, but the error still appears.

2

Answers


  1. Have you checked the security group of the attached to RDS? Make sure the EC2 is visible in inbound rules and outbound rules.

    Login or Signup to reply.
  2. According to this response the problem may be with DNS rate-limiting.

    I would suggest trying a DNS cache, like dnsmasq, to reduce the number of requests.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search