Connecting networks: peering, Transit Gateway and VPN

Intermediate · 3 min

Join VPCs and offices: VPC peering and its limits, Transit Gateway as a hub, Site-to-Site and Client VPN, Direct Connect and when to share subnets.

Before thisVPCs, subnets and address planningRoute tables, internet gateways and NATVPC endpoints and PrivateLink

AWS Events · 19 min · from 16:06

Connecting networks: peering, Transit Gateway and VPN

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by AWS EventsReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • VPC peering joins two VPCs directly. It needs non-overlapping ranges, routes on both sides, and is not transitive.
  • Transit Gateway is a Regional router that many VPCs and on-premises links attach to, with its own route tables to control who reaches whom.
  • Site-to-Site VPN runs two IPsec tunnels over the internet. It is quick to set up, with internet latency and per-tunnel bandwidth limits.
  • Direct Connect is a dedicated link with steadier performance. It is not encrypted by default, and one connection is a single point of failure.
  • Connect only what needs connecting. To share one service, PrivateLink is narrower than joining networks.

Islands

Each VPC is an island. That is the point, until the application in one account needs the database in another, or an office needs to reach both. You can send traffic over the public internet and secure it yourself, or you can join the networks.

Whatever you join them with, the same three things must be true: address ranges that don’t overlap, routes in both directions, and firewall rules that allow the traffic.

VPC peering: a bridge between two

A peering connection links two VPCs, in the same or different accounts and Regions. One side requests, the other accepts, and each adds routes:

in VPC A:  10.30.0.0/16  ->  pcx-...
in VPC B:  10.20.0.0/16  ->  pcx-...

There is no hourly charge and no gateway to size; you pay data transfer where it applies. Within one Region you can reference the other side’s security groups.

The limits are about shape. Peering is not transitive: A to B and B to C does not give A to C. You also cannot borrow the neighbour’s internet gateway, NAT gateway or VPN. And to connect every pair of n VPCs you need n(n-1)/2 connections: 3 VPCs need 3, but 20 need 190. A VPC allows 50 active peerings by default, 125 at most.

Transit Gateway: a hub

Transit Gateway is a managed Regional router. Each VPC, VPN or Direct Connect gateway makes one attachment to it, so 20 VPCs need 20 attachments. Transit gateways in different Regions can be peered.

Its power is in its route tables. Each attachment is associated with one table, which decides where its traffic may go. With the default single table everybody reaches everybody. With several you can isolate environments while all of them reach shared services. Each VPC still needs its own routes pointing at the gateway.

The difference from peering is a roundabout compared with private lanes between every pair of houses. The roundabout scales and gives one place to control traffic, and it charges a toll: in eu-west-1 (November 2026), 0.05 USD per attachment per hour and 0.02 USD per GB processed. Twenty attachments cost about 730 USD a month before traffic. Bandwidth is up to 100 Gbps per VPC attachment per Availability Zone.

For global networks spanning many Regions, AWS Cloud WAN manages this from a single policy.

Site-to-Site VPN

To connect an office or data centre, Site-to-Site VPN builds IPsec tunnels between your router (the customer gateway) and a virtual private gateway on one VPC, or a transit gateway.

Each connection has two tunnels, and you should configure both, since AWS maintains them one at a time. A standard tunnel carries up to 1.25 Gbps; large tunnels of up to 5 Gbps exist for Transit Gateway and Cloud WAN attachments. Prefer BGP routing, which notices failures and switches by itself, over static routes.

It is up in an hour and runs over the internet, so latency varies.

Client VPN is the other kind: individual laptops connecting into a VPC with an OpenVPN-based client. For shell access alone, Session Manager avoids needing any VPN.

Direct Connect

Direct Connect is a physical link from your network into AWS at a partner location, dedicated or hosted. You get consistent latency and high bandwidth, with lead times of weeks. It is private but not encrypted by default: use MACsec where supported, or run a VPN over it. Plan a second path; a single fibre will be cut one day.

Choosing

Need Use
a few VPCs, high volume peering
many VPCs and sites, central control Transit Gateway
one service, maybe overlapping ranges PrivateLink
office link this week Site-to-Site VPN
steady heavy traffic to on-premises Direct Connect
several accounts in one network share subnets with Resource Access Manager

The last row is often overlooked. VPC sharing lets a network team own one VPC and give other accounts in the organization subnets to launch into, so there is nothing to connect.

About the video

The embed is a clip (16:06 to 35:27) of AWS’s “AWS networking foundations” from re:Invent 2023. The chapters in this range cover connecting multiple VPCs, peering, Transit Gateway, hybrid connectivity, AWS VPN and Direct Connect. Newer features such as larger VPN tunnels are not in it. I judged it from chapters and description, since transcripts couldn’t be fetched. Adrian Cantrill’s deep dive in deeper goes further into Transit Gateway routing.

What was run: a peering request and acceptance ran against moto, a local emulator. moto also accepted a request between two VPCs with identical ranges, which AWS documents as impossible. No traffic flowed. Limits and behaviour are from AWS documentation and prices from AWS’s public price data, checked in November 2026.

Where this fits

The more networks you join, the more places a packet can vanish. Next: VPC flow logs and network troubleshooting.

Check yourself

  1. 01VPC A is peered with B, and B with C. Can A reach C?

    No. Peering is not transitive. A and C need their own peering, or all three attach to a transit gateway.

  2. 02A peering connection shows active and routes exist in VPC A only. A ping to B gets no reply. Why?

    B also needs a route back to A's range, and the security groups and any network ACLs on both sides must allow the traffic.

  3. 03You need production VPCs to reach a shared services VPC but never each other through a transit gateway. How?

    Use separate transit gateway route tables. Production attachments use a table that holds only the shared services route, and the shared attachment uses a table that holds the routes back to production.

  4. 04A company relies on one Direct Connect connection. What should it add?

    Redundancy: a second connection at a different location, or at least a Site-to-Site VPN as backup, and it should test the failover.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark