Chapter 15: Amazon VPC — Subnets, Route Tables, NACL, NAT Gateway and Bastion Host
15.6 Route tables: public and private subnets
Near the society gate there is a direction board: "A wing – to the left, parking – downstairs, way out – main gate". A route table is exactly like that – it tells every packet which way to go. And what is a public subnet? The wing whose board says "way out – main gate" is the public one. No magic beyond that.
Society च्या gate जवळ direction board असतो: "A wing – डावीकडे, parking – खाली, बाहेर जायचं – main gate". Route table अगदी असाच – प्रत्येक packet ला सांगतो कोणत्या दिशेने जा. आणि public subnet म्हणजे काय? ज्या wing च्या board वर "बाहेर – main gate" लिहिलं आहे, तीच public. बाकी काही जादू नाही.
Society के gate के पास direction board होता है: "A wing – बाईं ओर, parking – नीचे, बाहर जाना – main gate". Route table बिल्कुल ऐसा ही है – हर packet को बताता है किस दिशा में जाना है. और public subnet क्या है? जिस wing के board पर "बाहर – main gate" लिखा है, वही public. इसके अलावा कोई जादू नहीं.
A route table is a list of routes. Each route has a destination (such as a CIDR block or supported prefix list) and a target (where to send matching packets). When several routes match, the most specific one (the longest prefix) wins.
- Every route table contains the local route for the VPC CIDR, for example
10.0.0.0/16→local. AWS adds a local route for each associated VPC CIDR. It supplies the ordinary in-VPC path when applicable. Actual traffic also needs the relevant permissions, and supported advanced designs can replace the route target. - Each subnet is associated with exactly one route table. A subnet you do not associate explicitly uses the VPC's main route table.
- One route table can serve many subnets.
Public route table and private route table
public-rt (associated with web-public-1a):
| Destination | Target | Meaning |
|---|---|---|
10.0.0.0/16 |
local |
Traffic inside the VPC stays inside |
0.0.0.0/0 |
igw-... (society-igw) |
Otherwise unmatched IPv4 destinations select the internet gateway in this example. |
private-rt (an app table example showing optional zonal NAT egress):
| Destination | Target | Meaning |
|---|---|---|
10.0.0.0/16 |
local |
Traffic inside the VPC stays inside |
0.0.0.0/0 |
nat-... (NAT gateway, added in 15.9) |
Optional initiated IPv4 internet egress for approved updates. |
What makes a subnet public or private?
The web subnet uses public-rt with a direct IPv4 route to the attached internet gateway. Direct access also needs suitable addressing and permissions. The app subnet uses private-rt and the illustrated optional public zonal NAT gateway for initiated outbound IPv4. Both keep the local route.
Web subnet मधल्या public-rt चा थेट IPv4 route internet gateway कडे आहे. Direct access साठी योग्य IP आणि traffic permissions लागतात. App subnet च्या private-rt मध्ये या उदाहरणापुरता public zonal NAT route आहे. दोन्ही tables मध्ये local route आहे.
Web subnet के public-rt में internet gateway की ओर सीधा IPv4 route है। Direct access के लिए सही IP और traffic permissions भी चाहिए। App subnet के private-rt में इस उदाहरण का public zonal NAT route है। दोनों tables में local route है।
A public subnet has a direct route to an internet gateway. The example uses the IPv4 default 0.0.0.0/0. IPv6 and more specific destinations can have separate routes. A private subnet has no direct route to an internet gateway and may use suitable private connections, endpoints, optional outbound egress or only local routing.
| Public subnet | Private subnet | |
|---|---|---|
| Example routes | Direct internet-gateway route, commonly 0.0.0.0/0 for IPv4 and ::/0 for IPv6 |
Private routes, optional appropriate NAT or IPv6 egress-only routing, or local only |
| Public IPv4 addressing | Check the actual public association. The route does not assign an address. | Typically omitted for private workloads. An association alone cannot create a direct route. |
| Direct access through IGW | Possible with appropriate addressing, route, policy and listener. | No direct IGW route. A public managed entry can still make a separate private connection to targets. |
| Typical servers | Public web entry, and where planned a bastion or public zonal NAT gateway | App servers, databases |
Create the route tables
- VPC → Route tables → Create route table → Name
public-rt, VPC use the verified ID of the approvedsociety-vpcsandbox → Create route table. - Routes tab → Edit routes → Add route → Destination
0.0.0.0/0, Target Internet Gateway →society-igw→ Save changes. - Subnet associations tab → Edit subnet associations → tick
web-public-1a→ Save associations. - Create
private-rtinsociety-vpcthe same way, and associateapp-private-1aanddb-private-1a. Keep local routes for now. If later adding NAT egress just for the app, associate the app placement with its own egress table and keep the database on its intended private path. - Leave the main route table with only the local route. In this owned custom lab, implicit subnets will then have only the local path. Inspect the actual main table in any existing VPC.
For an approved CLI exercise, follow the AWS route-table instructions. Verify the VPC, gateway and subnet IDs and use the returned ID of the route table you actually created.
Ravindra Bagale's Tip
If a new edge subnet does not use its intended table, check the effective association and the main table it currently inherits. A correct route in a different table has no effect here. Before changing the main table, find all subnets using it and verify the intended change with their owner.
Ravindra Bagale's Tip – मराठी
नव्या edge subnet ला अपेक्षित table लागू नसेल तर effective association आणि main table तपासा. दुसऱ्या table मधला route इथे लागू होणार नाही. Main table बदलण्याआधी तो वापरणारे सगळे subnets आणि त्यांच्या मालकाची योजना तपासा.
Ravindra Bagale's Tip – हिंदी
नए edge subnet पर सही table लागू न हो तो effective association और main table देखो। दूसरे table का route यहाँ लागू नहीं होगा। Main table बदलने से पहले उसे इस्तेमाल करने वाले सारे subnets और उनके owner की योजना जाँचो।
Lab
Run the local route-selection exercise below. In an approved sandbox build, also check the effective route table of each owned subnet. Compare the correct route ID and target for a local address and the intended public or private dependency.
Step-by-step guide
Decide where a single packet should go next
The training centre has a public timetable entry, a private app, and a data service. The app must talk to the data service inside its VPC. It might also send a daily report to a business network connected privately. A software update sometimes uses an approved outside service. The network should choose different paths for these destinations without giving the app its own direct public entry. A route table is the place to describe which next target belongs to each destination range. It answers where to send traffic, not whether the application ought to perform that operation.
Start by naming the source interface and its subnet. The route decision for traffic leaving that placement uses the table the subnet actually has, rather than every table in the account. Then choose one destination address reached by the request. If a client uses a hostname, first find the address returned to that client for the relevant IP family. A route does not match the website name, request path or TCP port. It matches the address range. After the selected network path, firewalls, listeners and application permissions still affect the result.
Write the three intended destinations on a worksheet. An app connection to the data listener should stay in the VPC. A connection to the approved office service should use the planned private connection. A connection to an IPv4 update service should use the approved egress path. If a request targets an unplanned network and the subnet has no applicable route, that is a useful intended result for some private roles. Instead of memorizing that a private subnet routes to NAT, determine which destinations the service really needs.
The lesson walks through selection, two kinds of subnet association and several examples with different public and private roles. The lab uses actual IP-address matching on synthetic tables, and all tests run locally without creating or editing AWS resources. To inspect a real configuration, use the read-only activity with an authorised environment. Classification and a successful user operation are different outcomes, so the lab and the optional service checks have separate goals.
Read destination, prefix, target and state together
A route is an instruction for a destination range and a target. The destination can be a CIDR block such as 10.76.20.0/22; a supported prefix list can represent a group of ranges. The target can be local delivery, an internet gateway, a NAT gateway, a VPC peering connection, an endpoint or another supported choice. When you examine a row in the console, read both sides and its state. The values describe different points in the connection. A target named with the desired project tag does not silently change the route's destination range.
In this example the VPC range is 10.76.20.0/22. AWS adds a local route for the associated block. A second associated IPv4 block adds its own local route, and a VPC IPv6 block uses its own family-specific route. The initial local entry is how the ordinary selected route knows about destinations in the VPC. It does not grant unauthorised access between hosts. An advanced network design may replace a supported local-route target or use a documented more-specific route for an entire subnet to perform inspection. Treat those documented patterns as deliberate design changes. You do not need them for the ordinary private app-to-data path.
The IPv4 default CIDR 0.0.0.0/0 covers all IPv4 addresses. Its prefix length zero fixes no leading bits. The independent IPv6 default is ::/0. Both work as catch-all entries where a more specific eligible route does not apply. Often students read the IPv4 default target as a command to send all traffic to the internet. In a table with a local route, a local destination still matches the more specific range. In a table with a private peer route, matching partner addresses also use that more specific path. The destination set is what matters.
Check the status of the selected row and its target. If an associated target was removed, an affected route may show a blackhole state. It remains a configured route but cannot forward as intended. A more specific matching route with an unusable target is not an instruction to try unrelated broader routes. When you investigate a particular destination, record its selected route and state. Repairing a missing peering attachment or health of a required target belongs to the owner of that path. Presence of a connected gateway somewhere else in the VPC is incomplete evidence.
You can use a prefix list to support service destinations without manually keeping a long set of ranges in your worksheet. An S3 gateway endpoint route, for example, can reference the appropriate service prefix list when its table is associated with the endpoint. That changes the selected path for matching traffic. The route still does not replace endpoint policies, application permissions or bucket access controls. As with any target, record whom it serves and how to verify the actual operation. A confirmed route to S3 does not prove that a particular user can read an object.
Select the most specific matching prefix before considering the default
Imagine the app subnet has three ordinary IPv4 routes. The local VPC block goes to the local target. The office block 10.90.5.0/24 goes through a documented private connection. The IPv4 default uses the selected NAT egress. For a packet destined for 10.76.21.10, the local slash 22 and the default both match, and slash 22 is more specific. For 10.90.5.24, the private slash 24 and default both match, and slash 24 wins. A general model can pick these paths from the covered numbers even without recognising the names on the table.
Try 10.90.6.24 instead. It starts with the same first two dotted numbers as the office range but falls outside that slash 24. With just the three sample entries the default is selected. If the centre intended to reach this additional office network privately, the worksheet has missed a range or obtained the wrong endpoint address. A broad default could send the attempt to an unexpected egress path. A security design can restrict this further. Do not accept the path just because the table returned some target. Match it to the intended dependency and approved routes.
Now add a sample active less-specific private route covering a bigger approved range. The most specific matching route is still selected. Its row does not have to be displayed first. This differs from a network ACL, for which AWS uses rule number order and the first matching rule. To avoid mixing the two, describe the AWS route decision as address matching and prefix priority, and describe the ACL policy as ordered packet permission checks. Both may evaluate an address field, but they produce different outcomes and use different selection rules.
Exact ties and overlapping prefix lists have additional AWS rules. For example, an identical static destination can take priority over a propagated route for the same destination according to AWS's documented route priority. A more specific applicable route is generally considered before a less specific one, so applying static always wins as a blanket summary would mislead you. Once a proposal includes route propagation or competing prefix lists, read the precise AWS priority rules and confirm the actual system state. The baseline lab intentionally uses distinct CIDRs or true non-matches so it can teach longest-prefix selection without inventing a model of every route type.
Most important, evaluate the two traffic directions. The source's route chooses a path toward the destination. The destination needs a suitable return path to that source too. A VPC peering example usually needs routes on both sides for the relevant subnets and matching policies. Peerings do not act as general transitive routers. Confirm which connectivity service really owns the path. AWS network configuration analysis tools can help inspect supported static paths. They do not execute the application and cannot prove that a successful business response occurred.
Don't assign a random host route inside your VPC just because a networking worksheet shows a slash-32 can have the longest prefix. AWS documents allowed target and destination combinations. For a more specific AWS subnet routing entry than a local route, the supported patterns use the entire target subnet CIDR with particular targets and requirements. Plain longest-prefix logic is a useful starting model. Real editing depends on the provider's accepted routes, traffic symmetry and intended topology. The lab uses ordinary CIDRs outside the sample local range for its competing private routes.
Follow an effective route table rather than the one with a familiar name
Every VPC has a main route table. A subnet that has no explicit association with a different table uses the main table implicitly. Attaching a separate table to one subnet does not change what the other subnets use. A table can serve many subnets. For two public placements with the same required paths, explicitly associating both to the same carefully reviewed public table can be appropriate. Private app or data placements may need separate tables if their destinations or next targets differ. One route table per subnet is a design option, not a requirement.
For the centre, give the two web placements an explicit edge table with a direct gateway route. The private app placements may use one or more app route tables depending on their egress design. Data placements can use a table with local routes and only the internal paths they need. A custom VPC whose main table starts local-only provides a clear baseline when a subnet has no explicit association. Retain the planned main table behavior under the network owner's policy. Default VPCs commonly start with a gateway route in their main table, and legitimate designs can use a main table with other routes. A universal rule forbidding an IGW route in the main table would describe a preference, not AWS behavior.
Consider a faulty association. A team built a correct edge table but forgot to associate one of the new edge subnets. The other web subnet already uses it. An internet test succeeds against the first target and fails for the second. Inspect both subnet IDs and their effective table IDs. The missing association explains why a correctly defined route is not used. Adding the route to the main table would also affect unnamed or implicit subnets. To correct the intended owned subnet, verify the exact association change and retest both first and second placements under their ordinary application path.
Think about removal as well as addition. If an explicit association is removed, the affected subnet returns to its implicit main-table path. That behavior can be beneficial or harmful depending on what is in the main table. Before modifying a shared association, record existing and intended table IDs and check the result for every dependent workload. If a change is limited to a new test subnet, a separate table can make the scope clearer. If an existing environment shares routes for good reason, account for the established network responsibilities and controls.
Keep routes and their target's own policies separate in the change record. If a gateway endpoint is deleted, its endpoint-associated routes are managed by the endpoint lifecycle. Private gateway and peering routes can have different dependency rules. The VPC may still show a route aimed at a removed target in another case. Follow the respective service documentation before deletion. In an audit, verifying a table still exists is not the same as verifying its associations, selected routes and current target states.
Classify direct public routing without assuming automatic public IP addresses
A public subnet has a direct route to an internet gateway. The common direct default targets are 0.0.0.0/0 for IPv4 or ::/0 when public IPv6 is part of the design. A planned route can cover narrower public destinations too. There is no universal public flag that configures the entire edge. Naming a subnet public or toggling an address feature does not add the route. A particular EC2 interface still needs suitable addressing and network policy, plus the right service, for ordinary direct public reachability. A managed public entry may control its own public addressing.
A private subnet has no direct route to the internet gateway. It can still have private connections to other networks, service endpoints, and suitable outbound paths. Some private IPv4 subnets rely on a public NAT gateway to initiate approved internet connections without assigning public IPv4 addresses to the private app instances. In the traditional zonal public NAT pattern, the gateway is placed in a public subnet and uses the internet-gateway path for internet access. Current AWS also offers Regional NAT behavior. That Regional choice does not require a hosting public subnet. Read the supported model, not just the drawing from an earlier exercise.
A subnet meant to be isolated may not need a default internet route at all. A data tier can have only its appropriate internal paths. A customer application could also reach S3 or DynamoDB through an associated gateway endpoint without a NAT or direct internet gateway route for those operations. Private interface endpoints work differently by providing network interfaces and private access paths for eligible services. Read which endpoint type and relevant DNS and access settings the service supports. A gateway endpoint for S3 cannot supply access to arbitrary outside software mirrors.
IPv6 routing is independent again. If the worker uses suitable public IPv6 addresses for outbound internet access only, its subnet may have an egress-only internet gateway route. That does not provide general direct ingress and does not substitute for an IPv4 NAT design. If the subnet offers a public IPv6 path but lacks direct public IPv4, document both rather than summarising the whole system from one route row. Verify the intended address type, route, controls and actual client request. Public access can differ across IP families for a valid reason or by accidental deployment.
Now evaluate three results. A web EC2 instance in a public-route subnet has no public IPv4 association. Its internal private operation can succeed while direct public IPv4 still cannot reach it. A private app with NAT can initiate a permitted IPv4 dependency connection while incoming connections from the public internet have no supported path through that NAT. A private database can have no default egress at all yet answer the app inside the VPC. All three results fit the architecture. The word private is a route design property and should be paired with the actual interface and traffic evidence when you describe a service.
Run a local route and association exercise
Use Python 3 in a terminal. The code models each IPv4 and IPv6 table entry as a destination network, a target label and a state. The addresses are private or reserved examples and are never contacted. Start with edge and app tables both explicitly assigned, and data using the main table. Predict the selected target for a data address, an office address, an external IPv4 address and an IPv6 address in the app subnet. Then predict whether removing the sample edge subnet's association changes the chosen route for an outside destination.
python3 - <<'PY'
from ipaddress import ip_address, ip_network
local4 = ('10.76.20.0/22', 'local', 'active')
local6 = ('2001:db8:7600:1200::/56', 'local', 'active')
tables = {
'main': [local4, local6],
'edge': [local4, local6, ('0.0.0.0/0', 'igw-example', 'active'),
('::/0', 'igw-example', 'active')],
'app': [local4, local6, ('0.0.0.0/0', 'nat-example', 'active'),
('10.90.0.0/16', 'office-link', 'active'),
('10.90.5.0/24', 'office-specific', 'blackhole'),
('::/0', 'egress-only-igw', 'active')],
}
associations = {'web-a': 'edge', 'app-a': 'app'}
def route_for(subnet, destination, associations):
address = ip_address(destination)
table = associations.get(subnet, 'main')
matching = []
for prefix, target, state in tables[table]:
network = ip_network(prefix)
if address.version == network.version and address in network:
matching.append((network.prefixlen, target, state))
if not matching:
return table, 'no route', '-'
_, target, state = max(matching, key=lambda row: row[0])
return table, target, state
checks = [
('app-a', '10.76.21.10', ('app', 'local', 'active')),
('app-a', '10.90.6.24', ('app', 'office-link', 'active')),
('app-a', '10.90.5.24', ('app', 'office-specific', 'blackhole')),
('app-a', '198.51.100.25', ('app', 'nat-example', 'active')),
('app-a', '2001:db8:999::12', ('app', 'egress-only-igw', 'active')),
('data-a', '198.51.100.25', ('main', 'no route', '-')),
('web-a', '198.51.100.25', ('edge', 'igw-example', 'active')),
]
for subnet, destination, expected in checks:
observed = route_for(subnet, destination, associations)
assert observed == expected
print(subnet, destination, *observed)
changed = dict(associations)
del changed['web-a']
assert route_for('web-a', '198.51.100.25', changed) == ('main', 'no route', '-')
assert route_for('web-a', '198.51.100.25', associations) == ('edge', 'igw-example', 'active')
print('Removing web A association in memory made its main table effective.')
PY
Read the first three IPv4 results together. The internal destination matches the local route. The second office address matches the broader private prefix. The third matches the narrower office range, but its target state is blackhole. The model does not treat that selected route as successful or fall back to the broader office path. In a real investigation you would verify that the more specific configuration is intentional and understand who owns the target. An attached internet gateway elsewhere in the inventory does not resolve that state.
Then compare the external IPv4 and IPv6 decisions. In the app table the default IPv4 target points to NAT and the default IPv6 target to an egress-only gateway. The data subnet is not explicitly associated in this model, so it has only the main table and its local routes. The web example selects its explicitly installed public table. When the association is removed from a copy in memory, that table no longer supplies the route. The initial association remains in the original data structure. This is an isolated model, so changes create no packet flow, charges, cloud state or files.
For a follow-up, compute the route for 2001:db8:7600:1212::10 from the app subnet. The target should be local because the address is inside the VPC's slash 56, despite the matching IPv6 default. Add the expected row and rerun the lab. Then try to write the same case on paper with an application port and source identity. The selected route stays the same for a different port at that destination. Security group and listener behavior may change. State which result your worksheet can establish, and what requires a real authorised operation.
Verify a route change with the narrowest useful comparison
In an authorised console inventory, select the correct account and Region. Start from the exact subnet and find its current route table. Read the effective association and primary target types. If you're following an actual incident, resolve the relevant dependency name from the intended source and select its address family. Identify its matching route, current state, target ID and actual target availability. Check the return route where it is part of a cross-network path. This supplies a stronger diagnosis than just looking for an internet gateway icon or confirming the resource exists in a different Region.
For an approved sandbox build, create or select only the route tables needed for that design. Verify the VPC association and whether the designated table already carries traffic for other subnets. Add the intended public route pointing to the actual attached gateway ID, then explicitly associate the sandbox edge subnet. Give the app and data subnets the intended separate paths. They may need different table associations when only the app requires egress. Keep a note of the expected private and public operations, and confirm actual resource IDs when creating or editing them.
Test change outcomes separately. For a positive internal control, use a legitimate app-to-data operation that exercises the selected database endpoint. For the public entry, verify the expected site change through its actual name from the intended client network. For the private app, use an approved dependency request if the chosen design includes it. Record the name, actual destination and observed result. A route edit can succeed in the provider API while the permitted business operation still fails due to addressing, policy, protocol, credentials or a stopped service.
Before cleanup, check the route table's existing dependants and temporary gateways or endpoints. When removing a test association, confirm the resulting implicit main-table path only for the test subnet. Follow instructions for deleting owned dependencies in the correct order. In a long-lived VPC, edge and egress tables can be shared by several deployments. Do not remove their shared routes just because a single temporary instance no longer needs them. The local model above needs no cloud cleanup and never issues destructive operations.
Trace a private office request and its reply
A staff-only reporting application in the centre's VPC needs to read a small reference value from an approved office service. The app address is 10.76.20.130 and the office service address is 10.90.5.24. Write down the source, destination and required service port. The app's subnet table has a route for the office range aimed at the selected documented private attachment. That is the first half of the path. The office network also needs a valid route back to the app's range through the approved connection. Read each side as a separate destination lookup. On the return side the app address is now the destination.
Imagine that the centre's route is correct but the office team knows only the old app range of 10.76.20.0/26. That range covers fourth numbers zero through 63. It does not include the actual app source at 130. There might be an old deployment that used the earlier subnet. The office could receive a request and fail to return it along the intended path. From the app's point of view the request may time out. From the office side logs can show a connection attempt reached its service. Comparing both observations is more informative than assuming a missing initial route because the client saw a timeout.
Suppose the office team adds the approved return route. The intended connection can still fail if the application host is listening at a different port or its source permissions do not allow the test. The route merely chooses a candidate path from one point to another. For the planned connection record the outbound app security group scope, relevant subnet ACL directions, the private-network policies and the office service's address and port. Use a safe read-only reference request as the external operation. An exact expected value lets the team distinguish this particular service from a greeting emitted by another listener.
When the centre chooses a topology, distinguish the private connection endpoints. For two VPCs with nonoverlapping ranges and a documented peering connection, add the appropriate subnet routes on both sides and consider how names resolve. A VPC peering connection is not an intermediate router for every other connected network. A large company may instead use a transit gateway or other hub design. Its attachments and routing scopes have their own behavior. Asking who owns each path helps avoid a misleading drawing that treats any two lines on a diagram as end-to-end reachability.
Someone suggests moving the report operation to a public endpoint because the first test of the private path failed. Compare the choice with the requirement. Exposing the dependency would change who could reach it, the identity design, and possibly the DNS and certificate requirements. If the approved goal is a private report connection, the middle of the design should stay private and the return route should be corrected with the relevant owner. The only sensible test asks whether the required operation works through its intended path.
Finally, document the failure moment and resolution in a way another operator can verify. Record the original and revised destination ranges for each direction, without including business secrets. Name the VPC table, attachment or route view used for each side. Add both service observations and the approved private reference result. Recheck the other workloads that depend on any adjusted route. If the VPC uses a shared table, the same added route can affect traffic from multiple subnets. Decide whether to scope it to the planned source placement, especially if a broader destination range would alter existing paths.
Compare a service-specific route with general egress
The centre's app needs two things. It reads a training object from an Amazon S3 bucket, and an approved update process reaches a separate internet dependency. An S3 gateway endpoint can supply a private route for applicable S3 destinations in a supported setup. This is a service-specific decision. The AWS-managed prefix list can appear as a route destination pointing to the endpoint for associated tables. A general IPv4 default to an approved NAT gateway can remain for other destinations. The more specific eligible endpoint route governs the applicable service traffic.
A common symptom is that one app placement can read an object while another cannot. Keep the same approved object and IAM role where the environment allows, and find each instance's actual subnet table policy. If one table joins the intended gateway endpoint and the other doesn't, traffic may take a different route or have no approved path. An endpoint policy can also restrict the permitted action, and a bucket policy can depend on the expected endpoint. Check the actual response. An explicit S3 access denial and a connection timeout are different clues. Do not conclude from the successful path that all app subnets use the same endpoint.
The architecture still has DNS and IP-family decisions. Verify the service URL, address returned to the app and supported endpoint route and address settings in the Region. A hardcoded test address can become outdated and cannot prove ordinary DNS behavior. A private interface endpoint has interfaces with private addresses and can use supported private DNS settings. A gateway endpoint's route entry is different. These options can expose different mechanisms and supported use cases. The comparison is useful when explaining why one route only serves the selected service rather than all internet requests.
Decide what traffic should be possible if the outside dependency goes away or is no longer approved. The application can keep accessing the approved bucket through its endpoint if the design and policies fit. The data tier may remain free of unrelated egress entirely. Some management or package dependencies still require an explicit route. Ask for the actual remote destinations and mechanism instead of adding a default merely because another private app has one. A good worksheet connects each nonlocal route to an operation with a clear owner and a distinct expected result.
For cost-sensitive design, compare which resources and traffic are used. AWS documents no additional gateway-endpoint charge for that endpoint type. Other services, transfers and translation paths can have separate charges. This difference can inform a decision after you understand the allowed service and connectivity. A successful object retrieval is evidence for the dependency, not a complete cost report. Identify the route, actual network path and separate billing observations before attributing all traffic costs to that retrieval.
Review route state and rollback before updating a shared table
The change proposal says to add a specific route for a second finance range. Start with the exact source subnet list. Two application subnets can share the app table. If both need the connection, a shared entry may be appropriate. If only the scheduled reporting subnet needs it, a separate association can reduce the change scope. Ask whether the destination range already matches a broader route and how the most specific proposal would alter that traffic. A table diff should state which destinations will behave differently and which continue using unchanged rows.
Write a small before-and-after worksheet with at least three controls. One is the new private finance service. One is the previously healthy private dependency. The third is the regular user-facing operation or other unrelated service the affected source serves. Include expected target choices and local or remote observations. Do not rely on a succeeded provider change request as proof of the application's next result. An active row and route analysis are evidence about forwarding configuration. The actual operation gives evidence about the protocol, authorization and produced data.
Prepare a rollback for the change scope. If adding a single tested route, know the original absence or target of that entry. If switching an association, know the previous table ID and any implicit main-table result. If the change connects AWS to another private network, coordinate the return route and related policies with the other owner. A rollback on one side alone can leave an inconsistent path. Verify the restoration result using the same sources and destination assumptions as the baseline.
When cleaning up an approved temporary gateway, endpoint or peer, check which routes use it and what happens if the target disappears. Do not leave a stale route to an unavailable specific target where a related service expects to work. Conversely, don't remove a deliberate restrictive route merely to force a different fallback. Inspect the documented lifecycle and record the expected table after cleanup. The shared main table and unrelated subnet associations should continue to match their original plan. The most valuable change note names what was touched and proves the intended operation and the relevant control are both working.
Before a final test, separate the names a team can choose from the values AWS returns. In a capture of the app table, give the assigned route table ID and the target ID for the specific destination. Record the route state and whether it was entered manually or propagated. Collect the actual association for the subnet being tested. If two tables share the same label, those observations still identify the table clearly. If documentation and observed IDs do not match, stop and determine what changed rather than guessing from a familiar name.
For an everyday review of scope, list the required routes from the most specific to broadest and annotate each with its purpose. That ordering is a readable presentation for people, while AWS uses the documented matching and priority rules. The effective configuration may also contain usual local entries or service-generated destination entries that were not typed manually. A shared route table still belongs to the VPC and can apply to many placements. Give the intended purpose for every new destination so operators will know whether a stale row should be restored, updated, or removed during approved cleanup.
After the real application test, compare the evidence to your plan. If routing is valid but an endpoint policy declines the read, hand off the policy question with the observed operation and identity. If the desired route did not match the resolved address, record both values. Those two diagnoses involve different owners and changes.
Answers that explain the selected route and its limits
How would you find the route for a destination from an app instance?
Identify the app's subnet, inspect its effective route table and determine the resolved destination address and family. Compare matching prefixes and inspect the selected target, state and documented tie-breaking rules where applicable. Then check return path and applicable permissions. This identifies a configured path, while a real application check provides evidence about the service result.
Does a public route table make every instance publicly reachable?
No. The effective route can supply a direct internet-gateway path. Each resource still needs suitable address association, applicable policy and a matching service listener. Check the actual interface, selected IP family and authorised ordinary public operation. A managed entry can be public while its target app instances keep private addressing.
Must a private subnet have a NAT gateway?
No. Its routes should reflect real dependency needs. An app may use a supported endpoint or private network connection, an approved public NAT arrangement for initiated outbound traffic, or no external path at all. The data tier can answer suitable internal requests using local routing and restricted security policy.
What happens after a subnet loses an explicit route table association?
It uses the VPC's main route table implicitly until an explicit association is applied. I would inspect the main table's actual routes and all dependencies before changing anything. The main table may have a local-only baseline in a custom VPC or other intentional routes in an existing environment.
Predict which route the workload uses
Two matching routes use slash 24 and slash 16 for the same IPv4 destination. Which prefix is selected in the simple model?
Answer and reasoning
Slash 24 is more specific because more of the destination's leading bits must match. Read its target and state before assuming the request reaches the service.
The app table has an IPv4 default to NAT. Does it provide an ordinary IPv6 default route?
Answer and reasoning
No. Destination families are evaluated independently. The IPv6 path needs suitable separate IPv6 addressing, routes and traffic policy.
Should you change the main table because one subnet failed to use its intended public table?
Answer and reasoning
First find that subnet's effective association and which other subnets use the main table. A scoped association correction may be the intended action. Editing the shared main table changes every dependent placement.
An S3 gateway endpoint route exists. Does that give the app permission to retrieve every object?
Answer and reasoning
No. The endpoint and routing determine a path. Identity, endpoint and resource policies still determine whether the concrete operation is allowed.
Revision cards for subnet route choices
Effective table
Start at the source subnet. Read the explicit association if present or the VPC main route table if implicit.
Longest match
Choose the most specific applicable destination for the correct IP family. Inspect target and state, and check AWS rules for ties and special targets.
Direct and private paths
Direct public routing uses a relevant internet-gateway route. Private roles can use endpoints, connected networks, selected egress or local paths alone.
Route and application
Follow the request and return path. Network permissions, service setup and application identity still determine the observed useful result.
Official references
- Subnet route tables, main associations and local routes
- AWS route priority and prefix specificity
- AWS route targets and example paths
- Manage AWS subnet route tables
- Direct gateway route and addressing requirements
- Regional NAT gateway architecture
- Egress-only IPv6 paths
- S3 and DynamoDB gateway endpoints
- VPC peering route and nontransitive limits
- Python address and network matching
- Example blackhole route state after NAT deletion
Quick revision cards
Compare subnet routing, address assignment and IPv6 before choosing a path.
| Check | Public placement | Private placement |
|---|---|---|
| Example IPv4 routing | A route through the attached internet gateway, commonly 0.0.0.0/0 for otherwise unmatched IPv4 destinations. | No direct internet-gateway route. Use approved NAT egress, a private connection, a service endpoint, or local routes only as needed. |
| IPv4 addresses | Verify the resource's actual public IPv4 association if it needs direct public access. The route does not assign an address. | Private workloads normally keep private IPv4 addressing. Address assignment and route selection are separate. |
| IPv6 routing | Review the appropriate public IPv6 addressing, direct gateway route, controls and listener separately. | Check the intended IPv6 private path or, where appropriate, an egress-only internet gateway. An IPv4 default does not cover IPv6. |
More cards: Ravi Sir's Cards.