Topic lessonTopic: VPC: address and connectivity design
What is an internet gateway? VPC public routes and connectivity
An internet gateway (IGW) supports communication between a VPC and the internet. Attaching one does not publish every resource. Use a direct public-IPv4 EC2 example to separate gateway attachment, subnet routing, addressing, traffic controls and application listeners.
Explain the IGW’s role and identify missing requirements across routing, addressing, traffic controls and the application.
Know VPCs, subnets, route tables and security-group permissions. The main example is direct IPv4 access to EC2, with comparisons to IPv6 and NAT. No AWS connection or configuration change is performed.
When a page fails, distinguish the stage before changing settings
Do not diagnose IGW or SG failure from “cannot connect” alone. Separate a failure before a confirmed HTTP response—the status and content returned for a Web request—from a response such as 503. DNS resolution finds an IP address for a name. DNS, TCP connection and TLS are different stages; TLS can fail after TCP connects. Keep the stage unknown when the evidence does not establish it.
| Observed | Evidence to collect first | Scope of this lesson |
|---|---|---|
| No confirmed HTTP response yet | DNS result, destination/port and the failing TCP/TLS stage. A timeout alone does not locate the fault. | For direct IPv4 to EC2, check the IGW, routes, address, controls and listener below. |
| An HTTP response such as 503 arrived | The responding component and matching upstream/ALB/application records. The code alone is not an IGW diagnosis. | Investigate response origin; this does not establish every request or dependency is healthy. |
| A matching log and arrival are unverified | Subject, time, request identity, collection/retention and query scope. Separate missing records from non-arrival. | Record the evidence gap instead of widening SG rules by guesswork. |
The IGW provides a routing target and IPv4 address mapping
An IGW is a managed VPC component, not software you install on an EC2 instance. A subnet route table can select it for internet destinations. For IPv4, the IGW maps the instance’s private address to its public address. The address shown on the instance’s ordinary OS interface can therefore differ from the public IPv4 used by an external client.
- External client → Internet gatewayA request to public IPv4; when using DNS, also verify the name resolves to the intended current destination.
- Internet gateway → EC2 and applicationIPv4 destination mapping delivers traffic into the VPC; the arrow neither guarantees success nor bypasses controls.
- External client
- Use the instance’s current public IPv4 and application port.
- Internet gateway
- Attached to the target VPC; maps public and private IPv4.
- EC2 and application
- Subnet routes, SG/NACL, OS and listener conditions must also match.
Check five layers: gateway, route, address, controls and listener
| Layer | Required condition | What it does not prove |
|---|---|---|
| IGW | An IGW is attached to the correct VPC | Which subnets route to it |
| Route table | The subnet’s effective table has a suitable IGW route | Whether the EC2 instance has public IPv4 or traffic permission |
| Address | The external client uses the instance’s current public IPv4 | Whether the application port is reachable |
| Traffic controls | SG, NACL, OS and client controls permit the intended traffic | Whether the application is listening |
| Application | A listener handles the request on the intended interface and port | Whether other URLs or dependencies are healthy |
A subnet with a direct route to an IGW is public. A typical IPv4 default route is 0.0.0.0/0 → IGW, but it does not override every other route: local VPC routes and more-specific destinations still matter. Public-subnet classification is separate from permission to expose a particular application.
Worked example: an IGW route does not replace public IPv4
| Setting | Example value | Interpretation |
|---|---|---|
| VPC / EC2 private IPv4 | 10.64.0.0/16 / 10.64.0.10 | The instance address is allocated from its subnet |
| Subnet / effective table | 10.64.0.0/24 / rt-ingress | Inspect the actual association, not its name |
| Routes | 10.64.0.0/16 → local; 0.0.0.0/0 → IGW | An IGW route exists |
| Public IPv4 | None | The external client cannot use this direct IPv4 method |
| SG inbound | Application port only from approved sources | An allow rule cannot replace missing public IPv4 |
Choose an option to see the result and explanation.
Even with public IPv4, verify that the client is not using an old destination. Depending on the address allocation method, a stop/start can change an instance’s public IPv4. Match the current instance ID, address and DNS, and review authorization and cost before changing the exposure model.
Separate IPv4, IPv6 and NAT designs
| Method | Role and prerequisites | Important distinction |
|---|---|---|
| Direct IPv4 through IGW | Suitable routing and resource public IPv4 | A public-looking VPC CIDR alone provides neither condition |
| IPv6 through IGW | Compatible IPv6 addresses, IPv6 routes and controls | 0.0.0.0/0 is not an IPv6 route |
| Egress-only IGW for IPv6 | Supports internet connections initiated from inside | It is different from an ordinary IGW and IPv4 NAT gateway |
| IPv4 through public NAT gateway | Translates the source of connections initiated inside | It is not a load balancer for unsolicited inbound application requests |
Choose an option to see the result and explanation.
When access fails, collect evidence first
- Fix the connection method. Verify the resource, destination, port and source without mixing direct IPv4, IPv6, NAT or bastion assumptions.
- Check the IGW attachment and the subnet’s effective route table, including implicit main-table association.
- Match the required address family, current destination address and DNS result.
- Inspect SGs, both NACL directions, OS/client controls and the application listener. A timeout alone is not a diagnosis.
- Identify the missing condition before making an authorized change. Do not replace investigation with worldwide exposure or blanket restarts.
Fixed task: an SG allow does not establish a working return path
| Item | Supplied condition |
|---|---|
| Symptom | A TCP connection to the same destination reports a timeout; no HTTP response is confirmed. |
| Routing and address | For this example, the target VPC IGW, effective subnet routing and current public IPv4 are stipulated correct. |
| Request-side conditions | The intended SG permission, request-direction NACL conditions and TCP 443 application listener are stipulated satisfied. |
| Return-path candidate | On the EC2 subnet, the shown rules 100 and 110 are the only matching numbered egress rules. No earlier rule matches. |
| Unknown | TLS certificate, HTTP response, business result and other clients/requests. A timeout message alone is not a unique diagnosis. |
The request goes from client port 50000 to EC2 port 443; the reply goes from EC2 port 443 to client port 50000. The return path carries the server’s reply back to the client. A network ACL (NACL) allows or denies traffic entering or leaving a subnet, using the first matching rule in ascending number order. In this example the reply’s destination port is 50000, not 443. SG connection state does not turn a NACL denial into an allow.
| NACL number | Matching outbound condition | Action |
|---|---|---|
| 100 | TCP / destination 192.0.2.10/32 / destination port 50000 | Deny |
| 110 | TCP / destination 192.0.2.10/32 / destination port 50000 | Allow |
Choose an option to see the result and explanation.
| Step | What to record for this task |
|---|---|
| Candidate cause | Do not diagnose from the timeout alone. Correlate current EC2-subnet egress NACL rules with the reply destination port; the fixed facts select rule 100 Deny. |
| Missing evidence | In a real investigation, verify subject, time, current rules and both directions. Keep TLS and application results separately unverified. |
| Minimal proposed response | Check whether denial is intentional, confirm design intent and obtain authorization. Review only the needed return scope and first matching rule; record effects on other resources sharing the NACL and a reversal plan. |
| Retest equivalent conditions | Use the same source, destination, method and application port, while checking the current ephemeral port. Verify expected HTTP/business behavior and requests that must remain denied. |
| Completion and unknowns | A proposal alone is not a completed fix. Record actual results and unresolved evidence separately; this lesson performs no real repair. |
Choose the next investigation from the evidence
- When an ALB-based design returns HTTP 503:Investigate an ALB 503 response origin and target →
- When following matching evidence around a 504 or timeout:Correlate request identity, time and logs →
- For synthetic IPv4/TCP conditions within one VPC; IGW and TLS remain outside its scope:Compare one SG/NACL condition in the bounded model →
Check, then explain in your own words
- Explain why IGW attachment and subnet routing are separate settings.
- Separate five checks for an unreachable EC2 instance in a public subnet.
- Distinguish direct IPv4, NAT and egress-only IPv6 approaches.
Check your understanding: Does attaching an IGW publish every EC2 instance in the VPC?
No. Check each subnet’s routes, addressing, controls and application separately.
The IGW is one component. Separating public routing from resource-specific reachability avoids unnecessary changes to exposure or permissions.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
Scope and conditionsInternet-gateway attachment/routing and public IPv4 for the selected direct-internet IPv4 method. Not a complete end-to-end connection guarantee.
Used in this lessonThe IGW provides a routing target and IPv4 address mapping Check five layers: gateway, route, address, controls and listener Worked example: an IGW route does not replace public IPv4 Separate IPv4, IPv6 and NAT designs When access fails, collect evidence first
- Subnet basicsChecked:
Scope and conditionsOne AZ per subnet; address families and route-based public/private/isolated classification, distinct from traffic permission.
Used in this lessonCheck five layers: gateway, route, address, controls and listener
- Subnet route tablesChecked:
Scope and conditionsSubnet associations, implicit main-table use, destinations, targets and IPv4/IPv6 distinction.
Used in this lessonCheck five layers: gateway, route, address, controls and listener Separate IPv4, IPv6 and NAT designs
- How route priority worksChecked:
Scope and conditionsLongest matching prefix and additional priority rules for overlapping/static/propagated routes; route selection is not a connection test.
Used in this lessonCheck five layers: gateway, route, address, controls and listener
- Security group rulesChecked:
Scope and conditionsAllow-rule fields, associated-rule aggregation and effects of changes; not universal application reachability.
Used in this lessonThe IGW provides a routing target and IPv4 address mapping Check five layers: gateway, route, address, controls and listener
- Network ACL rulesChecked:
Scope and conditionsDirection, protocol, port, peer CIDR and first matching rule in ascending order.
Used in this lessonThe IGW provides a routing target and IPv4 address mapping Check five layers: gateway, route, address, controls and listener
Scope and conditionsIPv6-only outbound initiation with return traffic, distinct from ordinary IGW and IPv4 NAT.
Used in this lessonSeparate IPv4, IPv6 and NAT designs
- NAT gatewaysChecked:
Scope and conditionsInitiated outbound connections; public/private NAT connectivity, IPv4 translation and IPv6 DNS64/NAT64 boundaries. Zonal placement is distinguished from regional mode.
Used in this lessonSeparate IPv4, IPv6 and NAT designs
Scope and conditionsPrivate/public address distinction and auto-assigned public IPv4 release/reassignment on stop/start; not a promise about every allocation method.
Used in this lessonWorked example: an IGW route does not replace public IPv4
- Amazon VPC pricingChecked:
Scope and conditionsPublic IPv4 and NAT gateway pricing dimensions, including retained/idle addresses; no unit-rate quote.
Used in this lessonWhen access fails, collect evidence first
Scope and conditionsThe initiating client selects an ephemeral port, with ranges varying by client/OS; the fixed 50000 example is not a permanent rule recommendation.
Used in this lessonFixed task: an SG allow does not establish a working return path
- Internet gatewaysChecked:
Scope and conditionsIGW, routing and public-IPv4 conditions for direct IPv4; not a real connectivity test.
Used in this lessonWhen a page fails, distinguish the stage before changing settings
- Network access control listsChecked:
Scope and conditionsFirst-match rule order, stateless return traffic and subnet boundaries; the fixed example is not raw configuration.
Used in this lessonFixed task: an SG allow does not establish a working return path
- Security groupsChecked:
Scope and conditionsStateful responses to allowed connections do not replace NACL permission.
Used in this lessonFixed task: an SG allow does not establish a working return path
Scope and conditionsDistinguish connection, naming, certificate and HTTP-origin checks; not automated diagnosis of every Web failure.
Used in this lessonWhen a page fails, distinguish the stage before changing settings Fixed task: an SG allow does not establish a working return path
Scope and conditionsCorrelate origin/actions for the same request; absence from best-effort logs does not prove non-arrival.
Used in this lessonWhen a page fails, distinguish the stage before changing settings