Skip to content
Go back

GCP Networking Pattern Cheat Sheet

Edit Page

All kinds of network connectivity.

Read The Docs

https://docs.cloud.google.com/architecture/landing-zones
https://docs.cloud.google.com/architecture/landing-zones/decide-network-design
https://docs.cloud.google.com/architecture/best-practices-vpc-design

alt text

1. GCP resource → Public Internet

SituationWhat to use
VM has an external IPWorks directly
VM has no external IPCloud NAT needs a Cloud Router too, just as a config holder
Serverless (Cloud Run / Cloud Functions) default egressWorks out of the box
Serverless requiring a static/fixed egress IPDirect VPC Egress (or less preferred Serverless VPC Access connector) routed to a subnet with Cloud NAT

Old App Engine uses Serverless VPC Access.

2. GCP resource → Google APIs

SituationWhat to use
VM has an external IPWorks by default
VM has no external IPEnable Private Google Access on the subnet
Serverless calling Google APIsWorks by default
Need strong data-exfiltration protection (security boundary)VPC Service Controls + Private Google Access
Need to reach a 3rd-party SaaS or expose your own service privatelyPrivate Service Connect (PSC)

3. Serverless → VPC resources

Including on-prem resources.

SituationWhat to use
App Engine / Cloud Functions / Cloud Run needs to reach a VM, Memorystore, or an on-prem database through an existing VPN tunnelDirect VPC Egress preferred. Or Serverless VPC Access connector
Note

Serverless products do not live inside your VPC by default. The connector is the “bridge” that lets them send traffic into your VPC.

4. GCP ↔ On-premises

SituationWhat to use
Low/medium bandwidth, OK to go over a tunnel, lower costCloud VPN use Cloud Router with BGP for dynamic routing, or static routes
High bandwidth, low latency, production-critical trafficDedicated Interconnect direct physical link to Google
Want interconnect-level quality, but don’t want to build your own physical linkPartner Interconnect through a service provider

5. VPC ↔ VPC

SituationWhat to use
A few VPCs, each team wants to keep managing their own VPC independentlyVPC Peering (note: not transitive, and subnets must not overlap)
Many projects should share one network, with centralized IP/subnet/firewall managementShared VPC one host project + many service projects
Many VPCs + many on-prem sites, large mesh-style topologyNetwork Connectivity Center (hub-and-spoke model)
One single instance must belong to multiple separate VPCs at the same timeMultiple NICs
Note

Shared VPC is generally the best practice for enterprise environments within a single organization. Use VPC Peering or PSC when crossing organization boundaries.

6. Internet users → service deployed on GCP

SituationWhat to use
Public web app, need global reach, CDN, WAF, SSLExternal Application Load Balancer (ALB) + Cloud CDN + Cloud Armor
Non-HTTP protocols, gaming, raw TCP/UDP, or preserving client source IPExternal Network Load Balancer (NLB) (Passthrough)
Non-HTTP (TCP/SSL only) needing Global Anycast IP, TLS termination, or Cloud ArmorExternal Proxy NLB
Only internal/VPN users should reach the service, not the public internetInternal Load Balancer ALB or NLB

7. Google-managed services that need a private IP

SituationWhat to use
Cloud SQL, Memorystore, etc. need a private IP address inside your VPCPrivate Services Access (based on VPC Peering) or Private Service Connect

You will notice it creates a new VPC Network Peering.

Quick memorization tips


Edit Page
Share this post on:

Next Post
GCP Pub/Sub Exactly-Once Delivery Latency Experiment