Skip to main content
Cloud basicsLesson 13 of 17

Connecting Networks: Peering, Transit, VPN and Private Endpoints

A company has an office network and two VPCs, and later buys a partner service and another company. Each network is private and cut off by default. Follow which link joins what, why traffic must have a route both ways, and why IP ranges have to be planned early. What happens inside one VPC comes first in How a Request Travels Inside a VPC.

PathApp → DB
Route usednone
Reachable?No
Office · 10.50.0.0/16VPC A · shop · 10.1.0.0/16VPC B · data · 10.2.0.0/16PartnerAcquired co.Office servers10.50.0.0/16Office DNScorp.exampleVPN · dedicatedIPsec · BGPTransit gatewayHub · route tablesApp server10.1.1.10DNS resolverIn/outbound endpointsPrivate endpoint10.1.2.50Orders DB10.2.3.20Partner APIEndpoint serviceTheir VPC10.1.0.0/16 !
RequestResponse / reportAppears in a later step

What you will learn

  • Private networks are cut off until a route and a permission exist
  • VPC peering joins two VPCs, but is not transitive
  • Site-to-site VPN versus a dedicated link, and how BGP shares routes
  • A transit gateway as a hub for many networks
  • Why a missing return route looks like a timeout
  • Hybrid DNS, private endpoints and the overlapping-CIDR trap

Ways to connect networks​

OptionUse it whenTransitive?BandwidthCost shape
VPC peeringTwo VPCs need to talk directlyNoNo gateway in the path, no single bottleneckNo hourly fee; data transfer charges
Transit gateway (hub)Many VPCs and on-premises sitesYes, through its route tablesHigh, with per-attachment limitsPer attachment hour plus per GB processed
Site-to-site VPNA quick encrypted link over the internetThrough a hubAbout 1.25 Gbps per tunnel on AWS (5 Gbps with large-bandwidth tunnels); internet latencyPer connection hour plus data out
Dedicated linkSteady, high-volume office or data-center trafficThrough a gateway or hub1 Gbps to 100 Gbps or more, steady latencyPort hours plus data out; weeks to set up
Private endpointReach one service, not a whole networkNo, one way to one servicePer endpointPer endpoint hour per zone plus per GB

Names by provider​

ConceptAWSAzureGoogle Cloud
PeeringVPC peeringVNet peeringVPC Network Peering
HubTransit GatewayVirtual WAN or a hub VNetNetwork Connectivity Center
VPNSite-to-Site VPNVPN GatewayCloud VPN (HA VPN)
Dedicated linkDirect ConnectExpressRouteCloud Interconnect
Private endpointPrivateLinkPrivate Link (private endpoint)Private Service Connect
Hybrid DNSRoute 53 Resolver endpointsDNS Private ResolverCloud DNS forwarding zones and inbound policies

Try it yourself​

aws ec2 describe-route-tables --filters Name=vpc-id,Values=vpc-0abc \
--query 'RouteTables[].Routes[].[DestinationCidrBlock,GatewayId,VpcPeeringConnectionId,TransitGatewayId]' --output table
aws ec2 describe-vpc-peering-connections --query 'VpcPeeringConnections[].[VpcPeeringConnectionId,Status.Code,RequesterVpcInfo.CidrBlock,AccepterVpcInfo.CidrBlock]'
aws ec2 describe-transit-gateway-attachments --query 'TransitGatewayAttachments[].[ResourceType,ResourceId,State]'
aws ec2 describe-vpn-connections --query 'VpnConnections[].VgwTelemetry[].[OutsideIpAddress,Status,AcceptedRouteCount]'

# From an office server
traceroute 10.2.3.20 # Where does the path stop?
dig db.data.internal # Does the name resolve across the link?
nc -vz 10.2.3.20 5432 # Refused (reached, nothing listening) or timeout (dropped)?

Check yourself

  1. The office reaches VPC A over a VPN, and VPC A is peered with VPC B. All security groups allow the office range, yet the office cannot reach VPC B. Why?
  2. A packet from the office reaches the DB, but the client times out. The DB subnet's route table only knows 10.1.0.0/16. What is missing?
  3. The shop needs to call only a partner's payment API, without joining the two networks, and the CIDRs overlap. Which option fits?

Further reading: VPC peering (AWS) · Transit gateways (AWS) · Site-to-Site VPN (AWS) · AWS PrivateLink · Route 53 Resolver · How a Request Travels Inside a VPC · Under One Request: TCP/IP Layers