Skip to content

Network

The network components decide who can talk to whom. In the cloud you do not plug cables; you draw a private network (VPC), cut it into subnets, decide which subnets can be reached from the internet, give private machines a controlled way out (NAT gateway), connect other networks (VPN) and, inside a cluster, put a programmable layer between services (service mesh). Good network design is mostly about isolation: the database of BoxOffice should be unreachable from the internet no matter what bug the application has.

In the playground, vpc and subnet are group frames (rectangles you draw around nodes, with a region or availability-zone label used by outage events), nat and vpn are nodes in the request path, and mesh is a side node that services attach to.

Component One-liner Playground id
VPC Your private, isolated network in a cloud region vpc
Subnet A slice of the VPC in one availability zone, public or private subnet
NAT Gateway Lets private machines call the internet without being reachable from it nat
VPN An encrypted tunnel between networks (office, data center, another cloud) vpn
Service Mesh Proxies next to every service: mTLS, retries, timeouts, traffic split, telemetry mesh
flowchart LR
    U[Internet users] --> IGW[Internet gateway]
    subgraph VPC["VPC 10.0.0.0/16 (one region)"]
      subgraph PUB["Public subnets (AZ a, AZ b)"]
        LB[Load Balancer]
        NAT[NAT Gateway]
      end
      subgraph PRIV["Private subnets (AZ a, AZ b)"]
        APP[App Servers]
        DB[(SQL Database)]
      end
    end
    IGW --> LB --> APP --> DB
    APP -->|outbound only| NAT --> PSP[Payment provider]
    VPC <-->|VPN tunnel| DC[Office / data center]

VPC

What it is. A Virtual Private Cloud is a logically isolated network that you own inside a cloud region. You choose its private address range (for example 10.0.0.0/16, 65,536 addresses), and nothing gets in or out unless you add gateways and routes. Everything else (subnets, route tables, security groups, gateways) lives inside a VPC. Think of it as the building; subnets are the floors and security groups are the locks on each door.

When to use.

  • Always, for anything that runs on cloud virtual machines, containers or managed databases: a production system lives in at least one VPC.
  • Separate VPCs (or accounts/projects) per environment (production, staging) so a mistake in staging cannot touch production data.
  • One VPC per region for multi-region designs, connected by peering or a transit gateway when services must talk across regions.

When not to (or watch out).

  • Do not create many small VPCs per service "for isolation" without need: connecting them (peering, transit) adds cost and complexity. Use security groups and subnets for isolation inside one VPC.
  • Plan the address range: overlapping ranges cannot be peered or connected by VPN later. Pick non-overlapping /16 blocks per environment and region from day one.
  • Fully serverless designs (managed functions, managed APIs) may not need a VPC at all, until they must reach a private database.

Key numbers.

Metric Typical value Note
Address range /16 (65,536 IPs) is a common choice Private ranges from RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Scope one region, spanning all its availability zones Subnets are per zone
Round trip inside an AZ β‰ˆ 0.1–0.5 ms Same-datacenter order of magnitude
Round trip between AZs of a region β‰ˆ 1–2 ms β‰ˆ illustrative; check your provider
Cost of the VPC itself free You pay for gateways, cross-AZ traffic and egress

Failure modes.

  • Overlapping CIDR blocks β€” two VPCs (or the office network) with the same range cannot be connected β†’ an address plan from the start.
  • Everything in one AZ β€” the VPC spans the region, but if all subnets are in one zone, an AZ outage takes the system down β†’ subnets in at least two AZs.
  • Accidental exposure β€” an internet gateway route on a database subnet, or a security group open to 0.0.0.0/0 β†’ private subnets for data, least-privilege security groups, policy checks in infrastructure as code.
  • IP exhaustion β€” a small range fills up as Kubernetes pods take IPs β†’ size generously or use secondary ranges.

In the playground. vpc is a group frame: draw it around the nodes of one region; it carries a name and a region label. A region outage event takes down every node inside the frame tagged with that region, which is how the multi-region scenario shows why one VPC is never a disaster-recovery plan. The frame itself costs nothing and adds no latency. Scenarios: multi-region, observability-stack.

Real products.

  • Amazon VPC β€” regional private network with subnets per AZ, route tables, security groups and network ACLs.
  • AWS Transit Gateway β€” hub that connects many VPCs and on-premises networks.
  • VPC network β€” global VPC whose subnets are regional; firewall rules and routes at the network level.
  • Shared VPC β€” one host project's network used by many service projects.
  • Azure Virtual Network (VNet) β€” regional private network with subnets and network security groups.
  • Virtual network peering β€” connects VNets across regions.
  • No direct equivalent: a VPC is a cloud abstraction. On your own hardware the same ideas are VLANs and routing; in OpenStack, Neutron networks; locally, Docker networks and kind/minikube cluster networks play the role of isolated networks.

In the interview

"Everything runs in a VPC with subnets in at least two availability zones: only the load balancer is public; services and databases sit in private subnets, and security groups allow only the calls the design needs."

Learn more: Network & security β€Ί Cloud network Β· Reliability β€Ί Disaster recovery Β· Cloud-native β€Ί Kubernetes


Subnet

What it is. A subnet is a range of addresses inside the VPC that lives in one availability zone. What makes a subnet public or private is its route table: a public subnet has a route to the internet gateway (so resources with public IPs are reachable), a private subnet does not (its outbound internet traffic, if any, goes through a NAT gateway). Security groups (stateful, per resource) and network ACLs (stateless, per subnet) add the firewall rules.

When to use.

  • The classic three-tier layout per AZ: public subnets for load balancers and NAT gateways, private subnets for application servers, isolated/data subnets for databases and caches with no internet route at all.
  • Duplicate each tier in at least two AZs, so the load balancer and the database can fail over between zones.
  • Separate subnets when different rules apply (for example a subnet for Kubernetes nodes, another for managed databases).

When not to (or watch out).

  • Do not put application servers in public subnets "to make it easier": every server with a public IP is an attack surface.
  • Subnets do not replace security groups: inside a VPC, subnets route to each other by default; the security group is what blocks app β†’ db from the wrong service.
  • Cross-AZ traffic is usually billed per GB: chatty services spread over zones cost more than you expect.

Key numbers.

Metric Typical value Note
Typical size /24 (256 addresses) to /20 (4,096) Clouds reserve a few addresses per subnet (AWS reserves 5)
AZs per design 2–3 Most regions offer 3 or more
Cross-AZ data transfer β‰ˆ USD 0.01 per GB in each direction β‰ˆ approximate (2026), AWS-style pricing
Security group rule evaluation stateful: replies are allowed automatically NACLs are stateless: both directions need rules

Failure modes.

  • AZ outage β€” every subnet in that zone disappears β†’ redundant subnets and replicas in another AZ, load balancer spanning zones.
  • Wrong route table β€” a "private" subnet with a route to the internet gateway, or a private subnet without a NAT route that can no longer reach the payment provider β†’ infrastructure as code with review; test outbound calls after changes.
  • IP exhaustion β€” pods or functions consume all addresses and new instances cannot start β†’ larger ranges, separate pod ranges.
  • NACL blocking replies β€” stateless rules forget the ephemeral reply ports β†’ prefer security groups for most rules.

In the playground. subnet is a group frame like vpc, drawn inside it, with an availability-zone label (a, b, …). An AZ outage event takes down every node inside the frames of that zone. Put two replicas of app and a database replica in two different subnet frames and watch the load balancer keep serving when one zone fails. Scenarios: scale-out, multi-region, db-replicas.

Real products.

  • VPC subnets β€” per-AZ subnets with route tables, security groups and network ACLs.
  • Subnets β€” regional (they span the zones of a region); VPC firewall rules and network tags control access.
  • VNet subnets β€” with network security groups (NSGs) and route tables; delegated subnets for managed services.
  • On Kubernetes, NetworkPolicy (enforced by CNIs such as Calico or Cilium) plays the role of security groups between pods.
  • On Linux hosts, iptables / nftables implement the same filtering ideas.

In the interview

"Three tiers per zone, two zones: public subnets hold only the load balancer and the NAT gateway, private subnets hold the services, and the database subnets have no internet route at all β€” so a bug in the app can't expose the database directly."

Learn more: Network & security β€Ί Cloud network Β· Network & security β€Ί Zero trust Β· Estimation β€Ί Availability math


NAT Gateway

What it is. Network Address Translation lets machines with private addresses open connections to the internet while staying unreachable from it. The NAT gateway sits in a public subnet; private subnets route their internet-bound traffic to it; it rewrites the source address to its own public IP and keeps track of each connection so replies find their way back. BoxOffice's payment service in a private subnet calls the payment provider through the NAT gateway.

When to use.

  • Private services that must call external APIs (payment providers, email services, package registries, LLM providers) or pull container images and updates.
  • When an external partner needs to allow-list your traffic: all calls leave from the NAT gateway's fixed public IP(s).

When not to (or watch out).

  • Traffic to the cloud provider's own services (object storage, queues) should not go through NAT: use private endpoints / VPC endpoints, which are cheaper and never leave the provider's network.
  • NAT gateways are billed per hour and per GB processed: a chatty service downloading large files through NAT can cost more than the servers.
  • One NAT gateway per AZ: a single NAT in one zone is a single point of failure and adds cross-AZ charges.
  • Not for inbound traffic: if something must be reachable from the internet, it goes behind a load balancer.

Key numbers.

Metric Typical value Note
Price β‰ˆ USD 0.045 per hour + β‰ˆ USD 0.045 per GB processed β‰ˆ approximate AWS list price (2026); other clouds are similar in shape
Bandwidth scales to tens of Gbps per gateway (AWS documents up to 100 Gbps) Check provider limits
Concurrent connections to one destination tens of thousands per public IP (port range) Port exhaustion is a real limit; add IPs
Added latency β‰ˆ sub-millisecond Negligible compared with the external call

Failure modes.

  • Port exhaustion β€” many connections to the same destination IP and port use up the source ports β†’ connection pooling and keep-alive, more NAT IPs.
  • Zonal failure β€” one NAT gateway for all zones fails or its zone goes down β†’ one NAT per AZ, each zone's private subnets route to their own.
  • Cost surprise β€” logs, images or backups flowing through NAT β†’ VPC endpoints for provider services, look at the per-GB line of the bill.
  • Missing route β€” after a network change, private services silently lose outbound access (timeouts to the provider) β†’ synthetic checks of outbound dependencies.

In the playground. nat is a call node placed between private services and external nodes (payment, email, thirdparty). It has a capacity (default 100,000 req/s) and a per-GB cost (payloadKB, default 20 KB per request, at β‰ˆ 0.045 USD/GB) that shows up in the cost panel; when its capacity is exceeded, calls to the outside queue and time out. Scenarios: payment-system, notification-system.

Real products.

  • NAT Gateway β€” managed, per-AZ NAT with elastic IPs.
  • VPC endpoints (Gateway / Interface, PrivateLink) β€” reach S3, DynamoDB, SQS and others without NAT.
  • Cloud NAT β€” managed, software-defined NAT for VMs and GKE nodes without external IPs.
  • Private Google Access / Private Service Connect β€” reach Google APIs privately.
  • Azure NAT Gateway β€” managed outbound connectivity for subnets.
  • Private Endpoint / Private Link β€” private access to Azure services.
  • Linux iptables / nftables masquerading on a VM (a "NAT instance") β€” cheap, but you own its availability.
  • Kubernetes egress gateways (for example Istio egress gateway) centralize and control outbound traffic.

In the interview

"Services stay in private subnets; outbound calls to the payment provider go through a NAT gateway per zone with fixed IPs the provider can allow-list, and traffic to the cloud's own services uses private endpoints so it doesn't pay NAT per-GB fees."

Learn more: Network & security β€Ί Cloud network Β· Compute β€Ί Integrations Β· Cloud-native β€Ί FinOps


VPN

What it is. A Virtual Private Network is an encrypted tunnel that joins two networks over the internet as if they were one. Site-to-site VPNs (usually IPsec) connect a VPC to an office, a data center or another cloud; client VPNs let a person's laptop join the private network. For higher bandwidth and steadier latency, companies use dedicated interconnects (a private fiber link to the cloud) instead of, or in addition to, VPNs.

When to use.

  • Hybrid systems: BoxOffice's legacy box-office system in a stadium data center must reach the inventory service in the cloud privately.
  • Connecting two clouds or two companies' networks for a specific integration.
  • Administrative access to private resources (although modern practice prefers identity-aware proxies and bastion-less access; see zero trust).

When not to (or watch out).

  • Not a security model by itself: "inside the VPN = trusted" is exactly what zero trust rejects. Authenticate and authorize every call anyway.
  • Throughput of a single IPsec tunnel is limited (on the order of 1 Gbps per tunnel on major clouds); heavy data transfer needs several tunnels or a dedicated interconnect.
  • Latency is that of the internet path plus encryption: do not put a VPN hop in a latency-critical synchronous path if you can avoid it.

Key numbers.

Metric Typical value Note
Throughput per IPsec tunnel β‰ˆ up to 1.25 Gbps (AWS Site-to-Site VPN) β‰ˆ approximate; aggregate several tunnels for more
Added latency β‰ˆ 5–20 ms over the internet path Depends on distance; the playground uses a median of 10 ms (β‰ˆ 5–20 ms)
Dedicated interconnect 1–100 Gbps ports Private, steadier latency, higher fixed cost
Availability two tunnels per connection (redundant endpoints) Configure both; one is maintained at a time

Failure modes.

  • Tunnel down β€” key renegotiation fails or the customer-side device reboots β†’ two tunnels (and ideally two devices), dynamic routing (BGP) for automatic failover, alerting on tunnel status.
  • Bandwidth saturation β€” a backup job saturates the tunnel and the interactive traffic suffers β†’ quality of service, separate tunnels, or an interconnect.
  • MTU problems β€” encryption overhead makes large packets fragment or drop, causing mysterious hangs β†’ lower MTU / MSS clamping.
  • Over-trust β€” a compromised laptop on the VPN reaches everything β†’ least privilege, segmentation, zero-trust access.

In the playground. vpn is a call node that adds latency (median 10 ms, lognormal: roughly 5–20 ms) and can fail as a unit; use it to connect a frame representing an on-premises system to cloud services and see how a synchronous call over a VPN shows up in the p99. Scenarios: multi-region, cascading-failure (add a VPN hop to the slow path and compare).

Real products.

  • AWS Site-to-Site VPN β€” IPsec tunnels to a virtual private gateway or transit gateway.
  • AWS Client VPN β€” managed OpenVPN-based remote access.
  • AWS Direct Connect β€” dedicated private connection.
  • Cloud VPN (HA VPN) β€” IPsec with a 99.99% SLA in the high-availability configuration.
  • Cloud Interconnect β€” dedicated or partner interconnect.
  • Azure VPN Gateway β€” site-to-site and point-to-site VPN.
  • Azure ExpressRoute β€” private dedicated connectivity.
  • WireGuard β€” modern, small and fast VPN protocol built into Linux.
  • OpenVPN β€” mature TLS-based VPN.
  • strongSwan β€” IPsec implementation for site-to-site tunnels.

In the interview

"To reach the legacy system in the stadium I'd use a redundant site-to-site VPN (or an interconnect if the volume is high), keep that call off the synchronous purchase path, and still authenticate every request: being on the VPN doesn't make a caller trusted."

Learn more: Network & security β€Ί Cloud network Β· Network & security β€Ί Zero trust


Service Mesh

What it is. A service mesh puts a proxy next to every service (a sidecar in each pod, or a per-node proxy in ambient mode) and routes all service-to-service traffic through those proxies. A control plane configures them. Without changing application code you get mutual TLS (mTLS: both sides prove their identity and the traffic is encrypted), retries, timeouts, circuit breaking, traffic splitting for canaries, and uniform metrics and traces for every call.

When to use.

  • Many services (tens or more) owned by different teams, where implementing mTLS, retries and telemetry consistently in every codebase is impractical.
  • Zero-trust requirements inside the cluster: every call authenticated by workload identity, with policies such as "only order may call payment".
  • Progressive delivery: send 5% of catalog traffic to the new version and shift gradually.

When not to (or watch out).

  • A handful of services: a library (Resilience4j, an OpenTelemetry SDK) and the platform's mTLS are simpler. A mesh is a platform to operate, with its own upgrades and failure modes.
  • Every hop through a proxy adds latency (sidecars add two proxies per call) and memory per pod; with deep call chains this adds up.
  • Retries in the mesh and in the application multiply each other (3 Γ— 3 = 9 attempts): decide where retries live.

Key numbers.

Metric Typical value Note
Added latency per hop β‰ˆ 1 ms or less at p50, more at the tail β‰ˆ illustrative; depends on mode, features and load; the playground adds ~1 ms per hop
Sidecar memory tens of MB per pod Ambient / per-node modes reduce it
mTLS certificate lifetime hours to a day, rotated automatically Short-lived identities limit the damage of a leak
Traffic split granularity 1% steps (or finer) Used for canaries

Failure modes.

  • Control plane outage β€” proxies keep their last configuration, but new pods may not get certificates or routes β†’ run the control plane highly available, monitor certificate expiry.
  • Retry amplification β€” retries at several layers turn a blip into a storm β†’ retry budgets, retries in one layer only.
  • Misconfigured policy β€” a deny-by-default rule blocks a legitimate call after a deploy β†’ policy tests in CI, staged rollout of policies.
  • Proxy resource starvation β€” sidecars without enough CPU become the bottleneck β†’ set requests and limits for proxies, watch their metrics.

In the playground. mesh is a side node, not a box in the request path: the services attached to it pay about 1 ms of sidecar overhead per outgoing hop and get the mesh defaults on every edge that sets none β€” timeout meshTimeoutMs (1,000 ms), meshRetries (2) with exponential backoff and jitter, and a circuit breaker. A mesh attached to metrics makes every attached service observed. (mTLS is assumed, not simulated.) Try the cascading-failure scenario with and without a mesh, then compare with setting timeoutMs and circuitBreaker by hand on the edges. Scenarios: cascading-failure, retry-storm, observability-stack.

Real products.

  • Amazon VPC Lattice β€” managed service-to-service networking with auth policies across VPCs and accounts.
  • Istio on Amazon EKS β€” the common self-managed choice (AWS App Mesh has been discontinued).
  • Cloud Service Mesh β€” managed, Istio-based mesh for GKE and VMs.
  • Istio-based service mesh add-on for AKS β€” managed Istio in Azure Kubernetes Service.
  • Istio β€” the most widely used mesh; sidecar and ambient modes, built on Envoy.
  • Linkerd β€” lightweight mesh with its own Rust proxy, focused on simplicity.
  • Cilium Service Mesh β€” eBPF-based networking with mesh features.
  • Envoy β€” the proxy underneath many meshes and gateways.

In the interview

"With dozens of services I'd use a mesh to get mTLS, timeouts, retries and telemetry on every call without touching code β€” but it costs latency per hop and a platform to run, so with five services I'd use libraries instead, and I'd keep retries in one layer only."

Learn more: Network & security β€Ί Service mesh Β· Network & security β€Ί Zero trust Β· Reliability β€Ί Patterns Β· Hands-on 9