'PG bouncer running on vm instance stops connecting to cloud sql

The issue:

I'm not sure how to begin problem solving this or where to look for errors.

Setup: Running a node.js backend via GCR and it's hitting a postgres db on cloud sql through a GCE vm with pg bouncer to handle connection pooling.

Every once in a while, I’ll get hit with a ‘unable to reach the db’ error. It happens once every 1-2 months and I’m not sure what’s causing it.

When it does happen, I have to re-terraform the pgbouncer vm to be able to connect to my db again.

I used this terraform module: cloud-sql-pgbouncer



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source