Skip to content

AWS Transit Gateway Policy-Based Routing (PBR): Complete Guide to Rule-Based Traffic Forwarding

27 minute read
Content level: Intermediate
1

This article provides a complete guide to AWS Transit Gateway Policy-Based Routing (PBR) — a new feature enabling traffic forwarding decisions based on source/destination IP, ports, and protocol instead of destination-only routing. It covers implementation steps, use cases, limitations, troubleshooting, and benefits for network engineers and security architects building multi-VPC architectures with selective security inspection requirements.

Introduction

AWS Transit Gateway has introduced Policy-Based Routing (PBR) — a powerful new feature that fundamentally changes how network administrators can control traffic forwarding across their transit gateway infrastructure. Until now, Transit Gateway routing decisions were limited to destination IP address only. With PBR, you can now make forwarding decisions based on a 5-tuple combination of packet attributes: source IP, destination IP, source port, destination port, and protocol.

This article provides a comprehensive guide covering the feature overview, real-world use cases, step-by-step implementation, routing evaluation logic, limitations, troubleshooting, and customer benefits.


Table of Contents

  1. What is Transit Gateway Policy-Based Routing?
  2. What Changed - Before vs After PBR
  3. Key Concepts
  4. How Routing Evaluation Works
  5. Real-World Scenario and Use Cases
  6. Step-by-Step Implementation via Console
  7. Architecture Diagram
  8. Limitations
  9. Troubleshooting Guide
  10. Customer Benefits and Advantages
  11. Best Practices
  12. Conclusion
  13. Related Resources

What is Transit Gateway Policy-Based Routing?

Policy-Based Routing (PBR) for AWS Transit Gateway gives network administrators rule-based control over how traffic is forwarded across a transit gateway. Instead of routing solely based on destination IP address, PBR enables forwarding decisions based on:

Match AttributeDescriptionExample
Source CIDR BlockSource IP address or CIDR10.1.10.0/24
Destination CIDR BlockDestination IP address or CIDR10.2.0.0/16
ProtocolIANA protocol numberTCP (6), UDP (17), ICMP (1), GRE (47)
Source Port RangeSource port or port range1024-65535
Destination Port RangeDestination port or port range443 or 80-8080

PBR is configured through policy tables — ordered lists of rules that classify traffic and direct matching packets to a specified transit gateway route table. A policy table replaces the standard route table on an attachment.

Key highlights:

  • Available in all AWS Regions where Transit Gateway is available
  • No additional charge beyond standard Transit Gateway fees
  • No activation required — PBR is enabled on all transit gateways by default
  • Supports IPv4 and IPv6 CIDR formats
  • Compatible with all TGW attachment types: VPC, Direct Connect, VPN (Site-to-Site), Client VPN, Transit Gateway Connect, and Peering

What Changed — Before vs. After PBR

Before PBR (Traditional TGW Routing)

LimitationImpact
Destination-only routingTGW route tables could only forward based on destination CIDR — no source awareness
No port/protocol differentiationAll TCP/UDP/ICMP traffic to the same destination followed the same path
All-or-nothing inspectionEither ALL traffic or NO traffic went through security appliances
Complex multi-VPC workaroundsRequired separate VPCs, multiple TGW attachments, NACLs, or third-party appliances with hairpin routing
No centralized traffic steeringPer-subnet routing was limited to VPC route tables, not at TGW level
Operational overheadManaging multiple route tables and associations for different traffic flows

After PBR (What is Now Possible)

CapabilityBenefit
5-tuple matchingMake forwarding decisions on source, destination, protocol, and ports
Selective traffic steeringSend only specific flows through security/inspection appliances
Multiple routing domains from one attachmentDifferent traffic types use different route tables without multiple attachments
Ordered rule evaluationPredictable, priority-based rule processing (first match wins)
Implicit deny (Zero Trust)Unmatched traffic is dropped — enforce allowlist-style routing at TGW level
Centralized policy enforcementSingle point of control for traffic routing decisions across your entire network
Cost optimizationInspect only what requires inspection — reduce unnecessary appliance processing

Side-by-Side Comparison

ScenarioBefore PBRAfter PBR
Inspect only HTTPS traffic from one subnetRoute ALL traffic through firewall OR deploy complex per-subnet routingSingle policy rule: match source + port 443 → firewall route table
Route different apps over different pathsMultiple TGW attachments per VPC, complex route table managementOne attachment, multiple rules pointing to different route tables
Block unauthorized traffic patterns at TGWNot possible at TGW level — relied on NACLs and Security GroupsPolicy table implicit deny — centralized enforcement at transit layer
Isolate regulated workloads routingSeparate VPCs, separate attachments, peering complexitySame VPC, different subnets, policy rules enforce routing isolation
Protocol-specific routing (e.g., GRE tunnels)All protocols followed same pathMatch protocol 47 (GRE) and route to specific tunnel endpoint

Key Concepts

Policy Table

A policy table is an ordered set of rules associated with a Transit Gateway attachment. Each rule specifies:

  • Match criteria — packet attributes used to classify traffic
  • Target route table — the TGW route table used to forward matched traffic

Important: An attachment can be associated with EITHER a policy table OR a route table, but NOT both.

Policy Rules (Entries)

Each rule in a policy table contains:

ComponentDescriptionRequired?
Rule NumberInteger from 1–50,000 that determines evaluation orderYes
Source CIDR BlockIPv4/IPv6 CIDR to match source IPNo (defaults to Any)
Destination CIDR BlockIPv4/IPv6 CIDR to match destination IPNo (defaults to Any)
ProtocolIANA protocol number (1, 6, 17, 47, or *)No (defaults to Any)
Source Port RangePort or range (only for TCP/UDP)No (defaults to Any)
Destination Port RangePort or range (only for TCP/UDP)No (defaults to Any)
Target Route TableTGW route table for forwarding matched trafficYes

Entry Types

TypeCreated ByRule NumberPrecedenceModifiable
System-managedAWS (e.g., Cloud WAN)Displays as *Evaluated FIRSTNo
Customer-managedYou1–50,000Evaluated AFTER system entriesYes

Implicit Deny

If no rule matches the incoming traffic (neither system-managed nor customer-managed), the traffic is dropped silently. This is the implicit deny behavior — similar to how security groups work with an implicit deny-all at the end.


How Routing Evaluation Works

Understanding the evaluation flow is critical for designing correct policy tables.

Evaluation Order

┌─────────────────────────────────────────────────────────────────┐
│           TRANSIT GATEWAY POLICY TABLE EVALUATION               |
└─────────────────────────────────────────────────────────────────┘

  Packet arrives at TGW attachment associated with Policy Table
                              │
                              ▼
               ┌──────────────────────────────┐
               │  STEP 1: System-Managed      │
               │  Entries (Rule # = *)        │
               │  Evaluated FIRST             │
               └──────────────┬───────────────┘
                         │         │
                    MATCH          NO MATCH
                         │         │
                         ▼         ▼
              ┌────────────┐  ┌──────────────────────────────┐
              │ APPLY rule │  │  STEP 2: Customer-Managed    │
              │ STOP eval. │  │  Entries (ascending order)   │
              └────────────┘  │  Rule 100 → Rule 200 → ...   │
                              └──────────────┬───────────────┘
                                        │         │
                                   MATCH          NO MATCH
                                        │         │
                                        ▼         ▼
                             ┌────────────┐  ┌────────────┐
                             │ APPLY first│  │  STEP 3:   │
                             │ matching   │  │  IMPLICIT  │
                             │ rule. STOP.│  │  DENY      │
                             └────────────┘  │  (DROP)    │
                                             └────────────┘

Key Evaluation Rules

  1. System-managed entries always evaluate first — regardless of their content, they have higher priority than any customer-managed entry.

  2. Customer-managed entries evaluate in ascending numeric order — Rule 100 is evaluated before Rule 200, which is evaluated before Rule 300.

  3. First match wins — once a rule matches, evaluation stops immediately. No subsequent rules are checked.

  4. All specified conditions must match — if a rule specifies both source CIDR and destination port, BOTH must match for the rule to apply.

  5. Omitted fields match everything — if you leave source CIDR blank, it matches any source IP.

  6. Implicit deny at the end — if no rule matches, traffic is dropped.

Evaluation Example

Consider this policy table:

Rule #Source CIDRDest CIDRProtocolDst PortTarget Route Table
10010.1.10.0/24*TCP (6)443tgw-rtb-firewall
20010.1.10.0/24***tgw-rtb-inspection
300****tgw-rtb-default

Scenario A: Packet from 10.1.10.510.2.0.100 on TCP port 443

  • Rule 100: Source matches ✓, Protocol TCP ✓, Dst Port 443 ✓ → MATCH → tgw-rtb-firewall

Scenario B: Packet from 10.1.10.510.2.0.100 on TCP port 22 (SSH)

  • Rule 100: Source matches ✓, Protocol TCP ✓, Dst Port 443 ✗ → NO MATCH
  • Rule 200: Source matches ✓, Protocol Any ✓ → MATCH → tgw-rtb-inspection

Scenario C: Packet from 10.1.30.510.2.0.100 on any protocol

  • Rule 100: Source 10.1.10.0/24 ✗ → NO MATCH
  • Rule 200: Source 10.1.10.0/24 ✗ → NO MATCH
  • Rule 300: Source Any ✓, Dest Any ✓ → MATCH → tgw-rtb-default

Scenario D: If Rule 300 did NOT exist and packet is from 10.1.30.5:

  • Rule 100: NO MATCH
  • Rule 200: NO MATCH
  • No more rules → IMPLICIT DENY → PACKET DROPPED

Real-World Scenario and Use Cases

Use Case 1: Multi-Tier Security Inspection for Financial Services (Primary Scenario)

Business Requirement

A financial services company has a shared VPC with multiple workload tiers that have different compliance requirements:

  • PCI-DSS workloads (Subnet: 10.1.10.0/24) — All HTTPS traffic (port 443) must pass through a Next-Generation Firewall (NGFW) for TLS inspection and threat detection
  • SOX-regulated workloads (Subnet: 10.1.20.0/24) — All traffic must be deep-packet-inspected by an IDS/IPS appliance for audit compliance
  • General workloads (Subnet: 10.1.30.0/24) — Route directly to destination without any inspection (reduce latency and cost)

Without PBR (Old Approach — Complex)

Previously, achieving this required:

  1. Three separate VPCs (one per compliance tier)
  2. Three separate TGW attachments
  3. Three route table associations
  4. Complex VPC peering or PrivateLink for inter-tier communication
  5. Multiple NAT gateways and route configurations
  6. Higher operational complexity and cost

With PBR (New Approach — Simple)

Now you can achieve the same outcome with:

  1. One source VPC with multiple subnets
  2. One TGW attachment for the source VPC
  3. One policy table with three rules
  4. Clear, auditable rule-based logic

Use Case 2: Application-Based Traffic Engineering

Scenario: A media company routes video streaming traffic (UDP ports 1024-65535) over a high-bandwidth dedicated path, while management/control traffic (SSH, HTTPS) routes over a standard path.

Rule #Match CriteriaTarget
100Protocol=UDP, DstPort=1024-65535tgw-rtb-high-bandwidth
200Protocol=TCP, DstPort=22tgw-rtb-management
300Protocol=TCP, DstPort=443tgw-rtb-management
400Catch-alltgw-rtb-default

Use Case 3: Zero Trust Network Segmentation

Scenario: An enterprise wants to enforce that only approved traffic flows are permitted at the transit layer — anything not explicitly allowed is dropped.

Rule #Match CriteriaTarget
100Src=10.1.0.0/16, Dst=10.2.0.0/16, Proto=TCP, DstPort=443tgw-rtb-approved
200Src=10.1.0.0/16, Dst=10.3.0.0/16, Proto=TCP, DstPort=5432tgw-rtb-database
(no catch-all)Implicit Deny (DROP)

By intentionally NOT including a catch-all rule, all traffic that doesn't match an approved flow is silently dropped at the transit gateway level — true Zero Trust enforcement.


Use Case 4: Hybrid Cloud with Selective VPN Inspection

Scenario: Traffic from on-premises (via Direct Connect) destined for sensitive cloud workloads must pass through a cloud-based firewall. Other on-premises-to-cloud traffic routes directly.

Rule #Match CriteriaTarget
100Dst=10.100.0.0/16 (sensitive VPC)tgw-rtb-firewall-inspection
200Dst=10.200.0.0/16 (public apps VPC)tgw-rtb-direct
300Catch-alltgw-rtb-default

The policy table is associated with the Direct Connect gateway attachment, so only on-premises-originating traffic is subject to these rules.


Use Case 5: Multi-Tenant SaaS Isolation

Scenario: A SaaS provider hosts multiple tenants in separate VPCs. Traffic from the shared services VPC must be routed to tenant-specific inspection points based on destination.

Rule #Match CriteriaTarget
100Dst=10.10.0.0/16 (Tenant A)tgw-rtb-tenant-a
200Dst=10.20.0.0/16 (Tenant B)tgw-rtb-tenant-b
300Dst=10.30.0.0/16 (Tenant C)tgw-rtb-tenant-c
400Catch-alltgw-rtb-shared-services

Step-by-Step Implementation (Console)

This section walks through implementing Use Case 1 (Multi-Tier Security Inspection) using the AWS Management Console.

Prerequisites

Before you begin, ensure you have:

  • An existing Transit Gateway
  • A source VPC (workloads) with TGW attachment already created
  • A Firewall VPC with TGW attachment already created
  • An IDS/IPS VPC with TGW attachment already created
  • Destination/Spoke VPCs with TGW attachments already created
  • IAM permissions for the PBR APIs (see IAM section below)

Required IAM Permissions

Your IAM principal needs the following actions:

{
    "Version": "2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action": [
            "ec2:CreateTransitGatewayPolicyTable",
            "ec2:DescribeTransitGatewayPolicyTables",
            "ec2:DeleteTransitGatewayPolicyTable",
            "ec2:AssociateTransitGatewayPolicyTable",
            "ec2:DisassociateTransitGatewayPolicyTable",
            "ec2:GetTransitGatewayPolicyTableAssociations",
            "ec2:GetTransitGatewayPolicyTableEntries",
            "ec2:CreateTransitGatewayPolicyTableEntry",
            "ec2:ModifyTransitGatewayPolicyTableEntry",
            "ec2:DeleteTransitGatewayPolicyTableEntry"
        ],
        "Resource": "*"
    }]
}

Step 1: Create Target Route Tables

Each rule in your policy table needs a target route table. Create one for each traffic path.

  1. Open the Amazon VPC Consolehttps://console.aws.amazon.com/vpc/
  2. In the left navigation pane, under Transit Gateways, select Transit gateway route tables
  3. Click Create transit gateway route table
  4. Configure:
    • Name tag: tgw-rtb-firewall
    • Transit gateway ID: Select your existing Transit Gateway
  5. Click Create transit gateway route table

Repeat to create:

  • tgw-rtb-inspection (for IDS/IPS path)
  • tgw-rtb-default (for direct routing path)

Step 2: Add Routes to Each Route Table

For tgw-rtb-firewall:

  1. Select the route table tgw-rtb-firewall from the list
  2. Navigate to the Routes tab
  3. Click Create static route
  4. Configure:
    • CIDR: 0.0.0.0/0
    • Choose attachment: Select your Firewall VPC attachment
  5. Click Create static route

For tgw-rtb-inspection:

  1. Select tgw-rtb-inspection
  2. Navigate to Routes tab → Click Create static route
  3. Configure:
    • CIDR: 0.0.0.0/0
    • Choose attachment: Select your IDS/IPS VPC attachment
  4. Click Create static route

For tgw-rtb-default:

  1. Select tgw-rtb-default
  2. Navigate to Routes tab → Click Create static route
  3. Configure:
    • CIDR: 10.2.0.0/16 (your destination spoke VPC CIDR)
    • Choose attachment: Select the destination Spoke VPC attachment
  4. Click Create static route
  5. Add additional routes as needed for other destination VPCs

Step 3: Disassociate Existing Route Table from Source VPC Attachment

⚠️ Critical: An attachment cannot have both a route table AND a policy table. You must disassociate the existing route table first.

  1. In the left pane, go to Transit gateway route tables
  2. Select the route table currently associated with your source workload VPC attachment
  3. Navigate to the Associations tab
  4. Select the row showing your source VPC attachment
  5. Click Delete association
  6. In the confirmation dialog, click Delete association
  7. Wait for the state to change from Disassociating to complete

Step 4: Create the Policy Table

  1. In the left navigation pane, under Transit Gateways, select Transit gateway policy tables
  2. Click Create transit gateway policy table
  3. Configure:
    • Name tag: multi-tier-security-policy
    • Transit gateway ID: Select your Transit Gateway
  4. Click Create transit gateway policy table
  5. Wait for state to become Available
  6. Note the Policy Table ID (e.g., tgw-ptb-0ca78a549EXAMPLE)

Step 5: Create Policy Table Entries (Rules)

Rule 100 — PCI HTTPS Traffic → Firewall

  1. Select the policy table multi-tier-security-policy
  2. Navigate to the Entries tab
  3. Click Create entry
  4. Under Entry details:
    • Rule number: 100
    • Target transit gateway route table: Select tgw-rtb-firewall
  5. Under Rule conditions:
    • Source CIDR block: 10.1.10.0/24
    • Destination CIDR block: (leave blank — matches any destination)
    • Protocol: Select TCP (6)
    • Source port range: (leave blank — matches any source port)
    • Destination port range: 443
  6. Click Create entry

Rule 200 — SOX Regulated Traffic → Deep Inspection

  1. Still on the Entries tab → Click Create entry
  2. Under Entry details:
    • Rule number: 200
    • Target transit gateway route table: Select tgw-rtb-inspection
  3. Under Rule conditions:
    • Source CIDR block: 10.1.20.0/24
    • Destination CIDR block: (leave blank)
    • Protocol: Select Any (*)
    • Source port range: (automatically set to Any — grayed out)
    • Destination port range: (automatically set to Any — grayed out)
  4. Click Create entry

Rule 300 — Catch-All → Direct Routing

  1. Still on the Entries tab → Click Create entry
  2. Under Entry details:
    • Rule number: 300
    • Target transit gateway route table: Select tgw-rtb-default
  3. Under Rule conditions:
    • Source CIDR block: (leave blank — matches any)
    • Destination CIDR block: (leave blank — matches any)
    • Protocol: Select Any (*)
  4. Click Create entry

Step 6: Associate Policy Table with Source VPC Attachment

  1. Select the policy table multi-tier-security-policy
  2. Navigate to the Associations tab
  3. Click Create association
  4. In the Create association modal:
    • Transit gateway policy table: Pre-filled
    • Transit gateway ID: Pre-filled
    • Transit gateway attachment: Select your source workload VPC attachment from the dropdown
  5. Click Create
  6. Wait for state to transition from AssociatingAssociated

Step 7: Verify the Complete Configuration

  1. Select the policy table multi-tier-security-policy
  2. Entries tab — confirm all three rules appear in correct order:
Rule #Source CIDRDest CIDRProtocolSrc PortDst PortTarget Route Table
10010.1.10.0/24*TCP (6)*443tgw-rtb-firewall
20010.1.20.0/24****tgw-rtb-inspection
300*****tgw-rtb-default
  1. Associations tab — confirm the source VPC attachment shows State: Associated

  2. Test traffic flows:

    • From 10.1.10.x host: curl https://10.2.0.100 → should traverse firewall
    • From 10.1.20.x host: ping 10.2.0.100 → should traverse IDS/IPS
    • From 10.1.30.x host: ping 10.2.0.100 → should route directly

Architecture Diagram

Complete Architecture for Multi-Tier Security Inspection

┌──────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                      │
│                            AWS TRANSIT GATEWAY                                       │
│                                                                                      │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                POLICY TABLE: multi-tier-security-policy                        │  │
│  │                                                                                │  │
│  │  ┌─────────────────────────────────────────────────────────────────────────┐   │  │
│  │  │ Rule 100 │ Src: 10.1.10.0/24 │ Proto: TCP │ DstPort: 443                │   │  │
│  │  │          │ → Target: tgw-rtb-firewall                                   │   │  │
│  │  ├─────────────────────────────────────────────────────────────────────────┤   │  │
│  │  │ Rule 200 │ Src: 10.1.20.0/24 │ Proto: Any │ Port: Any                   │   │  │
│  │  │          │ → Target: tgw-rtb-inspection                                 │   │  │
│  │  ├─────────────────────────────────────────────────────────────────────────┤   │  │
│  │  │ Rule 300 │ Src: Any           │ Proto: Any │ Port: Any (Catch-all)      │   │  │
│  │  │          │ → Target: tgw-rtb-default                                    │   │  │
│  │  └─────────────────────────────────────────────────────────────────────────┘   │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                                                                      │
│         ┌──────────────┐      ┌──────────────┐      ┌──────────────┐                 │
│         │tgw-rtb-      │      │tgw-rtb-      │      │tgw-rtb-      │                 │
│         │firewall      │      │inspection    │      │default       │                 │
│         │              │      │              │      │              │                 │
│         │ 0.0.0.0/0 →  │      │ 0.0.0.0/0 →  │      │ 10.2.0.0/16→ │                 │
│         │ FW-VPC-Att   │      │ IDS-VPC-Att  │      │ Spoke-Att    │                 │
│         └──────┬───────┘      └──────┬───────┘      └──────┬───────┘                 │
│                │                     │                     │                         │
└────────────────┼─────────────────────┼─────────────────────┼─────────────────────────┘
                 │                     │                     │
                 ▼                     ▼                     ▼
┌────────────────────────┐ ┌────────────────────────┐ ┌────────────────────────────┐
│   FIREWALL VPC         │ │   IDS/IPS VPC          │ │   DESTINATION SPOKE VPC    │
│   10.0.100.0/24        │ │   10.0.200.0/24        │ │   10.2.0.0/16              │
│                        │ │                        │ │                            │
│  ┌──────────────────┐  │ │  ┌──────────────────┐  │ │  ┌──────────────────────┐  │
│  │ Next-Gen Firewall│  │ │  │ Suricata/Snort   │  │ │  │ Application Servers  │  │
│  │ (Palo Alto/      │  │ │  │ IDS/IPS          │  │ │  │ Databases            │  │
│  │  Fortinet/AWS    │  │ │  │ Deep Packet      │  │ │  │ Microservices        │  │
│  │  Network FW)     │  │ │  │ Inspection       │  │ │  │                      │  │
│  └──────────────────┘  │ │  └──────────────────┘  │ │  └──────────────────────┘  │
│         │              │ │         │              │ │                            │
│         │ Inspected    │ │         │ Inspected    │ │                            │
│         │ traffic back │ │         │ traffic back │ │                            │
│         ▼ to TGW       │ │         ▼ to TGW       │ │                            │
└────────────────────────┘ └────────────────────────┘ └────────────────────────────┘

                 ▲
                 │  (Associated with Policy Table)
                 │
┌────────────────────────────────────────────┐
│         SOURCE WORKLOAD VPC                │
│         10.1.0.0/16                        │
│                                            │
│  ┌──────────────┐  ┌──────────────┐        │
│  │ PCI Subnet   │  │ SOX Subnet   │        │
│  │ 10.1.10.0/24 │  │ 10.1.20.0/24 │        │
│  │              │  │              │        │
│  │ HTTPS→FW     │  │ ALL→IDS/IPS  │        │
│  └──────────────┘  └──────────────┘        │
│                                            │
│  ┌──────────────┐                          │
│  │ General Sub  │                          │
│  │ 10.1.30.0/24 │                          │
│  │              │                          │
│  │ ALL→Direct   │                          │
│  └──────────────┘                          │
│                                            │
│  TGW Attachment: tgw-attach-source-vpc     │
│  Associated with: Policy Table             │
└────────────────────────────────────────────┘

Limitations

Understanding the limitations helps you design your architecture correctly from the start.

#LimitationDetailsWorkaround
1Cloud WAN peering attachmentsCustomer-managed PBR entries are NOT supported on TGW-to-Cloud WAN (CWAN) peering attachments. Only system-managed entries control traffic on these attachments.Use PBR on other attachment types; rely on Cloud WAN segment policies for CWAN traffic
2BGP route advertisements stopAssociating a policy table with VPN (Site-to-Site) or Connect attachments stops all BGP route advertisements to the peerVerify routing impact before associating. Direct Connect is unaffected (uses allowed-prefixes list)
3Exclusive associationAn attachment can have EITHER a policy table OR a route table — never bothDisassociate the route table before associating a policy table
4System entries take precedenceSystem-managed entries (from Cloud WAN) always evaluate before customer rules and cannot be modifiedDesign customer rules knowing they only apply to unmatched traffic
5Port ranges limited to TCP/UDPSource and destination port matching only works for TCP (6) and UDP (17). For ICMP, GRE, or Any — ports are always *Use source/destination CIDR for non-TCP/UDP traffic differentiation
6Rule number rangeRules must be between 1 and 50,000Use gaps (100, 200, 300) for future insertion flexibility
7Empty policy table = drop allAn attachment associated with an empty policy table drops ALL trafficAlways add at least one rule (or a catch-all) before associating
8Referenced route tables cannot be deletedA TGW route table referenced as a target by any policy entry cannot be deletedRemove or update policy entries referencing the route table first

Troubleshooting Guide

Problem 1: Traffic is Being Dropped Unexpectedly

Symptoms: Applications lose connectivity after policy table association.

Diagnosis:

  1. Check the PacketDropCountNoPolicy CloudWatch metric — if incrementing, traffic is arriving but no rule matches
  2. Review your policy table entries — is there a catch-all rule?
  3. Verify rule evaluation order — a broader rule at a lower number may be matching before your intended rule

Resolution:

  • Add a catch-all rule at a high rule number (e.g., Rule 50000) with all attributes set to Any
  • Reorder rules to ensure specific rules have lower numbers than broad rules

Problem 2: A Rule is Not Matching Traffic as Expected

Symptoms: Traffic bypasses the intended rule and matches a later rule or gets dropped.

Diagnosis:

  1. Verify rule evaluation order — first match wins. A broader rule at a lower number may be shadowing your specific rule
  2. Use GetTransitGatewayPolicyTableEntries API or check the console Entries tab to view ALL entries including system-managed ones
  3. System-managed entries (shown as Rule #: *) evaluate BEFORE your rules

Resolution:

  • Reorder rules — move specific rules to lower numbers
  • Check that all match conditions in your rule actually match the traffic (all conditions must match for a rule to apply)
  • Confirm system-managed entries aren't intercepting your traffic

Problem 3: Port Ranges Are Not Being Applied

Symptoms: Rule matches traffic regardless of port, even though port range is specified.

Diagnosis:

  • Port ranges are only evaluated when Protocol is TCP (6) or UDP (17)
  • If Protocol is set to ICMP (1), GRE (47), or Any (*), port values are automatically set to Any and ignored

Resolution:

  • Set the Protocol field to TCP or UDP explicitly if you need port-based matching
  • If you submitted port ranges with a non-TCP/UDP protocol via API, the request would be rejected with a validation error

Problem 4: Cannot Delete a Route Table

Symptoms: Route table deletion fails with a dependency error.

Diagnosis:

  • A TGW route table referenced as a target in any policy table entry cannot be deleted

Resolution:

  1. Use GetTransitGatewayPolicyTableEntries and filter by target-route-table-id to find referencing rules
  2. Update or delete those policy entries to remove the reference
  3. Retry the route table deletion

Problem 5: Cannot Associate a Policy Table to an Attachment

Symptoms: Association request fails or the button is grayed out.

Diagnosis:

  1. The attachment may already have a route table associated — check the attachment's current associations
  2. The attachment type may not be supported (TGW-to-CWAN peering attachments don't support customer PBR)

Resolution:

  • Disassociate the existing route table first (Transit gateway route tables → Associations tab → Delete association)
  • Verify the attachment type is supported

Problem 6: Policy Table is Empty and All Traffic is Dropped

Symptoms: After associating a policy table, ALL traffic from that attachment is dropped.

Diagnosis:

  • An attachment associated with an empty policy table drops all ingressing packets (same behavior as an empty route table)

Resolution:

  • Add at least one rule to the policy table
  • Or temporarily reassociate the attachment with a route table to restore connectivity while you configure the policy

Useful CloudWatch Metric for Monitoring

MetricNamespaceDescription
PacketDropCountNoPolicyAWS/TransitGatewayCount of packets dropped because no policy rule matched

Customer Benefits and Advantages

1. Granular Traffic Control Without Complexity

Before: Achieving source-based or port-based routing at the transit layer required complex multi-VPC architectures, multiple TGW attachments, and intricate route table management.

Now: A single policy table with ordered rules provides the same (and better) granularity with a fraction of the operational complexity.

2. Significant Cost Optimization

Before: Organizations had to route ALL traffic through expensive security appliances (firewalls, IDS/IPS) because TGW couldn't differentiate traffic types — leading to over-provisioned appliances and unnecessary data processing charges.

Now: Inspect only what needs inspection. If only 20% of your traffic requires firewall inspection, you reduce appliance throughput needs by 80%, directly saving on:

  • Security appliance licensing costs
  • EC2 instance sizes for virtual appliances
  • TGW data processing for unnecessary hops
  • Network latency for non-inspected traffic

3. Compliance Simplification

Before: Meeting compliance requirements (PCI-DSS, SOX, HIPAA) for traffic inspection required architectural isolation — separate VPCs per compliance tier.

Now: Multiple compliance tiers coexist in the same VPC with different subnets. Policy rules enforce the inspection requirements at the transit layer — auditable, centralized, and simple to demonstrate to auditors.

4. Zero Trust at the Transit Layer

Before: Zero Trust principles were enforced at the instance level (Security Groups) or subnet level (NACLs). The transit layer was permissive by default.

Now: The implicit deny behavior of policy tables means traffic must be explicitly approved for routing. Unauthorized flows are dropped before they reach any VPC — true network-level Zero Trust.

5. Operational Simplicity

AspectBenefit
Single point of controlAll routing decisions centralized in one policy table
Auditable rulesClear, ordered rules visible in console and API
No agent requiredWorks at the network layer — no application changes needed
Immediate effectRules apply in real-time — no propagation delay
ReversibleDisassociate policy table to revert to standard routing instantly

6. No Additional Cost

PBR is available at no extra charge beyond standard Transit Gateway fees. There's no per-rule charge, no per-evaluation charge, and no premium tier needed. This makes it accessible to all customers regardless of scale.

7. Multi-Path Traffic Engineering

Network engineers can implement sophisticated traffic engineering patterns directly at the AWS transit layer — routing different application traffic over different network paths based on protocol and port characteristics, similar to what was previously only possible with on-premises SD-WAN solutions.


Best Practices

Rule Design

PracticeReason
Leave gaps between rule numbers (100, 200, 300)Allows inserting new rules later without renumbering
Put most specific rules first (lower numbers)Prevents broad rules from shadowing specific ones
Always include a catch-all rulePrevents unintended silent drops (unless you specifically want Zero Trust deny-all)
Configure protocol before port rangesPort ranges only work with TCP/UDP — setting protocol first determines field availability

Operational

PracticeReason
Use GetTransitGatewayPolicyTableEntries to verifyConfirms all entries (including system-managed) and evaluation order
Test with non-production traffic firstVerify rules work as expected before routing production workloads
Monitor PacketDropCountNoPolicy metricAlerts you when traffic is being dropped due to no matching rule
Document your rule purposeUse naming conventions or external documentation to track why each rule exists
Use IAM conditions for governanceRestrict which attachments can have policy tables associated (tag-based conditions)

Architecture

PracticeReason
Associate same policy table with multiple attachmentsReuse rule sets across similar traffic sources
Plan return traffic pathTraffic returning from inspection appliances uses destination-based routing on their own route table — ensure routes exist
Consider asymmetric routingInspection only happens on ingress to the policy-table-associated attachment — plan accordingly for stateful appliances

Conclusion

AWS Transit Gateway Policy-Based Routing represents a significant advancement in cloud networking capabilities. It bridges the gap between traditional on-premises router functionality (where policy-based routing has been standard for decades) and cloud-native networking.

Key Takeaways:

  1. PBR enables 5-tuple-based routing decisions at the transit layer — something previously impossible in AWS
  2. No additional cost and no activation required — available on all existing Transit Gateways
  3. Dramatically simplifies architectures that previously required complex multi-VPC designs for traffic differentiation
  4. Enables selective security inspection — reducing costs while meeting compliance requirements
  5. Implements Zero Trust at the network transit layer through implicit deny
  6. Compatible with all TGW attachment types except Cloud WAN peering

For organizations running hub-and-spoke or complex multi-VPC architectures with security inspection requirements, PBR eliminates significant architectural complexity while providing more granular control than was previously possible.


Related Resources


AWS
EXPERT

published 17 days ago310 views