Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

VM cannot connect to Cloud SQL

I'm trying to clean up my production infrastructure a bit but i am having possibly the worst time. Services i'm using:

- Cloud SQL
- Compute engine VMs to run my apps containers.

There's some other stuff but doesn't matter for now. I am trying to run two services split across 4 vms (2 each). Currently I am running the services as follows:

Subnet 1:
VM 1: running service 1 & 2
VM 2: running service 1 & 2

What I want to do is:

Subnet 1
VM 1: running service 1
VM 2: running service 1Subnet 2
VM 1: Running service 2
VM 2: Running service 2

However when I try to run service 2 in my new VMs the DB connection keeps timing out. I've spent the last 5-6 hours trying to debug this and it's absolutely crucial to my small business.

What I've done so far:

- Ensure firewall has a rule to allow traffic to db port 5432. 

- Pooled connections are allowed in the app.

- Connection test in cloud sql is passing.

Can someone please advise. I don't know what to do and a lot is on the line rightnow.

0 3 175