Connection to RDS lost from AWS ec2-bitnami lamp stack-php_network_getaddresses: getaddrinfo failed: Name or service not known

Using LAMP latest 7.0.23-0 instace that i created in the last 3 days are not able to connect to RDS instance on AWS.

However i also have another bitnami LAMP stack 5.6* that connects with the RDS without any issues.
above isntances are using Bitnami’s Ubuntu.

To try the same from local i downloaded Wamp 7.X (not LAMP) and i could still conenct to the RDS from my local.

Whats going on? is there a problem with the permissions ?i have give very liberal permissions for testing and i do not think ths is an issue
is there any issue in the latest LAMP ? i see some threads related to this error

I am trying to connect to RDS in my php code using mysqli

$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME ) or Die (‘Error connecting to the database:’.mysqli_error());

Error message i get-

php_network_getaddresses: getaddrinfo failed: Name or service not known

Hi @sanjaykattimani,

Could you please check if there is any firewall rule that blocks the connection from your LAMP instance? Please note that our AMP 7.0.x includes MySQL 5.7 and the 5.6 ones include MySQL 5.6.

Could you please try access the remote database by using the command line utility from the LAMP instance?

I hope that helps.

Thanks for the response. Yes as you mentioned something is blocking my EC2 instance from accessing the RDS. I looked up further and someone mentioned that i should be able to ping or dig the RDS server from my ec2 instance. This is not working from the instance. Not able to figure out whats wrong. I have checked the inbound and outbound permissions on security groups of RDS and ec2 instances and they are all same.

Hi @sanjaykattimani
The resources may be in different VPC’s so they are not able to reach each other.

If you cannot reach your RDS server from your Lamp server by using ping or dig, then it is an issue at network level, not related with applications nor Bitnami.

In that case I suggest to contact directly AWS support.


Hi @sanjaykattimani , @jota

We are getting similar error starting yesterday where our bitnami hosted application is not able to access the database hosted on AWS RDS? Since your post/issue looks similar , curious if you can suggest anything to fix it?

Could you access the database previously? If that’s the case, please ensure there is not any problem in the database itself. You can contact the AWS team to get more information.