nodemethod
ConnectivityIntermediate

Hub-and-spoke with a transit gateway

Every network attaches once to a central router, which handles routing, segmentation and shared services.

Once more than a few networks need to talk, a managed transit hub replaces the mesh. AWS Transit Gateway, Azure Virtual WAN and Google Network Connectivity Center all follow this model: each VPC, VPN and dedicated link attaches to the hub, and route tables on the hub decide which attachments can reach which. Cloud providers' own architecture guidance recommends hub-and-spoke over a many-to-many mesh as soon as more than two networks are involved.

TRANSIT HUBBGPHUBTransit gatewayprod · nonprod · sharedNETprod-webVPCNETprod-paymentsVPCNETdevVPCNETshared servicesDNS, CI, artifactsSECinspectionfirewall VPCDCData centreVPN / interconnect
traffictunnel / replicationblocked

When to use it

  • More than three VPCs, accounts or subscriptions
  • On-premises networks that must reach many VPCs
  • Separating production from non-production with route tables
  • Central inspection or shared egress

When to avoid it

  • Two VPCs with very latency-sensitive traffic: the hub adds a hop
  • Very high volume between two VPCs, where per-GB processing cost dominates

How traffic flows

  1. Each VPC attaches to the hub with one attachment per zone, and its route table sends other internal ranges to the hub.
  2. Hub route tables enforce segmentation: production attachments propagate into the prod table, development into nonprod, and both can reach shared services but not each other.
  3. Traffic that must be inspected is routed through a firewall VPC attached to the hub (appliance mode keeps both directions on the same appliance).
  4. On-premises routes arrive over BGP from VPN or dedicated links and propagate into whichever tables should see them.

Configuration examples

resource "aws_ec2_transit_gateway" "hub" {
  amazon_side_asn                 = 64512
  default_route_table_association = "disable"
  default_route_table_propagation = "disable"
}

resource "aws_ec2_transit_gateway_route_table" "prod"    { transit_gateway_id = aws_ec2_transit_gateway.hub.id }
resource "aws_ec2_transit_gateway_route_table" "nonprod" { transit_gateway_id = aws_ec2_transit_gateway.hub.id }

resource "aws_ec2_transit_gateway_vpc_attachment" "prod_web" {
  transit_gateway_id = aws_ec2_transit_gateway.hub.id
  vpc_id             = module.prod_web.vpc_id
  subnet_ids         = module.prod_web.tgw_subnet_ids   # one small subnet per zone
}

resource "aws_ec2_transit_gateway_route_table_association" "prod_web" {
  transit_gateway_attachment_id  = aws_ec2_transit_gateway_vpc_attachment.prod_web.id
  transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.prod.id
}

# prod can reach shared services; nonprod routes never propagate into prod
resource "aws_ec2_transit_gateway_route_table_propagation" "shared_into_prod" {
  transit_gateway_attachment_id  = aws_ec2_transit_gateway_vpc_attachment.shared.id
  transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.prod.id
}

Examples are starting points. Review provider limits, names and versions for your environment before applying.

What to monitor

SignalWhy it matters
Attachment state and BGP session statusA down attachment isolates a whole VPC.
Bytes and packets dropped (no route, blackhole)Shows traffic the hub refused, usually a missing propagation.
Per-attachment throughputSpots noisy spokes and cost hot spots.
Route table changesA propagation added to the wrong table breaks segmentation.

Common failure modes

Dev routes propagated into prod

Non-production can now reach production databases.

Sentinel checks reachability against your segmentation policy and flags the new path.

Blackhole route after a VPC is deleted

Traffic for that range is dropped at the hub.

Pulse reports packet drops on the blackhole route and the attachment it belonged to.

Asymmetric inspection

Return traffic bypasses the firewall and stateful sessions break.

Lens correlates firewall session resets with hub route changes.

Checklist

0 of 6 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open