Cloud Architecture

What Is a Virtual Private Cloud (VPC)?

What a virtual private cloud (VPC) is, how subnets, route tables, and security controls isolate it, and how it connects to other networks.

On this page
  1. What is a virtual private cloud (VPC)?
  2. How isolation works
  3. Building blocks
  4. Public and private subnets
  5. Connecting a VPC to other networks
  6. Monitoring and cost
  7. Common misconceptions
  8. Planning tips

What is a virtual private cloud (VPC)?

A virtual private cloud (VPC) is a logically isolated virtual network inside a public cloud. You choose its IP address ranges, create its subnets, set its routing, and attach gateways. Your resources run on the provider’s shared infrastructure, but the provider’s network controls keep them separate from other customers’ resources. A VPC is not a separate physical network.

How isolation works

The provider enforces a VPC’s boundaries in software. Traffic inside one VPC does not reach another VPC unless you connect them. You control the address ranges, subnets, routes, and access rules, so the boundaries are set by your configuration as well as by the provider.

Building blocks

  • CIDR block (address range): the IP range for the VPC. AWS allows IPv4 CIDR blocks from /16, which has 65,536 addresses, down to /28, which has 16.
  • Subnets: smaller ranges inside the VPC. An AWS subnet sits in a single availability zone. Azure uses a virtual network (VNet) with subnets. Google Cloud VPC networks are global, with regional subnets.
  • Reserved addresses: AWS and Azure each reserve five IP addresses in every subnet, and Google Cloud reserves four. Plan subnet sizes with this in mind.
  • Route tables: rules that decide where a subnet’s traffic goes.
  • Internet gateway: lets resources in a public subnet send and receive traffic from the internet.
  • NAT gateway: lets resources in a private subnet connect out to the internet without accepting unsolicited inbound connections.
  • Security groups: stateful firewall rules attached to instances or network interfaces. They contain allow rules only. Azure’s equivalent is the network security group (NSG).
  • Network ACLs: stateless rules applied at the subnet level. They can allow or deny traffic and are evaluated in rule-number order.

Public and private subnets

A public subnet has a route to an internet gateway. A private subnet has no direct route to the internet, so its outbound traffic goes through a NAT gateway. Most designs use both:

  • A public subnet holds internet-facing components, such as a load balancer or a web tier.
  • Private subnets hold the application and database tiers, which are not directly reachable from the internet.

In a three-tier design, the web tier talks to the application tier, and the application tier talks to the database tier. Each tier gets its own subnet and its own access rules.

Private subnets are not automatically secure. Security groups and network ACLs still decide what can connect.

Connecting a VPC to other networks

  • Site-to-site VPN creates an encrypted IPsec tunnel between the VPC and an on-premises network. AWS Site-to-Site VPN provides two tunnels per connection.
  • Dedicated connections, such as AWS Direct Connect, provide a private link to the provider instead of using the public internet.
  • VPC peering routes traffic between two VPCs. Peering is not transitive: if A peers with B and B peers with C, A cannot reach C through B. Overlapping address ranges prevent peering.
  • Transit gateways act as a central hub that connects many VPCs, VPNs, and dedicated connections.
  • Endpoints let resources reach supported cloud services privately. Gateway endpoints for Amazon S3 and DynamoDB are free. Interface endpoints, which use AWS PrivateLink, place private IP addresses in your subnets.

Load balancers often sit in public subnets, in front of private application servers. See load balancers in cloud computing for how they route traffic.

Monitoring and cost

VPC flow logs record metadata about accepted and rejected IP traffic. They help with troubleshooting and security analysis. On AWS, using a VPC itself carries no additional charge, but some components do, such as NAT gateways and public IPv4 addresses. Pricing changes, so check the current rates.

Common misconceptions

  • A VPC is not a VPN. A VPN encrypts a connection between two networks. A VPC is a virtual network. You may use a VPN to connect a VPC to another network.
  • A VPC is not a private cloud. It is logical isolation on shared provider hardware. A private cloud is usually dedicated to one organization.
  • Private subnets are not automatically secure. Security groups and network ACLs still matter.
  • Peering is not transitive, and overlapping address ranges block peering.

Planning tips

  • Choose address ranges from the private RFC 1918 blocks: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16.
  • Avoid overlapping ranges with your other networks, or you will not be able to connect them later.
  • Leave room for growth when you size subnets, and remember the reserved addresses in each one.

For how a VPC supports resilience across zones and regions, see disaster recovery in cloud computing.

The complete guide to cloud architecture

Cloud Computing Architecture: The Core Components
Read the guide

Keep exploring

Guides from other topics

All topics →