We have a PHP application running in an Azure app. instance and it communicates with a Postgres database hosted in AWS. Very occasionally it is unable to communicate with the database:
[11-Nov-2021 23:16:45 UTC] PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "(removed).ap-southeast-2.rds.amazonaws.com" ((IP address removed)) and accepting
TCP/IP connections on port 5432? in D:\home\site\wwwroot\(removed).php on line 15
The failure previous to that was at 07:57:58. The application is not particularly heavily loaded, servicing one or two requests per second. We discount software as the cause, as it has been unchanged for several months and services 99.99% of requests correctly.
What are feasible causes of failure? Is the database really becoming unavailable? It seems that DNS is not at fault, since the IP address of the database is correctly resolved.