I have a VM instance (e2-micro) on GCP running with postgres. I added my own external ip address to pg_hba.conf
so I can connect to the database on my local machine. Next to that I have a nodeJS application which I want to connect to that database. Locally that works, the application can connect to the database on the VM instance. But when I deploy the app to GCP I get a 500 Server Error when I try to visit the page in the browser.
These are the things I already did/tried:
- Created a Firewall rule to allow connections on my own external ip address
- Created a VPC connector and added that connector to my
app.yaml
- Made sure everything is in the same project and region (europe-west1)
If I allow all ip addresses on my VM instance with 0.0.0.0/0
then App Engine can connect, so my guess is that I'm doing something wrong the connector? I use 10.8.0.0/28
as ip range while the internal ip address of the VM instance is 10.132.0.2
, is that an issue? I tried an ip range with 10.0.0.0
but that also didn't work.