Trace a request through a VPC
Follow one HTTPS request through subnet routes, security groups, network ACLs, a load balancer, and the return path.
LESSON GOALS
By the end, you can
- Decide whether a subnet is public or private from its route and addressing—not its name.
- Trace a request in both directions and identify the first route, security, or load-balancer gate that fails.
01
Start with addresses and intended flows
Before adding AWS services, draw the endpoints. Write the source, destination, protocol, and port for every flow that must work. A web request might enter on HTTPS 443 and continue from a load balancer to an application on TCP 8080.
A VPC uses a CIDR block: a range of IP addresses reserved for the network. Divide it into non-overlapping subnet CIDRs with room for growth. Each subnet belongs to one Availability Zone.
A subnet is public only when its associated route table sends internet traffic to an attached internet gateway. For IPv4, the resource also needs the required public address mapping. Calling a subnet “public” changes nothing.
A private application subnet has no direct route to an internet gateway. Its targets can still receive requests from a public load balancer because the load balancer forwards traffic over VPC routing.
02
A route finds a path; it does not grant access
A route table answers “where should this packet go next?” It does not answer “is this caller allowed?” AWS selects the most specific matching route in the table associated with the subnet.
An attached internet gateway is useless when the selected route does not point to it. Editing a route table that is not associated with the subnet is also useless. Inspect the effective association and selected prefix.
A security group is a stateful allow-only control attached to a resource. The app security group can allow TCP 8080 from the load balancer security group instead of allowing every address in the VPC.
A network access control list, or NACL, is an ordered stateless control at the subnet boundary. It supports allow and deny rules. Because it is stateless, request and response need matching rules in their own directions.
Debug in order: route first, then permission. Opening a security group cannot repair a missing route, and adding a route cannot override a security-group or NACL denial.
03
Trace forward, then trace the return
Trace the forward path: client, internet gateway, public-subnet route and NACL, load-balancer security group, listener, target health, target security group, and application port.
Then trace the response. Security groups remember an allowed connection, so return traffic for that connection is allowed. NACLs remember nothing; their outbound rules must allow the response, including the required ephemeral ports.
If the request reaches the app but the response disappears at the subnet edge, inspect the outbound NACL. If the load balancer cannot reach a healthy target, compare its listener and target port, then confirm that the target security group trusts the load balancer security group.
Stop at the first failed gate and change only that gate. Changing several routes and controls together may restore traffic while hiding the cause and widening access.
Two Availability Zones help only when the complete path and enough capacity survive in either zone. Remove one zone, then replay both forward and return paths.
DECISION TABLE
Compare the architecture constraints
| requirement | choose | because | reject |
|---|---|---|---|
| ALB to app only | Target SG references ALB SG on app port | Stateful per-resource identity. | Open app SG to entire VPC. |
| Subnet explicit CIDR deny | Ordered NACL | NACL supports deny. | SG has no deny. |
| Public HTTP entry/private app | Public ALB with private targets | Only front door is public. | Public IP on every app. |
GUIDED WORKED SCENARIO
Reason from the stated constraints
This is a guided example, not a question to memorise. The knowledge check uses new situations to test the same reasoning.
Build 10.20.0.0/16 across two AZs. An internet ALB listens on 443 in public /24s and forwards to four private /24 app targets on 8080. Diagnose missing IGW route, ALB SG deny, target SG deny, or NACL return deny.
Requirements
- HTTPS public entry only.
- No app public IP/default IGW route.
- Two public/two private subnets.
- ALB-to-app TCP 8080 only.
- Trace forward and return.
Reasoning path
- Resolve ALB DNS/entry.
- Select public route to IGW.
- Evaluate public NACL/ALB SG.
- Evaluate listener, target SG/health.
- Evaluate SG state and NACL return.
Why it wins
- Only managed entry is exposed.
- Ordered trace identifies first failed gate.
- Two-AZ placement addresses AZ failure with enough surviving capacity.
Why the alternatives lose
Expands direct exposure/bypasses ALB-only flow.
Becomes correct when: Each instance is intentionally public.Coarse/stateless and return-port prone.
Becomes correct when: Explicit subnet deny is needed alongside SGs.The original app placement forbids direct internet routing.
Becomes correct when: Resources are intentionally public, the subnet routes to an attached IGW, and required public addressing and controls exist.INTERACTIVE ARCHITECTURE VISUAL
Find the first failed VPC gate
Trace HTTPS through a public ALB to a private app, then follow the response. Change one route or permission at a time.
× Request stopsThe request reaches the app, but the stateless NACL denies the ephemeral return port.
Read the diagram as text
Read the request in order: client → internet gateway → public route and NACL → ALB security group and listener → target security group and app → stateful SG return and stateless NACL return. Stop at the first failed gate.
KNOWLEDGE CHECK
Answer one question at a time
Pass every question to complete this lesson. Each answer includes reasoning before you continue.
KEY TERMS
Glossary
- VPC
- A logically isolated AWS network with an IP address range.
- CIDR block
- A notation for an IP address range, such as 10.20.0.0/16.
- Subnet
- A slice of a VPC CIDR in one Availability Zone.
- Route table
- Rules that choose the next hop for traffic leaving a subnet.
- Internet gateway (IGW)
- A VPC attachment for correctly routed public internet traffic.
- Security group (SG)
- A stateful allow-only control attached to supported resources.
- Network ACL (NACL)
- An ordered, stateless allow-and-deny control at a subnet boundary.
- Application Load Balancer (ALB)
- A Layer 7 entry point that forwards HTTP or HTTPS requests.
- Listener
- A load-balancer rule that accepts a protocol and port.
- Ephemeral port
- A temporary client-side port commonly used for response traffic.
PRIMARY SOURCES
Verify the claims
- primaryWhat is Amazon VPC?aws-net-vpc · retrieved 2026-07-29
- primaryEnable internet access for a VPC using an internet gatewayaws-vpc-internet-gateway-access · retrieved 2026-07-30
- primaryControl traffic to your AWS resources using security groupsaws-vpc-security-groups · retrieved 2026-07-30
- primaryControl subnet traffic with network access control listsaws-vpc-network-acls · retrieved 2026-07-30
- primaryWhat is Elastic Load Balancing?aws-compute-elb · retrieved 2026-07-29
- primaryVpc Route Tablesaws-vpc-route-tables · retrieved 2026-07-30
- primaryVpc Route Priorityaws-vpc-route-priority · retrieved 2026-07-30