VPC Networks, Firewall Rules, and Load Balancing on Google Cloud
A VPC network on Google Cloud is a global, software-defined network whose subnets are regional, whose traffic is filtered by firewall rules and Cloud NGFW policies, and whose applications are exposed through Cloud Load Balancing. That one sentence anchors most networking questions on the Associate Cloud Engineer exam. In this lesson you will plan and create a custom mode VPC with subnets, share networks across projects with Shared VPC, connect networks with VPC Network Peering, and write ingress and egress rules using actions, sources, destinations, targets, protocols, and ports. You will then connect to on-premises environments with Cloud VPN or Cloud Interconnect, choose the right load balancer along the global-versus-regional, external-versus-internal, and Application-versus-Network axes, and decide between Premium and Standard Network Service Tiers. Expect scenario questions that hand you requirements and ask which combination of these building blocks fits.
On this page8 sections
- How VPC networks and subnets work
- Shared VPC and VPC Network Peering
- VPC firewall rules: ingress and egress attributes
- Cloud NGFW policies, secure Tags, and service accounts
- Establishing connectivity: Cloud VPN, peering, and Cloud Interconnect
- Choosing and deploying load balancers
- Network Service Tiers: Premium vs Standard
- Scenario: networking for a global retail platform
- Create a custom mode VPC with regional subnets using gcloud
- Decide between Shared VPC and VPC Network Peering for multi-project designs
- Configure VPC firewall rules and Cloud NGFW policies with ingress and egress attributes
- Apply secure Tags and service accounts in Cloud NGFW policy rules
- Choose between Cloud VPN, VPC Network Peering, and Cloud Interconnect for connectivity
- Select the right Cloud Load Balancing product and Network Service Tier for a workload
How VPC networks and subnets work
A VPC network is a global resource, while each of its subnets is a regional resource — this inversion of most on-premises models is the single most tested VPC fact. One VPC can contain subnets in every Google Cloud region, and instances in different regions on the same VPC communicate over internal IPs across Google's private backbone without any gateways or extra configuration.
VPCs come in two subnet modes. An auto mode VPC automatically creates one subnet per region from a predefined IP range, and new subnets appear as Google opens new regions. A custom mode VPC starts with no subnets; you create each one deliberately, choosing its region and its primary IPv4 range. Production guidance is clear: use custom mode. Auto mode ranges overlap with every other auto mode network, which blocks future VPC Network Peering and hybrid connectivity, and you cannot control where subnets exist. You can convert an auto mode VPC to custom mode, but never the reverse.
Creating a custom mode network and a subnet looks like this:
gcloud compute networks create prod-vpc --subnet-mode=custom
gcloud compute networks subnets create web-subnet \
--network=prod-vpc --region=us-central1 \
--range=10.10.0.0/24Two planning details matter. First, you can expand a subnet's primary range without downtime, but you cannot shrink it — so leave growth room without being wasteful. Second, subnets can carry secondary ranges, which GKE uses for Pod and Service IPs; if GKE is in your design, plan those ranges up front.
VPC firewall rules: ingress and egress attributes
VPC firewall rules filter connections to and from workloads, and every rule is defined by the same set of attributes: a direction (ingress or egress), an action (allow or deny), a priority (0 to 65535, where a lower number wins), a source (for ingress) or destination (for egress), a set of targets the rule applies to, and the protocols and ports it matches. Rules are stateful: if a connection is allowed in one direction, its return traffic is automatically allowed.
Every VPC ships with two implied rules you cannot delete: allow all egress, and deny all ingress, both at the lowest priority (65535). So instances can reach out by default, but nothing can reach in until you write an allow rule. The default network additionally pre-populates permissive rules such as allow-internal and allow-ssh — convenient for experiments, another reason production uses custom mode networks where you author every rule.
Ingress sources can be IP ranges, source tags, or source service accounts; targets can be all instances in the network, instances with a target tag, or instances running as a target service account. A classic pattern:
gcloud compute firewall-rules create allow-web-ingress \
--network=prod-vpc --direction=INGRESS --action=ALLOW \
--rules=tcp:443 --source-ranges=0.0.0.0/0 \
--target-tags=web-serverTo troubleshoot or audit, enable Firewall Rules Logging on a rule and inspect matches in Cloud Logging. When a question says traffic is unexpectedly blocked, check rule priority first — a high-priority deny beats any lower-priority allow.
Establishing connectivity: Cloud VPN, peering, and Cloud Interconnect
Choosing a connectivity product comes down to what you are connecting and how much private, reliable bandwidth you need. Cloud VPN sends IPsec-encrypted traffic over the public internet; HA VPN deploys redundant interfaces and offers a 99.99% availability SLA when configured with the recommended tunnel pairs, and routes are exchanged dynamically over BGP via a Cloud Router. It is quick to set up and cheap, but throughput is bounded per tunnel and latency is at the internet's mercy.
Cloud Interconnect provides a private physical connection that bypasses the public internet. Dedicated Interconnect gives you your own 10 Gbps or 100 Gbps links from your router in a colocation facility; Partner Interconnect reaches Google through a supported service provider with capacities from 50 Mbps up to 50 Gbps — the answer when you cannot meet Google at a colocation facility or need less than 10 Gbps. Both offer availability SLAs when built with redundant attachments. Traffic on Interconnect is not encrypted by default, which questions occasionally probe.
VPC Network Peering is different in kind: it connects two VPC networks inside Google Cloud, not a VPC to an on-premises site.
| Option | Connects | Path | Capacity | Best for |
|---|---|---|---|---|
| Cloud VPN (HA VPN) | On-premises or other cloud to VPC | Encrypted IPsec over the internet | Per-tunnel limits; add tunnels to scale | Fast setup, lower cost, moderate bandwidth |
| Dedicated Interconnect | On-premises to VPC | Private fiber at a colocation facility | 10 or 100 Gbps per link | High, consistent bandwidth and low latency |
| Partner Interconnect | On-premises to VPC via provider | Private connection through a partner | 50 Mbps to 50 Gbps | Private connectivity without colocation presence |
| VPC Network Peering | VPC to VPC | Google internal network | No tunnel bottleneck | Private RFC 1918 traffic between two VPCs |
A common exam pattern: start with HA VPN for speed of delivery, then migrate to Interconnect as bandwidth needs grow — the two can even run side by side, with VPN as an encrypted backup path.
Choosing and deploying load balancers
Pick a Cloud Load Balancing product by answering three questions in order: what layer is the traffic (HTTP and HTTPS mean an Application Load Balancer; TCP, UDP, or other IP protocols mean a Network Load Balancer), who are the clients (internet-facing means external; clients inside your VPC or connected networks mean internal), and what scope do you need (one anycast IP serving backends in many regions means global; a single region means regional).
Application Load Balancers are proxy-based Layer 7 balancers: they terminate TLS, route on hostnames and URL paths, and integrate with Cloud CDN and Google Cloud Armor. The global external Application Load Balancer fronts worldwide users with a single anycast IP and picks the closest healthy backend region. Regional external and internal variants cover single-region and private HTTP(S) services.
Network Load Balancers come in two families. Proxy Network Load Balancers terminate TCP (optionally with TLS) at the edge and open a new connection to backends — useful for global TCP services. Passthrough Network Load Balancers forward packets without terminating the connection, preserving the client source IP, and support protocols beyond TCP such as UDP — the answer whenever a question mentions preserving client IPs or non-TCP traffic. Passthrough balancers are regional.
| Requirement | Choose |
|---|---|
| HTTPS app, users worldwide, one IP, CDN and WAF | Global external Application Load Balancer |
| HTTPS app for one region or jurisdiction | Regional external Application Load Balancer |
| Internal microservice traffic over HTTP | Internal Application Load Balancer |
| Global TCP or TLS service, non-HTTP | Proxy Network Load Balancer (external) |
| UDP traffic or client IP must be preserved | External passthrough Network Load Balancer |
| Internal TCP or UDP within the VPC | Internal passthrough Network Load Balancer |
Deployment is the same skeleton regardless of flavor: create a health check, a backend service pointing at instance groups or network endpoint groups, any Layer 7 routing configuration, and a forwarding rule that holds the IP address.
Scenario: networking for a global retail platform
Put the pieces together. A retailer runs its storefront on Google Cloud: web and API tiers on managed instance groups in us-central1 and europe-west1, a payments service that must stay private, an on-premises warehouse system that needs steady private connectivity today and roughly 5 Gbps within a year, and three application teams in separate projects under one organization.
The network team creates a custom mode VPC in a host project with subnets in both regions, plus GKE secondary ranges reserved for a future cluster, and enables Shared VPC so each team's service project deploys into centrally governed subnets. Traffic policy lives in a global network firewall policy: an ingress rule allows tcp:443 from the internet to workloads bound to the secure Tag role=web, a second rule allows the web tier to reach the payments backends only via their service account identity, and an organization-level hierarchical policy denies all RDP from the internet everywhere.
Users worldwide hit a global external Application Load Balancer on Premium Tier — one anycast IP, Cloud CDN for product images, Cloud Armor in front. The payments service sits behind an internal Application Load Balancer, unreachable from outside the VPC. For the warehouse, the team ships HA VPN with BGP over Cloud Router this quarter for the 99.99% SLA, and orders Partner Interconnect at 5 Gbps for the bandwidth milestone, keeping the VPN as an encrypted failover path. Every choice here maps to a decision rule from this lesson — which is exactly how the exam will test you.
Tip. Expect scenario questions that make you pick between Shared VPC and VPC Network Peering, and between Cloud VPN, Partner Interconnect, and Dedicated Interconnect from bandwidth, SLA, and organizational clues. Firewall questions test rule attributes — priority ordering, implied rules, target tags versus target service accounts — and the IAM-governed nature of secure Tags in Cloud NGFW policies. Load balancing questions describe traffic type, client location, and scope and expect the one matching product, with Premium versus Standard Tier as a frequent twist.
- VPC networks are global; subnets are regional — and custom mode is the production choice because auto mode ranges overlap and block peering.
- Shared VPC shares one network across projects in a single organization; VPC Network Peering connects two independent networks, is non-transitive, and forbids overlapping ranges.
- Firewall rules are stateful and defined by direction, action, priority (lower number wins), source or destination, targets, and protocols and ports; implied rules deny all ingress and allow all egress.
- Cloud NGFW firewall policies attach at organization, folder, or network scope, and their rules can match IAM-governed secure Tags and service accounts — stronger identities than legacy network tags.
- HA VPN offers a 99.99% SLA over encrypted internet tunnels; Dedicated Interconnect provides 10 or 100 Gbps private links; Partner Interconnect covers 50 Mbps to 50 Gbps without a colocation presence.
- Choose load balancers by layer (Application vs Network), client location (external vs internal), and scope (global vs regional); passthrough Network Load Balancers preserve client IPs and support UDP.
- Premium Tier rides Google's backbone and is required for global load balancing; Standard Tier is regional, uses the public internet sooner, and costs less.
Frequently asked questions
When should I use a custom mode VPC instead of auto mode?
Use custom mode for anything beyond experimentation. Auto mode creates a subnet in every region from a predefined range that overlaps with every other auto mode network, which prevents VPC Network Peering and complicates hybrid connectivity. Custom mode gives you full control over subnet regions and IP ranges, and you can convert auto mode to custom mode later — but never back.
Is VPC Network Peering transitive?
No. If network A peers with B and B peers with C, A cannot reach C through B. Each pair of networks that needs to communicate must establish its own peering, and none of the peered networks may have overlapping IP ranges. If you need many networks with mutual reachability and central control, Shared VPC or a hub-and-spoke design is usually the better answer.
What is the difference between secure Tags and network tags in firewall rules?
Network tags are plain strings anyone with instance-edit permission can attach, so they carry no access control. Secure Tags are Resource Manager resources governed by IAM: creating a tag and binding it to a VM each require explicit permissions. Cloud NGFW firewall policies use secure Tags, which prevents an instance owner from quietly moving a workload into a permissive firewall scope.
How do I choose between Cloud VPN and Cloud Interconnect?
Choose HA VPN when you need connectivity quickly, traffic must be encrypted, and per-tunnel bandwidth limits are acceptable — it carries a 99.99% SLA when configured with redundant tunnels. Choose Dedicated Interconnect for 10 or 100 Gbps of consistent private bandwidth if you can meet Google in a colocation facility, or Partner Interconnect for 50 Mbps to 50 Gbps through a service provider. Many teams start on VPN and add Interconnect as bandwidth grows.
Which load balancer should I pick for a global HTTPS application?
The global external Application Load Balancer. It gives you a single anycast IP address, routes each user to the closest healthy backend region, terminates TLS, and integrates with Cloud CDN and Google Cloud Armor. Note that it requires Premium Network Service Tier — on Standard Tier you are limited to regional load balancers.
When does Standard Network Service Tier make sense?
When cost matters more than latency consistency and your workload is regional: bulk data egress, batch jobs, or a service whose users sit close to its region. Standard Tier hands traffic to the public internet near the hosting region and prices egress lower, but it cannot serve global anycast IPs or global external load balancers.
Sign up free to mark lessons complete, bookmark topics and track your exam readiness.