Without configuring Cloud NAT and Private Google Access, a simple software update from Google’s servers could break your entire private network or leak your internal IP addresses to the public internet. This chapter explains how to let your private virtual machines access the internet for updates without exposing them directly, and how to let them reach Google’s own APIs without touching the public internet at all.
Jump to a section
A simple way to picture Cloud NAT and Private Google Access
A university library, with its vast collection kept in a secure, windowless basement vault. The only way in or out of that vault is through a single, heavily-supervised mailroom with a loading dock. The library itself sits on a private campus.
Students, the library patrons, are not allowed into the vault. They submit book requests through an online portal. The mailroom staff receives the request, retrieves the physical book from the vault, and sends it up to the front desk via a dumbwaiter. This is the library’s internal delivery system. But what if a student wants a document from the National Archives downtown? The Archives are a public service, but they exist on the public street grid, not the private campus. Here, the library’s mailroom becomes a NAT. It takes the student’s internal request, stamps it with the mailroom’s own public address (the loading dock door), and sends a courier to the Archives. The Archives sends the document back to the library’s loading dock, and the mailroom staff matches the return address to the student’s internal request, delivering the document to the correct desk. The student never knew the Archives' loading bay number; they only knew their own internal request system. Private Google Access is different. It’s like the library’s IT department installing a dedicated fibre-optic line straight from the vault to the National Archives’ digital server. Now, the vault’s servers can talk directly to the Archives’ servers without ever touching the public street grid or needing the mailroom’s courier service. They use a private, invisible pathway.
Let’s start with a fundamental problem. When you build a virtual private cloud (VPC) on Google Cloud, you create a private network. It’s like a fenced-off plot of land. Inside that plot, you create virtual machines (VMs) — think of them as houses. By default, these houses have no road connecting them to the outside world. They can talk to each other within the VPC, but they cannot reach the public internet. That’s good for security, but terrible for practical tasks like downloading security patches, accessing a public API, or installing software from a public repository.
This is where Cloud NAT (Network Address Translation) comes in. Cloud NAT is a managed service that acts like a shared front door for all the VMs in your VPC. It gives those private VMs a way to talk to the public internet without giving them a public IP address of their own. Think of it like a large apartment building. Each apartment (VM) has a unique internal number (private IP address), but the building only has one street address (the NAT’s public IP address). When someone in Apartment 3B sends a letter to the outside world, the building’s mail room (the NAT) swaps out the return address from “Apartment 3B” to “123 Main Street, Apartment 3B”. The outside world replies to “123 Main Street”, and the mail room knows to deliver the reply to Apartment 3B. The NAT keeps track of all these connections using a stateful table — it remembers who initiated which conversation and where the reply should go.
It is critical to understand that Cloud NAT is an outbound-only service. It allows VMs to initiate connections to the internet, but it does not allow anything from the internet to initiate a connection back to those VMs. That would require a firewall rule or a load balancer. This is a common exam trap. The NAT is a one-way street for outgoing traffic.
Now, Private Google Access (PGA) solves a different but related problem. What if your private VMs need to talk to Google’s own services — things like Cloud Storage, BigQuery, or the Google Cloud APIs — without going over the public internet? You might think, “Why not just use Cloud NAT for that?” You could, but it is less secure and less performant. The traffic would leave your VPC, travel across the public internet, and then hit Google’s front-end servers. That introduces latency and potential exposure.
Private Google Access enables your private VMs to reach Google’s public APIs using a private internal path. When you enable PGA on a subnet, Google’s infrastructure automatically routes traffic destined for Google’s API endpoints through a private, internal network path instead of sending it out to the public internet. The VM still uses its private IP address; it never needs a public IP. The traffic stays inside Google’s backbone network, which is faster and more secure. It is important to note that PGA only covers traffic to Google’s services, not to the general internet. For general internet access, you still need Cloud NAT.
A related concept is Private Service Connect (PSC). While PGA allows VMs to access Google’s APIs, PSC allows VMs to access managed services that you or your partners have published, or to connect to Google’s services in a way that allows you to define the endpoint inside your VPC. For the PCNE exam, focus on the distinction: PGA is for Google’s end-user APIs (like Storage and BigQuery), while PSC is for accessing specific managed service endpoints or publishing your own services.
Let’s break down the types and configurations:
Cloud NAT: A regional resource. It applies to an entire region within a VPC. You configure it on a Cloud Router, which is a virtual router that manages dynamic routing protocols (BGP). When you create a Cloud NAT gateway, you specify the subnet ranges that should use it. You can also choose manual or auto NAT IP address allocation.
Private Google Access: A subnet-level setting. It is enabled or disabled per subnet. It does not require a Cloud Router or a NAT gateway. It simply changes the routing behaviour for traffic to googleapis.com and other Google-owned domains.
Private Google Access for on-premises: This extends PGA to on-premises networks connected via Cloud VPN or Cloud Interconnect. It allows on-premises hosts using private IP addresses to reach Google APIs without going over the public internet.
The exam loves to test which configuration is needed for which scenario. A common question: “Your VMs are in a private subnet with no external IP. They need to download a library from a third-party website. What should you configure?” The correct answer is Cloud NAT. “They need to write data to a Cloud Storage bucket. What should you configure?” The correct answer is Private Google Access. “They need to do both?” You need both Cloud NAT and Private Google Access.
Identify the connectivity requirement
Determine what your private VM needs to access. Is it a third-party website, a public repository, or is it a Google API like Cloud Storage or BigQuery? This choice determines whether you use Cloud NAT, Private Google Access, or both. This step is critical for exam scenario questions.
Create a Cloud Router
If you need Cloud NAT, you must first create a Cloud Router in the same region as your private VMs. The Cloud Router is a virtual router that handles the BGP sessions required by Cloud NAT. Even with static routing, Cloud Router is mandatory. Go to Hybrid Connectivity > Cloud Routers in the console.
Configure the Cloud NAT gateway
On the Cloud Router, create a new NAT gateway. Choose the subnet ranges that will use this gateway. Select the NAT IP address allocation method: automatic (Google assigns and manages IPs) or manual (you specify static IPs from a reserved range). Manual allocation is useful if the external service whitelists your NAT IPs.
Enable Private Google Access on the subnet
Go to VPC network > Subnets. Select your subnet and edit it. Under 'Private Google Access', select 'On'. That is the entire configuration for PGA. No gateways, no routers. The subnet now automatically routes traffic to Google's internal API IP ranges via a private path.
Test and verify connectivity
SSH into a private VM (using Identity-Aware Proxy or a bastion host). Test by running 'curl http://example.com' for general internet access (should work if Cloud NAT is configured) and 'curl https://storage.googleapis.com' for Google API access (should work if PGA is enabled). Use 'gcloud compute routers get-status nat' to inspect NAT status and check packet counts.
Monitor and scale
Use Cloud Monitoring and Cloud Logging to track NAT connection usage, dropped packets, and IP address utilisation. If your NAT IPs are being exhausted (too many concurrent connections), add more NAT IPs or switch to automatic allocation with more IPs. Cloud NAT can also be configured with minimum ports per VM to ensure fairness.
Let’s look at a typical scenario for a company called FinTech Analytics. They process financial data and have strict security requirements. They run their workloads in a VPC with no public IP addresses on their VMs at all. They do this to minimise the attack surface. Here is what their network engineer, Priya, actually does.
Priya is responsible for letting her private VMs access the necessary external resources while staying compliant. She has three main requirements:
VMs in the primary subnet need to download security patches from a public Linux repository every night.
VMs need to ingest market data from a third-party financial API that is hosted on the public internet.
VMs need to upload processed reports to a Cloud Storage bucket for long-term archiving.
For requirement one, Priya configures Cloud NAT. She creates a Cloud Router in the us-central1 region and associates it with her VPC. Then she creates a Cloud NAT gateway on that router, specifying the IP ranges of her primary subnet. She allocates two external IP addresses for the NAT to use. This allows the VMs to reach the public Linux repository. The VMs never get a public IP; they always appear to the repository as coming from one of those two NAT IPs. Priya sets the NAT to automatically create firewall rules that allow the return traffic. This is the day-to-day activity of a network engineer: creating and managing NAT gateways to enable outbound connectivity.
For requirement two, Priya could use the same Cloud NAT, but she considers the security implications. The financial API is a known public endpoint. MitM (Man-in-the-Middle) attacks are a theoretical risk. She decides the existing Cloud NAT is sufficient for now because she trusts the TLS encryption on the API connection. If the API were a Google service, she would switch to Private Google Access.
For requirement three, Priya does not use Cloud NAT at all. Instead, she enables Private Google Access on her subnet. She goes to the VPC network section in the Google Cloud Console, selects her subnet, and under “Private Google Access” she clicks “On”. That is it. Now, when any VM in that subnet sends a request to storage.googleapis.com, the traffic is automatically routed through Google’s internal network without touching the public internet. This is faster and more secure. It also reduces her NAT bandwidth usage, saving costs.
When an incident happens — say the VMs cannot reach the financial API — Priya’s troubleshooting steps include:
Checking whether the destination is a Google API or a third-party service.
Verifying Cloud NAT traffic logs in Cloud Logging to see if packets are being dropped.
Checking firewall rules to ensure egress traffic is allowed on the necessary ports.
Confirming that the subnet has Private Google Access enabled if the destination is a Google API.
The key decision for Priya every time she adds a new service is: Is this a Google API, or is it the public internet? This decision determines whether she uses Private Google Access, Cloud NAT, or both.
The PCNE exam (Google Professional Cloud Network Engineer) tests Cloud NAT and Private Google Access thoroughly, often in the context of scenario-based questions. You will need to know not just what each service does, but exactly when to use one versus the other. Here is a breakdown of what to study.
Concepts that are heavily tested:
The fundamental difference between Cloud NAT (public internet access) and Private Google Access (Google API access). This is the most common distraction. The exam will give you a scenario where a VM needs to reach a Google API, and a distractor answer will say “Cloud NAT”. The correct answer is “Private Google Access”. The reverse is also true: if the VM needs to reach a third-party website, Cloud NAT is needed.
Private Google Access is a subnet-level setting. It is not a networking appliance or a gateway. It is an attribute of the subnet itself. Many candidates incorrectly think it is a service that you “attach” to a VM. No, you enable it on the subnet, and any VM in that subnet can use it.
Cloud NAT requires a Cloud Router. The Cloud Router handles the dynamic routing (BGP) that Cloud NAT uses to direct traffic. A common question gives you a setup where Cloud Router is not configured, and asks why NAT is not working. The answer is that Cloud Router is a prerequisite.
Cloud NAT is regional. If you have VMs in multiple regions, you need a separate Cloud NAT per region. The exam may present a multi-region architecture and ask how many NAT gateways are needed. The answer should be the number of regions with private VMs that need outbound access.
Cloud NAT supports both manual and automatic IP address allocation. The exam might ask about the implications of manual allocation for IP exhaustion or whitelisting. Remember that manual allocation gives you fixed IPs that can be whitelisted by external endpoints.
Traps to watch for:
The “external IP” trap: A question might say “Your VM has a public IP address, but it cannot reach the internet.” The correct answer is often related to firewall rules or routing. Cloud NAT is not needed if the VM already has a public IP. Cloud NAT only serves VMs without public IPs.
The “ingress” trap: The exam might ask how to allow inbound traffic from the internet to a private VM. Cloud NAT does not handle inbound traffic; you would use a load balancer or a VPN with static routes.
The “Private Google Access for on-premises” trap: This feature allows on-premises machines to reach Google APIs without a public IP. The exam may ask what is required for this: Cloud VPN or Interconnect, plus PGA enabled on the VPC.
The “DNS resolution” trap: For PGA to work, the DNS resolution for googleapis.com must point to a private IP (RFC 1918) address. If DNS is not configured correctly, traffic may still go over the public internet. The exam may ask about configuring DNS peering zones.
Key definitions to memorise:
Cloud NAT: A managed service providing source network address translation (SNAT) for private VMs to access the public internet.
Private Google Access (PGA): A subnet-level feature allowing VMs with private IPs to reach Google APIs via Google’s internal network.
Cloud Router: A virtual router that manages BGP sessions and is required for Cloud NAT.
Private Google Access for on-premises: Extension of PGA to hybrid networks.
Exam question style: You will see questions like “An architect wants to minimise egress costs and maximise security. Which solution should they choose?” The answer is Private Google Access, because egress to Google APIs over the public internet costs more than internal routing. Another style: “A VM in a subnet without PGA enabled is trying to access a Google API and failing. What is the most likely cause?” The answer is that PGA is not enabled on that subnet.
Cloud NAT provides outbound internet access for private VMs without assigning them public IP addresses.
Private Google Access allows private VMs to reach Google APIs and services over Google's internal network, bypassing the public internet.
Cloud NAT is regional and requires a Cloud Router; Private Google Access is a per-subnet setting with no gateway requirement.
Cloud NAT handles traffic to third-party public endpoints; Private Google Access covers only Google-owned API endpoints.
A VM with a public IP address does not need Cloud NAT for outbound internet access, but it might still need firewall rules.
For on-premises hosts to use Private Google Access, you need a Cloud VPN or Dedicated Interconnect and must enable PGA on the VPC.
The most common exam question on this topic asks whether to use Cloud NAT or Private Google Access in a given scenario.
Cloud NAT is stateful; it tracks connection state so that return traffic is correctly forwarded to the initiating VM.
These come up on the exam all the time. Here's how to tell them apart.
Cloud NAT
Provides outbound access to any public internet destination
Requires a Cloud Router and is a regional gateway resource
Translates the source IP from a private IP to a public NAT IP
Private Google Access
Provides access only to Google API endpoints
Is a per-subnet setting, no gateway or router required
Keeps the source IP as the private IP; no translation occurs
Cloud NAT
VM has no public IP; outbound traffic goes through a shared gateway
Allows many VMs to share a few public IPs (IP saving)
Stateful translation: the gateway tracks connections
VM with External IP
VM has a directly assigned public IP on its interface
Each VM consumes a public IP address (scarcity/cost)
No stateful gateway is needed; the OS handles IP routing
Private Google Access (PGA)
For accessing Google's own public APIs (e.g., Cloud Storage)
Enabled on the subnet level, no explicit endpoint configuration
Traffic uses Google's internal backbone automatically
Private Service Connect (PSC)
For accessing managed services (third-party or Google) via a custom endpoint
Requires creating a private endpoint or service attachment
Allows consumers to define IP addresses and DNS names for services
Cloud NAT (Automatic IP Allocation)
Google assigns and manages the NAT IP addresses
IPs are ephemeral; they can change over time
Simpler to set up, but external whitelisting is difficult
Cloud NAT (Manual IP Allocation)
You reserve static public IPs and assign them to the NAT
IPs are predictable and do not change
Required when external services need to whitelist your NAT IPs
Mistake
Cloud NAT gives my VM a public IP address.
Correct
Cloud NAT does not assign a public IP to the VM. The VM remains private. It merely translates the source IP of outgoing packets to a NAT IP address, so the external server sees the NAT IP, not the VM's IP.
Many beginners confuse NAT with assigning a public IP directly. They think the VM gets an IP it can be reached on from the internet. In reality, the VM's interface stays private; the translation happens at the gateway level.
Mistake
Private Google Access is just a naming change for Cloud NAT.
Correct
Private Google Access and Cloud NAT are entirely different services. PGA is a subnet-level routing change for Google API traffic only. Cloud NAT is a gateway that provides general outbound internet access. They are often used together but solve separate problems.
Both involve outbound connectivity from private VMs, so beginners lump them together. The exam heavily distinguishes them, so it is a frequent source of confusion.
Mistake
Private Google Access works for any internet destination.
Correct
Private Google Access only works for traffic to Google-owned services and APIs (like Cloud Storage, BigQuery, Compute Engine API). It does not cover third-party websites or other public endpoints.
The name 'Private Google Access' clearly states 'Google', but beginners sometimes assume 'private access' means private access to everything. This misconception leads to incorrect answers on the exam.
Mistake
I need a Cloud Router only if I use dynamic routing.
Correct
Cloud Router is mandatory for Cloud NAT even if you are not using dynamic routing with on-premises networks. Cloud Router is the underlying infrastructure that Cloud NAT relies on to manage the NAT IPs and handle the stateful translation.
Beginners think Cloud Router is optional or only for BGP. The exam requires you to know that Cloud Router is a prerequisite for creating any Cloud NAT gateway, regardless of whether you have VPN or Interconnect connections.
Mistake
If I enable Private Google Access on a subnet, my VMs can access the public internet without Cloud NAT.
Correct
Private Google Access does not provide general internet access. It only works for Google's official API endpoints. For any other internet destination (like a public software repository or a third-party API), you still need Cloud NAT.
The feature provides a private path to Google's services, which is often enough for many cloud-native architectures, leading beginners to believe it replaces NAT entirely.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
No. Cloud NAT is only for VMs without public IPs. If a VM already has a public IP address, it can access the internet directly through that IP (subject to firewall rules). Cloud NAT would be redundant.
Yes, this is called Private Google Access for on-premises. You need to enable PGA on the VPC, and the on-premises traffic must come through a Cloud VPN tunnel or Dedicated Interconnect. The on-premises hosts use their private IPs to reach Google APIs.
Google's network internally routes traffic destined for Google API IP ranges through a private backbone, bypassing the public internet. The source IP remains the private IP of your VM. No external IP is needed.
Yes, Cloud NAT is regional and is designed to be highly available within a region. If a NAT gateway goes down, Google automatically redirects traffic to another gateway in the same region. You do not need to manage failover.
No. Cloud NAT is strictly outbound-only. It translates source IPs for outgoing connections. For inbound traffic (e.g., internet users accessing your VMs), you need a different solution like a Cloud Load Balancer, or you must assign public IPs to the VMs and configure firewall rules.
Cloud NAT provides outbound internet access to any public destination. Private Google Access provides a private path specifically to Google's API endpoints only. They solve different problems and are often configured together.
You've finished Cloud NAT and Private Google Access. Continue through the PCNE study guide to build a complete picture of the exam.
Done with this chapter?