Understand how to build isolated virtual networks in the cloud: VPC and VNet concepts, region, availability zone, public and private subnets, internet gateway, NAT gateway, and route tables, with AWS, GCP, and Azure comparisons.

In the previous episode, episode 4, you learned about Identity & Access Management — how to grant permissions to users, roles, and applications to access a cloud account. But there's one question that hasn't been answered: permissions to access what? The answer is in this episode: the virtual network where all your cloud resources live.
Episode 5 covers the foundation of cloud networking: the Virtual Private Cloud (VPC). We'll look at network isolation concepts, the global cloud infrastructure map (region, availability zone, edge location), VPC anatomy like subnets, internet gateways, NAT gateways, and route tables, then close with a comparison of how AWS VPC, GCP VPC, and Azure VNet work.
Imagine a big city where millions of people live on the same land. All cloud customers share the same physical data centers — that's what "multi-tenant" means. If there were no boundaries between residents, one tenant's data and traffic could "bump into" another tenant. A VPC is your house fence in that city: a fully isolated logical network, complete with its own IP addresses, its own access rules, and its own entrance and exit points.
With a VPC, you decide for yourself:
Note
A VPC is called "private" not because it's physically separate, but because it's logically isolated. Another tenant's data packets will never enter your VPC unless explicitly allowed via peering or VPN. This is why the cloud is architecturally secure: not because "other people's computers" are physically isolated, but because of strict logical separation.
Before building a network, you must understand the "map" where that network lives. Cloud providers build global infrastructure in three layers:
| Layer | Analogy | Role |
|---|---|---|
| Region | City | Full-service center; AWS and Azure are regional, GCP is global |
| Availability Zone (AZ) | Data center buildings within a city | Physical redundancy (power, network, cooling); usually 2-3 AZs per region |
| Edge location | Outpost on the city outskirts | CDN cache and DNS so responses stay close to users |
A Region is the "city" where you place resources. Availability Zones are the different "buildings" in that city — physically close enough for low latency, but separate enough that a power or network failure in one building won't bring down another. This is why placing applications across two or more AZs is the key to high availability, a topic we'll dive into in episode 8.
One thing that often confuses beginners: an edge location is not a place to run virtual machines. An edge only stores cache and DNS answers near users. VMs still must live in a region — the edge has no "rooms" for that.
A VPC isn't useful as a single solid block — you have to divide it into parts with different roles.
A subnet is a division of the IP address space inside a VPC. There are two "types", which are actually determined by their routes, not their labels:
An internet gateway is a two-way door that connects a VPC to the internet. It attaches at the VPC level (not per subnet), and it's always "one per VPC". Without an IGW, a public subnet is just an ordinary subnet connected to nowhere.
A NAT gateway is a one-way outbound door. Imagine a phone that can make outgoing calls but can't receive incoming ones. With a NAT gateway, resources in a private subnet can download packages, run system updates, or call external APIs — without opening themselves to incoming connections from the internet.
Tip
The most common pattern in production architectures: web servers and load balancers in a public subnet, databases and backend applications in a private subnet, and the private subnet reaches the internet outbound through a NAT gateway. The principle: "keep the front door minimal, keep the back door open for maintenance".
A route table is the network's traffic sign board. Every subnet must be associated with one route table that tells packets where to go. The contents of a route table look roughly like this:
| Destination | Target | Description |
|---|---|---|
10.0.0.0/16 | local | Traffic between subnets within the VPC; always present and cannot be deleted |
0.0.0.0/0 | igw-xxxxxxxx | Public subnet: all outbound traffic through the internet gateway |
0.0.0.0/0 | nat-xxxxxxxx | Private subnet: outbound traffic through the NAT gateway |
The route 0.0.0.0/0 means "all addresses not more specific than any other route". That's why the local route must always win: inter-subnet traffic will never leak out to the internet.
Internet
|
[Internet Gateway]
|
Public Subnet (route 0.0.0.0/0 -> igw-xxx)
|
[NAT Gateway]
|
Private Subnet (route 0.0.0.0/0 -> nat-xxx)CIDR is a shorthand way to write IP address ranges: the /16, /24, or /28 after an IP indicates how many addresses are covered. The smaller the number after the slash, the larger the range.
| Notation | Number of addresses | Common use |
|---|---|---|
10.0.0.0/16 | 65,536 | The whole VPC |
10.0.1.0/24 | 256 | One subnet (for example, a public subnet) |
10.0.2.0/24 | 256 | Another subnet (for example, a private subnet) |
Important
Two rules you must remember. First, a subnet's CIDR must be inside the VPC's CIDR and must not overlap with other subnets — two overlapping subnets will make routes confuse each other. Second, on AWS each subnet reserves the first 5 IP addresses for internal purposes (network address, VPC router, DNS, and two others), so a /24 subnet only provides 251 addresses actually usable by instances.
Let's practice it with the AWS CLI. aws ec2 create-vpc creates a VPC with a given CIDR:
aws ec2 create-vpc --cidr-block 10.0.0.0/16Once the VPC exists, we create subnets inside it, then create and attach an internet gateway. These commands can be chained into a single flow:
VPC_ID=$(aws ec2 create-vpc --cidr-block 10.0.0.0/16 --query Vpc.VpcId --output text)
aws ec2 create-subnet --vpc-id "$VPC_ID" --cidr-block 10.0.1.0/24 --availability-zone us-east-1a
IGW_ID=$(aws ec2 create-internet-gateway --query InternetGateway.InternetGatewayId --output text)
aws ec2 attach-internet-gateway --vpc-id "$VPC_ID" --internet-gateway-id "$IGW_ID"Notice: aws ec2 create-subnet requires --availability-zone — this is why subnets on AWS are tied to one AZ, while the VPC itself spans the entire region.
The concept is the same, but the design details differ. The most fundamental difference is scope: whether a network can span more than one region.
| Aspect | AWS VPC | GCP VPC | Azure VNet |
|---|---|---|---|
| Scope | Regional (per region) | Global (cross-region) | Regional (per region) |
| Subnet | Tied to one AZ | Global, not tied to an AZ | Tied to region |
| Firewall | Security Group + Network ACL | VPC Firewall Rules | Network Security Group |
| NAT | NAT Gateway | Cloud NAT | Azure NAT Gateway |
Note
The scope difference has practical consequences. On GCP, one VPC can hold subnets in many regions, and firewall rules apply globally — you don't need inter-region peering for the same internal network. On AWS and Azure, VPC/VNet is regional: to connect different regions, you need peering or a transit gateway. Nothing is "wrong" — they're just different approaches, and understanding this lets you choose based on your needs.
For comparison, here are the network creation commands on the other two providers:
# GCP
gcloud compute networks create production --subnet-mode custom
# Azure
az network vnet create --name production-vnet --address-prefix 10.0.0.0/16 --resource-group production-rggcloud compute networks create and az network vnet create both build the "house fence" of their respective providers — the difference is only in scope and the options provided.
In this episode 5, we've built the cloud networking foundation: why a VPC is needed for logical isolation in a multi-tenant environment, the global infrastructure map (region, AZ, edge location), and VPC anatomy with public/private subnets, internet gateways, NAT gateways, and route tables. You also saw how to create a VPC and subnet via the AWS CLI, plus the design differences between AWS, GCP, and Azure.
The keys to take away:
local always wins over internet routes.Now you have a "house" in the form of a VPC. In the next episode, episode 6, we'll fill it with inhabitants: Cloud Compute Services (Virtual Machines) — how VMs run on top of hypervisors, instance categories that match your workloads, and the on-demand, reserved, and spot purchasing models that can save up to 90 percent of costs.