Skip to main content

Networking

In a cloud environment, software-defined networking establishes the boundaries, routing rules, and isolation perimeters that govern inter-service communication. When architected properly, databases and internal compute workloads are completely unreachable from the public internet by design. Conversely, flawed network topology can expose internal databases, unauthenticated caches, or management interfaces to automated internet port scanners.

Understanding cloud networking requires tracing how traffic moves through private networks, subnets, and routing gateways from the outside world inward.

Your private network

Cloud providers isolate tenant resources within a (VPC)—a private, software-defined network dedicated entirely to your account. Instances, container pods, and managed databases deployed inside a VPC communicate across private IP addresses that are isolated from other cloud tenants.

A VPC's address space is defined using Classless Inter-Domain Routing () notation, such as 10.0.0.0/16. The prefix indicates how many bits are fixed, determining the total number of allocatable IP addresses. Thorough CIDR block planning is critical: selecting an address range that avoids overlaps with corporate office networks, existing data centers, or peer VPCs prevents disruptive network re-addressing projects when connecting environments later.

Subnets

A VPC's IP block is divided into smaller , with each subnet mapped to a specific availability zone. Production topologies separate workloads into two distinct tiers:

  • Public subnets: Configured with a direct route table entry pointing to an Internet Gateway. Compute instances and load balancers deployed in a public subnet can be assigned public IP addresses, enabling direct communication with the public internet.
  • Private subnets: Have no direct route to an Internet Gateway. Instances located in private subnets receive only private IP addresses and cannot be reached directly from the internet. Application servers, background workers, and managed databases should always reside in private subnets.

When workloads in private subnets need outbound internet access (such as downloading operating system updates, pulling container images, or calling third-party APIs), traffic is routed through a located in a public subnet. The NAT gateway translates private IP addresses to its own public IP, allowing outbound connections while dropping unsolicited inbound connection attempts. Because NAT gateways charge per gigabyte of processed data, routing high-volume data transfers through a NAT gateway can quickly inflate network bills.

Firewalls and microsegmentation

At the network interface level, a acts as a stateful virtual firewall controlling inbound and outbound traffic. Security groups operate on an implicit default-deny model: any connection that is not explicitly permitted by an ingress rule is blocked. Because security groups are stateful, return traffic for initiated outbound connections is automatically allowed without requiring an explicit rule.

Rather than authoring firewall rules using static IP addresses, best practice is to reference other security groups as traffic sources. For example, a database security group can allow inbound connections on port 5432 strictly from the application server security group. As the application tier dynamically scales up and down, newly launched instances automatically inherit database access without requiring manual updates to firewall rule sets.

Opening a port

Enforce defense-in-depth by restricting firewall rules to specific security group origins.

  1. Specify the security group identifier of the calling service tier as the allowed source, rather than open IP CIDR blocks.
  2. Authorize only the exact TCP or UDP port required for the application protocol.
  3. Never allow internet-wide access (0.0.0.0/0) on internal application or database ports.
  4. Restrict 0.0.0.0/0 exposure exclusively to external load balancers on standard web ports (80 and 443).

Load balancers

A managed load balancer acts as the public entryway into the private cloud network. It hosts the public IP address, terminates TLS connections, conducts continuous health checks on backend instances, and balances traffic across multiple availability zones.

Providers supply two primary load balancer variants:

  • Layer 4 load balancers: Operate at the transport layer (TCP/UDP), delivering ultra-high throughput and sub-millisecond latency for raw socket connections.
  • Layer 7 load balancers: Operate at the application layer (HTTP/HTTPS), inspecting request paths, headers, and hostnames to route traffic across heterogeneous microservice backends behind a single public domain.

DNS and managed certificates

Managed DNS services resolve public and private domain names, routing client traffic to load balancers, cloud storage buckets, or health-checked multi-region failover endpoints. Integrated certificate managers automate the provisioning, domain validation, and annual renewal of TLS certificates on load balancers, eliminating service outages caused by expired certificates.

Private connections to cloud services

Managed cloud services—such as object storage buckets and serverless message queues—typically expose public endpoints. By default, traffic from an internal compute instance to an object bucket would travel out through the NAT gateway across the public internet.

A (or private link) provisions an elastic network interface with a private IP directly inside your VPC, routing traffic to provider services entirely over the cloud platform's internal optical network backbone. Using private endpoints improves throughput, eliminates NAT gateway bandwidth processing charges, and ensures sensitive internal traffic never traverses the public internet.

Interconnecting networks

Connecting a cloud VPC to on-premises enterprise data centers is achieved via encrypted IPsec VPN tunnels across the public internet or through dedicated, physical leased lines.

Connecting separate VPCs within the cloud environment is accomplished through VPC . Peering routes traffic across the cloud provider's high-speed backbone using private IP addresses as if all resources resided on a single unified network, avoiding public internet transit.

Where network costs accumulate

Data transfer within a single availability zone is generally free. However, routing traffic between different availability zones within the same region incurs small per-gigabyte fees, and outbound internet traffic carries significant metered charges. Architecting applications to keep chatty inter-service calls within the same zone and offloading public media distribution to content delivery networks (CDNs) prevents unexpected network expenses.

Terms introduced

  • Virtual private cloud: your own private network inside the provider, with an address range you choose.
  • CIDR: the notation for an address range, where the number after the slash fixes how many addresses it holds.
  • Subnet: a slice of the network in one zone, public if it routes to the internet and private if not.
  • NAT gateway: the way out for private subnets, letting traffic leave and replies return.
  • Security group: a stateful allow-list of sources and ports attached to a resource.
  • Private endpoint: an address inside your network for a managed service, so calls to it never leave.
  • Peering: joining two private networks so their addresses can reach each other.

How providers do it

Software-defined networking across the major cloud platforms incorporates familiar constructs—virtual networks, subnets, route tables, firewalls, and private endpoints. However, the scope of these boundaries differs significantly: AWS subnets are strictly zonal, Azure subnets span entire regions, and Google Cloud VPCs operate globally across all regions by default.

ConceptAWSAzureGoogle Cloud
Virtual private cloudAmazon VPC (scoped to a single region)Azure Virtual Network (VNet; scoped to a single region)Google Cloud VPC (global across all regions)
Subnet scopingZonal (confined to a single availability zone)Regional (spans all availability zones in the region)Regional (spans all zones in the region)
Public subnet modelRoute table directs 0.0.0.0/0 to an Internet GatewaySubnet route table allows internet route; instances use public IPsNo explicit public subnet concept; instances attach external IPs
Outbound NAT serviceAWS NAT GatewayAzure NAT GatewayGoogle Cloud NAT
Interface firewallSecurity group (stateful); Network ACLs (stateless)Network Security Group (NSG); Application Security GroupsVPC firewall rules (targeted via network tags or service accounts)
Load balancing tiersApplication Load Balancer, Network Load BalancerAzure Application Gateway, Azure Load Balancer, Azure Front DoorGoogle Cloud Load Balancing (external/internal, Layer 4/Layer 7)
Managed DNS serviceAmazon Route 53Azure DNS, Azure Private DNSGoogle Cloud DNS
Automated TLS certificatesAWS Certificate Manager (ACM)Azure Key Vault certificates, Front Door managed certificatesGoogle Cloud Certificate Manager
Private service endpointsAWS VPC Endpoints (Interface via PrivateLink, Gateway)Azure Private Link, Private EndpointsPrivate Service Connect, Private Google Access
Network peering and transitVPC Peering, AWS Transit GatewayVNet Peering, Azure Virtual WANVPC Network Peering, Shared VPC
Hybrid premises connectivityAWS Site-to-Site VPN, AWS Direct ConnectAzure VPN Gateway, Azure ExpressRouteGoogle Cloud VPN, Google Cloud Interconnect
Edge content deliveryAmazon CloudFrontAzure Front Door, Azure CDNGoogle Cloud CDN

Every product name and technical mapping above is confirmed against provider documentation. Specific transitional policies regarding default outbound internet connectivity are marked unconfirmed in the provider tabs below.

The geographic scope of a VPC is an essential design factor:

  • AWS and Azure treat virtual networks as regional constructs; connecting workloads across multiple regions requires inter-region VPC peering or managed transit hubs (AWS Transit Gateway or Azure Virtual WAN). Furthermore, in AWS, each individual subnet exists strictly within a single availability zone.
  • Google Cloud implements VPCs as global software-defined networks. A single Google Cloud VPC spans every region worldwide, containing regional subnets that automatically communicate across Google's private global fiber network without requiring peering or VPN configurations.

What this maps to: Amazon VPC. The core page's layout is AWS's layout. The VPC is regional and subnets are zonal, with a route table deciding which subnets are public.

ConceptOn AWSStatus
Virtual private cloudA VPC, in one region, with a CIDR you chooseconfirmed
SubnetZonal. A subnet is public if its route table sends 0.0.0.0/0 to an Internet Gatewayconfirmed
NAT gatewayNAT Gateway, one per AZ for resilience, billed per hour and per GBconfirmed
Security groupSecurity group, stateful, attached to network interfaces. Network ACLs are a second, stateless layer on the subnetconfirmed
Load balancerALB (layer 7) and NLB (layer 4). Gateway Load Balancer for third-party appliancesconfirmed
DNSRoute 53, public and private zones, with health checks and routing policies for failover across regionsconfirmed
CertificatesAWS Certificate Manager (ACM), free for certificates used on ALB and CloudFront, auto-renewedconfirmed
Private endpointVPC endpoints: gateway endpoints for S3 and DynamoDB at no charge, interface endpoints (PrivateLink) for everything else, billed per hour and per GBconfirmed
PeeringVPC peering, non-transitive. Transit Gateway for a hub joining many VPCs and on-premises networksconfirmed
Connection to your premisesSite-to-Site VPN over the internet; Direct Connect for a dedicated lineconfirmed
Cross-zone trafficCharged per GB in each directionunconfirmed; check current pricing

Their vocabulary

Standard termTheir term
Private networkVPC
Door to the internetInternet Gateway
Address inside the network for a serviceVPC endpoint
Content deliveryCloudFront

Where to look

Reachability Analyzer, in the VPC console, answers whether A can reach B and, if not, which rule is stopping it. VPC Flow Logs record what was accepted and what was rejected.

Last verified: never.


Check your understanding

0 of 4 answered

  1. Where should a database sit, and why?
  2. What is the advantage of a security group rule that names another security group as its source, rather than an address range?
  3. Two teams each built a private network on 10.0.0.0/16. What happens when they need to connect them?
  4. A machine in a private subnet needs to download packages from the internet. How does the traffic get out?