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
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
| Option | Use it when | Transitive? | Bandwidth | Cost shape |
|---|---|---|---|---|
| VPC peering | Two VPCs need to talk directly | No | No gateway in the path, no single bottleneck | No hourly fee; data transfer charges |
| Transit gateway (hub) | Many VPCs and on-premises sites | Yes, through its route tables | High, with per-attachment limits | Per attachment hour plus per GB processed |
| Site-to-site VPN | A quick encrypted link over the internet | Through a hub | About 1.25 Gbps per tunnel on AWS (5 Gbps with large-bandwidth tunnels); internet latency | Per connection hour plus data out |
| Dedicated link | Steady, high-volume office or data-center traffic | Through a gateway or hub | 1 Gbps to 100 Gbps or more, steady latency | Port hours plus data out; weeks to set up |
| Private endpoint | Reach one service, not a whole network | No, one way to one service | Per endpoint | Per endpoint hour per zone plus per GB |
Names by provider
| Concept | AWS | Azure | Google Cloud |
|---|---|---|---|
| Peering | VPC peering | VNet peering | VPC Network Peering |
| Hub | Transit Gateway | Virtual WAN or a hub VNet | Network Connectivity Center |
| VPN | Site-to-Site VPN | VPN Gateway | Cloud VPN (HA VPN) |
| Dedicated link | Direct Connect | ExpressRoute | Cloud Interconnect |
| Private endpoint | PrivateLink | Private Link (private endpoint) | Private Service Connect |
| Hybrid DNS | Route 53 Resolver endpoints | DNS Private Resolver | Cloud 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
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