Lightsail instance connection to Lightsail managed database is unreliable

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Other

bnsupport ID: 857d145e-5210-d6b9-a4bf-b28756348379

bndiagnostic output:

? Apache: Found possible issues
? Resources: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/bch/apps/moodle/troubleshooting/deny-connections-bots-apache/

bndiagnostic failure reason: The suggested guides are not related with my issue

Description:
I have a web app running on Lightsail instances (1GB RAM) stacked with LAMP (PHP 7/MariaDB 10 service). When I want to connect the instances to a Lightsail database instead of localhost, it works sporadically. The front end reads “cannot connect to MySQL database” and in the database server log I read : [MY-010055] [Server] IP address ‘xxx.xxx.xxx.xxx’ could not be resolved: Name or service not known" where the IP is the private IP address of my instance.

My instances and database are in the same region. Even though it is not necessary I have tried enabling VPC peering and opening the db to the public.

I can connect to the database using the command line tool: mysql -u uuuu -p -h hhhhh (ie: it is not a problem with entering the wrong credentials)

The web app seems to work with the dedicated Lightsail db server when I am the only one using it and until I open it to more traffic, then I get the connection error.

I have increased the number of max_connections from 65 to 500 using the aws CLI (localhost is 150). My current traffic is 2000 visitors per day.

aws lightsail update-relational-database-parameters --relational-database-name Database-1 --parameters “parameterName=max_connections,parameterValue=500,applyMethod=immediate”

Localhost is Mariadb 10, dedicated database server is MySQL 8

SSL is handled by Cloudflare. There’s no SSL on my instance.

I don’t want to keep using localhost dbs, I want to centralize my data in a dedicated database.

Thank you for your help.

Hello @jeffbond,

The team is checking and will reply as soon as possible.

Regards

Hello @davidg,

Thank you for that, I appreciate. I have created a Mariadb database on AWS using their RDS service. I connected it to my Lightsail instances after enabling VPC peering and whitelisting their IPs: everything is working fine now. Subsequently I have deleted my Lightsail db.

I still don’t have a technical explanation for why the Lightsail database connection was behaving as I described. Although my problem is solved I think it is useful to investigate as my setup was very standard and as such I can imagine other users will experience similar issues.

All the best.

Thanks for letting us know @jeffbond,

We are glad everything is working for you know. Anyway, the team will take a look at this in order to detect possible issues.

Regards