Subchapter 88.1
references/centralizing-egress-and-inspection.mdMarkdown18 KBView on GitHub
Domain expertise for routing every spoke VPC’s outbound traffic through one central VPC for egress, inspection, or both, instead of a NAT gateway and firewall fleet in every VPC. Covers the choice between raw appliances and a Gateway Load Balancer (GWLB) endpoint, appliance mode and its cross-Availability-Zone failover tradeoff, the return-path routes that complete the round trip, keeping spokes isolated while they share egress, the DNS plumbing that resolution needs across the hub, and the Regional limit on a single inspection VPC.
Does not cover east-west inspection between VPCs (a separate reference), creating the hub, segmentation in general, hybrid connectivity, peering, or multicast. Those are separate references.
Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise. A transit gateway is Regional; run every command in the Region that holds the hub.
To centralize egress and inspection end to end, follow the procedure exactly. See the Procedure section below. It covers working with the existing spoke and central VPC attachments, placing the egress path (NAT and internet gateway) or the inspection path (appliances or a GWLB endpoint) in the central VPC, enabling appliance mode for stateful cross-Availability-Zone inspection, wiring both the forward and return routes, keeping spokes isolated from each other, setting up DNS resolution across the hub, and surfacing the console link to verify.
| Path | Use when |
|---|---|
| Gateway Load Balancer (GWLB) endpoint | The recommended path for new designs. Inspection appliances sit behind a GWLB; spokes route to the GWLB endpoint in the central VPC |
| Raw third-party appliances | The customer runs appliances directly in the central VPC without a GWLB front end |
Constraints:
By default a transit gateway keeps a flow in the Availability Zone it entered, so request and response can hit different appliances and a stateful firewall drops the packets. Appliance mode on the inspection VPC attachment keeps each flow on one appliance.
Constraints:
A centralized inspection VPC needs routes in both directions. Spoke traffic reaching the appliances or GWLB endpoint must be sent back to the transit gateway after inspection, or the round trip never completes.
Constraints:
A single shared route table lets spokes route to each other through the hub even while they share egress. Separate route tables send each spoke to the central VPC while blocking spoke-to-spoke paths.
Constraints:
When Route 53 Resolver endpoints or private hosted zones are centralized in the inspection or egress VPC, the data path working does not mean names resolve. Resolution needs Resolver rules forwarding queries to the central endpoints, shared to spoke accounts through AWS Resource Access Manager (RAM), and associated with the spoke VPCs. This is the second most common support question behind appliance mode.
Constraints:
A central VPC and its appliances are Regional. A multi-Region design needs an inspection VPC per Region, tied together with inter-Region peering, not one shared inspection point.
Constraints:
A central egress and inspection VPC is the single chokepoint every spoke’s outbound traffic crosses, so a routing or inspection gap here exposes every attached network at once. The controls are embedded in the procedure; this section consolidates them.
Constraints:
aws:SourceArn, aws:SourceAccount, kms:ViaService) so only the specific
log group, bucket, or trail in the expected account and service can use the keyAppliance mode is off. Enable it on the central VPC attachment; pair with health-check failover.
A central VPC route table entry to the GWLB endpoint is missing for one direction. Add both the inbound and return entries.
The return path is missing. Add routes sending inspected traffic back to the transit gateway.
A shared route table lets them route through the hub. Use separate route tables per spoke.
The DNS plumbing is missing. Set up the Resolver rule, RAM share, and VPC association.
This procedure works with the existing spoke and central VPC attachments, builds the egress or inspection path, enables appliance mode for stateful cross-Availability-Zone inspection, wires forward and return routes, isolates spokes, sets up DNS resolution, and surfaces the console link to verify.
Prerequisite: All VPC attachments this procedure uses (the central VPC attachment and every
spoke VPC attachment) MUST already exist on the transit gateway and be in the available state
before you run this procedure. This procedure discovers and modifies those attachments (Steps 2 and
3); it does not create them. If an attachment is missing, create it first with the creating a
transit gateway and attaching VPCs reference, since the discovery calls return nothing and the
procedure fails silently otherwise.
gwlb or appliance.yes or no).Constraints for parameter acquisition:
Constraints:
aws sts get-caller-identity, and you MUST use short-lived,
ephemeral credentials scoped to least privilege for transit gateway administration, never
long-lived access keys or broad service wildcard or FullAccess policiesaws:SourceArn,
aws:SourceAccount, and kms:ViaService) so only the specific log group, bucket, or trail in the
expected account and service can use the key, preventing cross-account or cross-service misuseConstraints:
You MUST discover the central VPC attachment ID:
aws ec2 describe-transit-gateway-vpc-attachments \
--filters Name=transit-gateway-id,Values={transit_gateway_id} Name=vpc-id,Values={central_vpc_id} \
--query 'TransitGatewayVpcAttachments[0].TransitGatewayAttachmentId' --output text --region {region}You MUST enable appliance mode on the central VPC attachment for stateful cross-Availability-Zone inspection:
aws ec2 modify-transit-gateway-vpc-attachment \
--transit-gateway-attachment-id {central_attachment_id} \
--options ApplianceModeSupport=enable --region {region}You MUST poll until the modification completes and the attachment returns to available:
aws ec2 describe-transit-gateway-vpc-attachments \
--transit-gateway-attachment-ids {central_attachment_id} --region {region}Constraints:
You MUST discover the spokes’ transit gateway route table from a spoke attachment’s existing association, which is unambiguous even in a segmented design with multiple route tables. First find a spoke VPC attachment:
aws ec2 describe-transit-gateway-vpc-attachments \
--filters Name=transit-gateway-id,Values={transit_gateway_id} Name=vpc-id,Values={spoke_vpc_id} \
--query 'TransitGatewayVpcAttachments[0].TransitGatewayAttachmentId' --output text --region {region}Then read the route table it is associated with:
aws ec2 describe-transit-gateway-attachments \
--transit-gateway-attachment-ids {spoke_attachment_id} \
--query 'TransitGatewayAttachments[0].Association.TransitGatewayRouteTableId' \
--output text --region {region}Capture the result as {spoke_route_table_id}. The spoke attachments must already be associated
with this route table; do not assume a single non-default route table exists.
You MUST add a default route (or the ranges to inspect) in the spokes’ transit gateway route table pointing at the central VPC attachment:
aws ec2 create-transit-gateway-route \
--transit-gateway-route-table-id {spoke_route_table_id} \
--destination-cidr-block 0.0.0.0/0 \
--transit-gateway-attachment-id {central_attachment_id} --region {region}Constraints:
Constraints:
isolate_spokes is yes (see the segmenting reference)Constraints:
Constraints:
You MUST confirm the central attachment and routes are in place:
aws ec2 describe-transit-gateway-vpc-attachments \
--transit-gateway-attachment-ids {central_attachment_id} --region {region}You MUST present the transit gateway console link, filling {transit_gateway_id} and {region}
from the API response, and tell the customer to open it and verify the egress/inspection wiring:
https://{region}.console.aws.amazon.com/vpc/home?region={region}#TransitGatewayDetails:transitGatewayId={transit_gateway_id}{
"region": "us-east-1",
"transit_gateway_id": "tgw-0abc",
"inspection_path": "gwlb",
"central_vpc_id": "vpc-inspection",
"spoke_vpc_ids": ["vpc-app", "vpc-data"],
"isolate_spokes": "yes",
"centralized_dns": true
}Attached the inspection VPC with appliance mode enabled (cross-Availability-Zone stateful inspection).
Flagged the tradeoff: appliance mode disables cross-Availability-Zone failover; paired with health-check failover.
Routed spoke default traffic to the inspection VPC; pointed the central VPC route tables at the GWLB
endpoint for both inbound and return.
Kept vpc-app and vpc-data on separate route tables (isolated from each other).
Set up the Resolver rule, RAM share, and VPC associations so names resolve across the hub.
Open the transit gateway console and verify the wiring:
https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#TransitGatewayDetails:transitGatewayId=tgw-0abcAppliance mode is off. Enable it (Step 2) and pair with health-check failover.
A central VPC route entry to the GWLB endpoint is missing. Add both directions (Step 4).
DNS plumbing is missing. Create the Resolver rule, RAM share, and VPC association (Step 6).