Skip to content

// blog › aws

AWS · SECURITY · NETWORKING

Transit Gateway network firewall architecture on AWS

On this page
  1. The problem: many VPCs, one security policy
  2. The design
  3. Trade-offs and cost
  4. Hub or distributed?
  5. When not to use it
  6. How to draw it in archhy
key takeaways
  • Spoke VPCs send everything non-local to the Transit Gateway; a static route sends it on to the firewall attachment.
  • The firewall attachment lives in a VPC AWS manages for you. You cannot put a NAT gateway there, so internet egress still needs its own VPC.
  • Egress traffic crosses the Transit Gateway twice, and each crossing has a per-GB charge.
  • Inspecting inbound traffic through this attachment is not recommended. Inspect it at the edge instead.
diagramHub-and-spoke inspection: Transit Gateway with a TGW-attached Network Firewall and centralised egressOpen this diagram in archhyOpens in a new tab in the editor, ready to change. No account needed.See it in the diagram library →

A Transit Gateway network firewall architecture puts one inspection point in the middle of a hub-and-spoke network, so traffic between VPCs and out to the internet is checked once, by one policy. Since AWS Network Firewall can attach directly to a Transit Gateway, you no longer build and run an inspection VPC yourself. This post draws the pattern with centralised egress, explains the routing, and covers the costs and limits AWS lists.

The problem: many VPCs, one security policy

An organisation with dozens of accounts ends up with dozens of VPCs. Security wants every outbound connection filtered and logged, and traffic between workloads checked against rules. A firewall in every VPC means many copies of one policy to keep in step, and an hourly charge for each whether or not it is busy. Centralising inspection in a hub fixes that, at the price of routing everything through it.

The design

The diagram shows two workload accounts and a network account in one Region (open the diagram).

  1. Spokes. Each workload VPC routes all non-local traffic to the Transit Gateway. The gateway lives in the network account and is shared with the workload accounts through AWS Resource Access Manager; the owner accepts each attachment.
  2. To the firewall. The spokes' Transit Gateway route table has a static default route to the firewall attachment. Static is the only option: routes to the attachment cannot be propagated.
  3. Inspection. AWS Network Firewall, attached natively, inspects the traffic. Its endpoints, subnets and route tables sit in a VPC AWS creates and runs, which you never see. Appliance mode is on automatically, so both directions of a connection take the same path, which stateful rules need.
  4. Back and onward. The firewall's route table sends internet-bound traffic to an egress VPC, and traffic for another spoke back to that spoke.
  5. Egress. The egress VPC's NAT gateways translate addresses and send traffic out through its internet gateway.

The same firewall can inspect east-west traffic between spokes, centralised egress, or both, depending on what the route tables send it.

Trade-offs and cost

  • Two crossings for egress. Spoke to firewall, then firewall to egress VPC: both are Transit Gateway hops with data processing charges. At high volume this is often the largest line on the bill.
  • Keep AWS traffic off the path. Our suggestion: give spokes VPC endpoints for heavy AWS services, so backups and log uploads do not pay for NAT, two Transit Gateway hops and inspection they do not need.
  • Charging back. The native attachment lets you use Transit Gateway metering policies to charge firewall costs to the accounts that cause them.
  • Visibility. You get Transit Gateway flow logs and the firewall's flow, alert and TLS logs. You lose PrivateLink endpoint metrics and endpoint flow logs, because the endpoints are in AWS's VPC.
  • Inbound traffic. You cannot route to the firewall before a load balancer, and inspecting after it adds another hop and hides client addresses. Use WAF and edge services for inbound.
  • Shared fate. Every spoke now depends on one gateway and one firewall policy. A bad rule blocks everything at once, so change rules through review and test in a non-production attachment first.

Hub or distributed?

AWS also added a way for one firewall to have up to 50 endpoints per Availability Zone, placed in any VPC, all under one policy, with secondary endpoints cheaper than primary ones. That makes a distributed design, with inspection inside each VPC, far easier to manage than before. Choose the hub when you want one choke point and centralised egress; choose distributed endpoints when the Transit Gateway hops cost too much or you want inspection to stay inside each Availability Zone and VPC.

When not to use it

  • A few VPCs with little traffic between them: security groups, network ACLs and a NAT gateway per VPC are simpler.
  • Workloads that must not share fate with other teams' traffic, such as a regulated environment: give them their own inspection.
  • Overlapping IP ranges across spokes: fix addressing first, as a Transit Gateway cannot route between identical ranges.

How to draw it in archhy

  1. From the Services drawer (AWS pack), place an AWS Cloud and a Region, then draw a dotted boundary for each account from the Draw drawer.
  2. Put a VPC in each workload account and an egress VPC with a public subnet, NAT gateway and internet gateway in the network account.
  3. Transit Gateway and Network Firewall have no palette item of their own: place Generic Resources, each with a clear name; their official AWS icons are not in the palette.
  4. Select the Transit Gateway, open its Data tab and add each route table as a field, then show them in an info box. Route tables are the design; the boxes and lines only illustrate it.
  5. Colour traffic before inspection red and after it green, so the one rule that matters (nothing reaches the internet without passing the firewall) is visible at a glance. Download an SVG for the network design document.

Related: multi-Region disaster recovery and protecting a static site at the edge.

Frequently asked questions

Do I still need an inspection VPC for AWS Network Firewall?

Not with the Transit Gateway attachment: AWS creates and manages the VPC that holds the firewall endpoints. You still need a separate egress VPC for NAT gateways.

Why does egress traffic cross the Transit Gateway twice?

Traffic goes from the spoke to the firewall attachment, then from the firewall to the egress VPC. Each is a Transit Gateway hop with its own data processing charge.

What is appliance mode on a Transit Gateway?

A setting that keeps both directions of a connection on the same path, which stateful firewalls need. It is on automatically for the native firewall attachment.

Can I inspect inbound internet traffic this way?

AWS does not recommend it. Inspect inbound traffic at the edge instead, for example with AWS WAF on your load balancers or CloudFront.

based on Redrawn and discussed from Deployment models for AWS Network Firewall: Transit Gateway attachment and multiple VPC endpoints by Lawton Pittenger, Evgeny Vaganov, Pratik R. Mankad and Shakeel Ahmad (AWS Networking & Content Delivery Blog, 11 August 2026). The diagram, the address ranges in it, and the commentary are archhy's own.