Skip to main content
Cloud basicsLesson 2 of 17

How a Request Travels Inside a VPC

A user visits an online store running in the cloud. The request enters your private network in the cloud (a VPC) and passes several gates. Follow what is exposed to the internet and what is hidden, and what each gate lets through or blocks. The basic flow of a request inside a data center comes first in When You Type an Address.

Passing throughInternet
Security group verdict-
Exposed to internetLB address
VPC · your private networkPublic subnetPrivate subnetUserInternet browserExternal repoPackages · patchesInet GWFront doorLoad balancerPublic addressNAT GWOutbound onlyWeb serverNo public IPDBOrders · membersHTTPS request
RequestResponse / reportAppears in a later step

What you will learn

  • What a VPC, a subnet and an internet gateway each are
  • What separates public and private subnets
  • How security groups open doors with allow rules only
  • Responses to allowed requests go out automatically (stateful)
  • How private servers get updates through a NAT gateway

Names for each gate (AWS · Azure · GCP)​

ConceptAWSAzureGCP
Your private networkVPCVirtual Network (VNet)VPC network
Internet doorInternet GatewayDefault internet route, no separate resourceDefault internet gateway route
Outbound-only address translationNAT GatewayNAT GatewayCloud NAT
Stateful firewall in front of serversSecurity GroupNetwork Security Group (NSG)VPC firewall rules
Load balancerElastic Load BalancingLoad Balancer · Application GatewayCloud Load Balancing

Try it yourself​

aws ec2 describe-vpcs --query 'Vpcs[].[VpcId,CidrBlock]' --output table # VPCs (AWS example)
aws ec2 describe-subnets --filters Name=vpc-id,Values=<vpc-id> --query 'Subnets[].[SubnetId,AvailabilityZone,CidrBlock]' --output table # Subnets
aws ec2 describe-route-tables --filters Name=vpc-id,Values=<vpc-id> --query 'RouteTables[].Routes[].[DestinationCidrBlock,GatewayId,NatGatewayId]' --output table # igw route = public, nat route = private
aws ec2 describe-security-groups --group-ids <sg-id> --query 'SecurityGroups[].IpPermissions' # Inbound allow rules
aws ec2 describe-nat-gateways --filter Name=vpc-id,Values=<vpc-id> # NAT gateway for the way out

Check yourself

  1. What makes a subnet "public" rather than "private"?
  2. A web server in a private subnet must download OS security patches. How does it reach the internet?
  3. The web server's security group allows only inbound 443 from the load balancer and has no outbound rule for responses. Do the responses get back to users?

Further reading: What is Amazon VPC? (AWS) · Security groups (AWS) · Service (Kubernetes docs) · When You Type an Address