---
title: "Private IP connections from Cloud Run to Cloud SQL time out | Proofline"
description: "When Cloud Run times out on a Cloud SQL private IP, compare the revision's VPC egress with the last revision that connected, then test the route."
url: https://proofline.sh/learn/cloud-run-cloud-sql-private-ip-timeout/
---

[Learning center](/learn/)

# Private IP connections from Cloud Run to Cloud SQL time out

When Cloud Run times out on a Cloud SQL private IP, compare the revision's VPC egress with the last revision that connected, then test the route. A difference in network, subnet, connector or egress mode points at the deploy; identical settings that fail for both revisions point at the VPC: its firewall rules, the private services access peering, or the source range the instance accepts.

Network outages The Proofline team November 23, 2026 6 min read

## How the timeout shows up

On this path the code opens a TCP connection to the instance's private IP on port 5432, with no Cloud SQL Auth Proxy in between. [Connect with TCP](https://cloud.google.com/sql/docs/postgres/connect-run#private-ip_1) PostgreSQL's documentation notes that a message such as `Connection timed out` can mean a lack of network connectivity or a firewall blocking the connection; nothing reached a server that could answer. [Server start problems](https://www.postgresql.org/docs/current/server-start.html)

A timeout at stage 1 looks like a timeout at stage 4 to the application, so first confirm the path and rule out the instance itself. [Which path the revision uses](/learn/which-path-cloud-run-uses-to-reach-cloud-sql/) · [The four stages](/learn/cloud-run-cloud-sql-connection-errors/#stage) If `gcloud sql operations list --instance INSTANCE` shows a restart, failover or maintenance in the window, start there instead.

## Check 1: compare the revisions' egress

Cloud Run reaches a VPC network through Direct VPC egress or a Serverless VPC Access connector. The revision stores them as annotations: `run.googleapis.com/network-interfaces` holds the network, subnet and network tags for Direct VPC egress, `run.googleapis.com/vpc-access-connector` names a connector, and `run.googleapis.com/vpc-access-egress` sets `all-traffic` or `private-ranges-only`. [Direct VPC egress](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc) · [Revision template annotations](https://cloud.google.com/run/docs/reference/rest/v1/RevisionTemplate)

```
for r in PREVIOUS_REVISION NEW_REVISION; do
  gcloud run revisions describe "$r" \
    --project PROJECT --region REGION \
    --format='yaml(metadata.name, metadata.annotations)'
done

gcloud sql instances describe INSTANCE --project INSTANCE_PROJECT \
  --format='yaml(ipAddresses, settings.ipConfiguration.privateNetwork)'
```

`privateNetwork` is the VPC network from which the instance is reachable by private IP, and `ipAddresses` lists its `PRIVATE` address. [Instance resource](https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/instances) The egress modes differ in one way that matters here: `private-ranges-only`, the default, sends traffic to RFC 1918 and Private Google Access addresses through the VPC, and `all-traffic` sends everything. [`--vpc-egress`](https://cloud.google.com/sdk/gcloud/reference/run/deploy)

| What differs between the revisions | Reading |
| --- | --- |
| The new revision has no `network-interfaces` and no connector | The deploy removed VPC access. The private IP has no route from this revision |
| Network or subnet differs, or the network is not the instance's `privateNetwork` | The revision sits in a network that does not reach the instance |
| The connector name differs | The new connector may sit in another network, or be unhealthy. Describe both connectors |
| Egress changed, and the instance's private IP is outside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 | Under `private-ranges-only`, traffic to that address may not enter the VPC. Compare with `all-traffic` |
| Nothing differs | Not the revision's network settings. Go to check 2 |

Changing a revision's network or subnet takes a new deployment, so a difference here came from a deploy command, a YAML file or a Terraform template. [IP address allocation](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#direct-vpc-ip-allocation)

## Check 2: test the route with Connectivity Tests

Connectivity Tests simulates a packet's path through your VPC network: it checks the egress firewall rules and routes it can see, and for a Cloud SQL instance in Google's network it reports an overall reachability result for the last step. It supports Cloud SQL destinations that do not use Private Service Connect. [Connectivity Tests overview](https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/concepts/overview)

The following command creates a test resource in the project; it does not touch the service or the instance. For Direct VPC egress, use an address from the revision's subnet as the source, because Cloud Run assigns instance addresses from the subnet and they change. [IP address allocation](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#direct-vpc-ip-allocation)

```
gcloud network-management connectivity-tests create run-to-orders-db \
  --project PROJECT \
  --source-ip-address=ADDRESS_IN_SUBNET \
  --source-network=projects/PROJECT/global/networks/NETWORK \
  --destination-ip-address=INSTANCE_PRIVATE_IP \
  --destination-port=5432 --protocol=TCP
```

For a revision that uses a Serverless VPC Access connector, `--source-cloud-run-revision` takes the revision itself as the source. [`connectivity-tests create`](https://cloud.google.com/sdk/gcloud/reference/network-management/connectivity-tests/create)

| Test result | Reading |
| --- | --- |
| A firewall rule drops the packet | Read that rule: who created or changed it, and whether it applies to the subnet or the revision's network tags |
| No route to the destination | The peering or the route to the private services range is missing. List the network's peerings |
| Reachable | The VPC configuration allows the path. Go to check 3 |

To read the peering, `gcloud compute networks peerings list --network NETWORK` lists the network's peerings; the REST resource carries each peering's `state` and `stateDetails`, and Cloud SQL's troubleshooting guide asks for the peering to be `ACTIVE`. [`peerings list`](https://cloud.google.com/sdk/gcloud/reference/compute/networks/peerings/list) · [Network resource](https://cloud.google.com/compute/docs/reference/rest/v1/networks) · [Cloud SQL troubleshooting](https://cloud.google.com/sql/docs/postgres/troubleshooting)

## Check 3: does the instance accept the source range?

Cloud Run's Direct VPC egress subnet can use RFC 1918 ranges, 100.64.0.0/10 or 240.0.0.0/4. [Supported IPv4 ranges](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#supported-ip-ranges) Cloud SQL authorizes private IP connections from RFC 1918 ranges automatically; a client in any other range must be listed in the instance's authorized networks, and the peering to Cloud SQL must export that subnet's routes, or connect through the Cloud SQL Auth Proxy. [Connect from non-RFC 1918 addresses](https://cloud.google.com/sql/docs/postgres/configure-private-ip#non-rfc1918)

| The revision's subnet range | Reading |
| --- | --- |
| Inside RFC 1918 | Authorized automatically. The cause lies in checks 1 and 2 |
| 100.64.0.0/10 or 240.0.0.0/4, in `authorizedNetworks`, and the peering to Cloud SQL exports these routes | Authorized and routed. Look again at the firewall and the timing |
| 100.64.0.0/10 or 240.0.0.0/4, in `authorizedNetworks`, but the peering does not export non-RFC 1918 routes | The instance has no route back to the revision. Export the subnet's routes on the peering |
| Outside RFC 1918 and not in `authorizedNetworks` | The instance does not accept this source. A move to a new subnet explains why the new revision fails and the old one did not |

## A worked fixture: a new network or a new rule

The fixture is illustrative. The fictional service `orders-api` in `europe-west1` connects to `10.40.0.3:5432`, the private address of `shop-prod:europe-west1:orders-db`, whose `privateNetwork` is `shop-vpc`. `orders-api-00018` takes all traffic at 09:12:30 UTC, and connections time out from 09:12:41.

Outcome A: the deploy moved the revision.

| Revision | `network-interfaces` | Egress | New instance connects? |
| --- | --- | --- | --- |
| `orders-api-00017` | network `shop-vpc`, subnet `run-ew1` | `private-ranges-only` | Yes (09:20:02, tag `prev`) |
| `orders-api-00018` | network `default`, subnet `default` | `private-ranges-only` | No |

`orders-api-00018` was deployed from a YAML file copied from a staging service, and its network is `default`, not the instance's `privateNetwork`. The connectivity test from an address in the `default` subnet to `10.40.0.3:5432` finds no route to the destination. The deploy caused it. Route traffic back to `orders-api-00017`, then fix the network in the YAML file.

**Outcome B: same settings, a new firewall rule.** Both revisions use `run-ew1`, and a fresh instance of `orders-api-00017` started through a tag at 09:16:40 times out too. The connectivity test from `10.8.0.10` to `10.40.0.3:5432` reports that the egress rule `deny-egress-db-ranges` drops the packet. The rule was created at 09:05 UTC. The deploy only coincided with it; a rollback will not help. Fix or scope the rule.

## Where the checks mislead

Connectivity Tests analyzes configuration. It does not track firewall connection state and cannot see inside Google's network for Cloud SQL, so a reachable result leaves the instance's own side unexamined. [Connectivity Tests overview](https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/concepts/overview)

New instances with Direct VPC egress can take a minute or more to establish connections at startup. A slow first connection after a scale-out may be this delay, not a broken route; a timeout shorter than a minute will report it as a failure. [Direct VPC egress limitations](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#limitations)

Direct VPC egress does not support VPC firewall rules logging, so the logs will not show which rule dropped a revision's packets. Use the connectivity test, or the firewall rule's change history. [Direct VPC egress limitations](https://cloud.google.com/run/docs/configuring/vpc-direct-vpc#limitations) For latency through a connector rather than a hard timeout, see [Cloud SQL latency through a VPC connector](/learn/cloud-run-vpc-connector-cloud-sql-latency/).

## Questions

### Why does Cloud Run time out connecting to the Cloud SQL private IP?

The packet does not reach the instance, or the instance does not accept its source. The revision may lack VPC egress or sit in another network, a firewall rule may drop the traffic, the peering may be missing, or the revision's subnet may be outside RFC 1918 without an authorized network.

### Should Cloud Run use all-traffic or private-ranges-only egress to reach Cloud SQL?

Either works for an instance whose private IP is in an RFC 1918 range, since `private-ranges-only` sends those addresses through the VPC. `all-traffic` also routes public destinations through the VPC, which then need a path out, such as a Cloud NAT gateway. [Static outbound IP](https://cloud.google.com/run/docs/configuring/static-outbound-ip)

### Does a private IP timeout mean the Cloud SQL instance is down?

Not by itself. Read the instance's operations for the window. If none overlaps and a fresh instance of the previous revision connects, the new revision's network settings are the likely cause.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Which path does this Cloud Run revision use to reach Cloud SQL?](/learn/which-path-cloud-run-uses-to-reach-cloud-sql/)
    
    Network outages The Proofline team November 23, 2026 6 min read
    
-   ### [Dependency timeouts only from new ECS tasks or Cloud Run revisions](/learn/dependency-timeouts-only-from-new-tasks/)
    
    Network outages The Proofline team November 20, 2026 9 min read
