Sub topic 14
Centralized inspection and appliance mode
This chapter assumes you can read a VPC route table, know what a security group and a Gateway Load Balancer or firewall appliance do, and have already attached VPCs to a transit gateway and configured association and propagation. The goal is to route traffic from many VPCs through one inspection VPC and keep the return path symmetric.
Why centralize inspection
Without a central point, each VPC needs its own firewall or intrusion prevention system. That multiplies licenses, configuration drift, and operational work. With a transit gateway you can send traffic through one inspection VPC that holds the appliances. This is sometimes called a "bump in the wire" design.
Typical reasons to do this:
- One policy set for east-west traffic (VPC to VPC) and for egress to the internet.
- One place to collect logs for audit.
- Spoke VPC owners do not manage security appliances.
The trade-off is that the inspection VPC becomes a shared dependency. Its capacity and availability limit every spoke.
The topology
The usual design uses two transit gateway route tables:
- A spoke route table. Every spoke VPC attachment is associated with it. It contains a default route (
0.0.0.0/0) or specific CIDRs pointing at the inspection VPC attachment. - An inspection route table. The inspection VPC attachment is associated with it. The spoke attachments propagate their CIDRs into it, so inspected traffic can find its way back.
Packets follow this path from VPC A to VPC B:
- An instance in VPC A sends a packet to VPC B. The VPC A subnet route table sends it to the transit gateway.
- The transit gateway looks it up in the spoke route table, which points at the inspection attachment.
- The packet enters the inspection VPC, where a firewall appliance examines it.
- The appliance returns the packet to the transit gateway.
- The transit gateway looks it up in the inspection route table, finds VPC B's propagated CIDR, and delivers it.
The asymmetric routing problem
A transit gateway keeps traffic for a flow inside the Availability Zone where it entered, as long as the destination attachment has a subnet in that zone. This behavior keeps latency low and cross-zone traffic down.
The problem appears with stateful appliances. Suppose a flow from VPC A enters the transit gateway in us-east-1a and goes to the firewall in the inspection VPC's us-east-1a subnet. The return traffic from VPC B might enter the transit gateway in us-east-1b. The transit gateway then sends it to the inspection VPC in us-east-1b, where a different appliance sees a reply for a flow it never saw. A stateful firewall drops that packet.
The failure looks like this:
- TCP connections hang at the handshake or break partway through.
- Pings sometimes work and sometimes fail, depending on which zones the endpoints are in.
- Traffic within a single Availability Zone works fine.
Appliance mode
Appliance mode is a setting on the VPC attachment of the inspection VPC. When enabled, the transit gateway picks one network interface in the inspection VPC for a given flow, using a hash of the flow's source and destination, and uses the same interface for both directions. The firewall sees both halves of the conversation.
Enable it when you create the attachment:
aws ec2 create-transit-gateway-vpc-attachment \
--transit-gateway-id tgw-0123456789abcdef0 \
--vpc-id vpc-0ddd4444eee55555f \
--subnet-ids subnet-0aaa1111 subnet-0bbb2222 \
--options ApplianceModeSupport=enableOr turn it on for an existing attachment:
aws ec2 modify-transit-gateway-vpc-attachment \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0 \
--options ApplianceModeSupport=enableKey points about the setting:
- It applies to the inspection VPC attachment only. Spoke attachments do not need it.
- The inspection VPC needs a subnet in every Availability Zone where spoke traffic might arrive, or traffic may be sent across zones unpredictably.
- Appliance mode keeps flows symmetric. It does not by itself spread load perfectly. The hash distributes flows, but a few very large flows can still land on one appliance.
Routing inside the inspection VPC
The transit gateway only delivers packets to the inspection VPC's attachment subnets. Inside the VPC you must steer them through the appliance and back out.
There are two common arrangements.
| Arrangement | How traffic reaches the appliance | Notes |
|---|---|---|
| Gateway Load Balancer | The attachment subnet route table sends traffic to a Gateway Load Balancer endpoint, which forwards it to appliances behind the load balancer using GENEVE encapsulation. | Scales appliances horizontally and handles health checks. Most common choice. |
| Directly routed appliance | The attachment subnet route table points at an appliance network interface. | Simple, but you manage failover and scaling yourself. |
For the Gateway Load Balancer arrangement, the route table of the attachment subnets typically contains:
- A default route to the Gateway Load Balancer endpoint in the same Availability Zone.
The endpoint's subnet route table then contains:
- A route for the spoke CIDRs (or
10.0.0.0/8if you use a summary) back to the transit gateway.
Keep the appliance subnets and endpoint subnets separate from the attachment subnets. A common practice is to use small dedicated subnets for the attachments, so that security groups and network ACLs applied to them are easy to reason about.
Configuring the transit gateway side
The following commands create the two route tables and wire up the pieces. The IDs are placeholders.
# Spoke route table: where spokes send traffic
aws ec2 create-transit-gateway-route-table \
--transit-gateway-id tgw-0123456789abcdef0
# Inspection route table: how inspected traffic finds its destination
aws ec2 create-transit-gateway-route-table \
--transit-gateway-id tgw-0123456789abcdef0
# Spoke route table gets a default route to the inspection attachment
aws ec2 create-transit-gateway-route \
--transit-gateway-route-table-id tgw-rtb-0aaaaaaaaaaaaaaaa \
--destination-cidr-block 0.0.0.0/0 \
--transit-gateway-attachment-id tgw-attach-0inspection000000
# Inspection attachment is associated with the inspection route table
aws ec2 associate-transit-gateway-route-table \
--transit-gateway-route-table-id tgw-rtb-0bbbbbbbbbbbbbbbb \
--transit-gateway-attachment-id tgw-attach-0inspection000000
# Spoke attachment propagates its CIDR into the inspection route table
aws ec2 enable-transit-gateway-route-table-propagation \
--transit-gateway-route-table-id tgw-rtb-0bbbbbbbbbbbbbbbb \
--transit-gateway-attachment-id tgw-attach-0spokeA0000000000Each spoke attachment is also associated with the spoke route table, using the same associate-transit-gateway-route-table command.
Common errors
- Appliance mode is off. Symptoms are the intermittent, zone-dependent failures described above. Check the attachment's
ApplianceModeSupportvalue. - Spokes can bypass the inspection. If two spoke attachments both propagate into the spoke route table, they can reach each other directly. Keep spoke CIDRs out of the spoke route table. Only the inspection route table should hold them.
- Return route missing. If the inspection route table has no route to a spoke, inspected packets are dropped. Confirm propagation is enabled for every spoke.
- Appliance drops hairpinned traffic. Some appliances need source/destination checks disabled and specific rules to forward traffic that arrives and leaves on the same interface.
- MTU mismatch. GENEVE encapsulation adds overhead. Large packets with the don't-fragment flag can fail while small ones work. Check that the appliance and path support the expected MTU.
- Network ACLs. Network ACLs are stateless, so the inspection VPC's subnet ACLs must allow both directions.
Cost and capacity
Centralized inspection adds charges. The transit gateway bills per attachment-hour and per gigabyte processed, and traffic that crosses it for inspection is processed twice when it goes spoke to inspection and inspection to spoke. Appliance instances, Gateway Load Balancer capacity units, and cross-zone data transfer add to that. Inspect only the traffic that needs it. For example, send east-west and egress traffic through the inspection VPC but let trusted high-volume flows take a direct path if your policy allows.
Exercise
Users report that TCP connections between two spoke VPCs through a central firewall work when both instances are in the same Availability Zone but hang when they are in different zones. The transit gateway route tables are correct. What is the likely cause, and what change fixes it?
Show answer
The inspection VPC attachment has appliance mode disabled. The transit gateway keeps each direction of the flow in the zone where it entered, so the request and the reply reach different firewall appliances, and the second appliance drops the reply because it has no state for the flow. Enable appliance mode on the inspection VPC attachment with aws ec2 modify-transit-gateway-vpc-attachment --options ApplianceModeSupport=enable, and make sure the inspection VPC has subnets in each zone in use.
Exercise
In a centralized inspection design, why should spoke attachments propagate their CIDRs into the inspection route table but not into the spoke route table?
Show answer
The inspection route table must know how to reach each spoke so inspected packets can be delivered. If spokes propagated into the spoke route table, spoke-to-spoke traffic would follow those more specific routes and go directly, bypassing the inspection VPC.