devHọc Dev

Week 2 - Day 3: Advanced VPC, Transit Gateway and Direct Connect

Week 2 – Day 3

This lesson combines 3 topics: VPC Advanced Concepts, Transit Gateway Deep Dive, AWS Direct Connect.

Learning Objectives

  • Understand VPC Endpoints in depth
  • Master VPC Peering and its limitations
  • Know how to design multi-VPC architectures
  • Understand the architecture and components of Transit Gateway
  • Master routing concepts and route tables
  • Know how to implement network segmentation
  • Understand the architecture and components of Direct Connect
  • Master Virtual Interfaces (VIFs)
  • Know how to design for high availability

Part 1: VPC Advanced Concepts

1. VPC Endpoints

Types of VPC Endpoints

┌─────────────────────────────────────────────────────────┐│VPCENDPOINTS││││┌─────────────────────────────────────────────────┐│││GatewayEndpoints(Free)││││││││SupportedServices:││││-S3││││-DynamoDB││││││││Howitworks:││││-Entryinroutetable││││-TrafficstayswithinAWSnetwork││││-AccessonlyfromresourcesINtheVPC││││-NOTaccessiblefromon-premises││││(DirectConnect/VPN)│││└─────────────────────────────────────────────────┘││││┌─────────────────────────────────────────────────┐│││InterfaceEndpoints(Paid)││││││││SupportedServices:││││-MostAWSservices(100+)││││-AWSPrivateLinkservices││││-DynamoDB(viaPrivateLink,GA2023)││││-S3(PrivateLink,foron-premaccess)││││││││Howitworks:││││-ENIinyoursubnet││││-PrivateIPaddress││││-DNSresolutiontoprivateIP││││-Accessiblefromon-premisesviaDX/VPN│││└─────────────────────────────────────────────────┘││││┌─────────────────────────────────────────────────┐│││GatewayLoadBalancerEndpoints││││││││For:Third-partyvirtualappliances││││-Firewalls││││-IDS/IPS││││-Deeppacketinspection│││└─────────────────────────────────────────────────┘│└─────────────────────────────────────────────────────────┘

Gateway Endpoint Architecture

┌─────────────────────────────────────────────────────────┐│VPC││┌──────────────────────────────────────────────────┐│││PrivateSubnet││││││││┌───────────┐│││││EC2│───────┐││││└───────────┘│││││▼││││RouteTable:││││┌────────────────────────────────────────┐│││││Destination│Target│││││├────────────────┼───────────────────────┤│││││10.0.0.0/16│local││││││pl-xxxxx(S3)│vpce-xxxxx(GWEP)│││││└────────────────────────────────────────┘│││└──────────────────────────────────────────────────┘│││││▼││┌──────────────────────────────────────────────────┐│││GatewayEndpoint(vpce-xxxxx)│││└──────────────────────────────────────────────────┘││││└──────────────────────────────┼──────────────────────────┘│▼┌───────────┐│S3│└───────────┘

Interface Endpoint Architecture

┌─────────────────────────────────────────────────────────┐│VPC││┌──────────────────────────────────────────────────┐│││PrivateSubnet││││││││┌───────────┐┌───────────────────────┐│││││EC2│─────►│InterfaceEndpoint│││││└───────────┘│(ENI:10.0.1.100)││││││││││││DNS:secrets.manager.││││││ap-southeast-1.││││││amazonaws.com│││││└───────────────────────┘│││└──────────────────────────────────────────────────┘││││└──────────────────────────────┼──────────────────────────┘│AWSPrivateLink▼┌─────────────────────┐│SecretsManager│└─────────────────────┘

Endpoint Policies

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "AllowSpecificBucket",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:*",
      "Resource": [
        "arn:aws:s3:::my-secure-bucket",
        "arn:aws:s3:::my-secure-bucket/*"
      ]
    }
  ]
}

DynamoDB: Gateway vs Interface Endpoint

DynamoDB supports both endpoint types. Knowing which one fits a SAP-C02 scenario matters.

CriteriaDynamoDB Gateway EndpointDynamoDB Interface Endpoint (PrivateLink)
PricingFree$0.01/hour/AZ + data processing
Access from within the VPC✓✓
Access from on-premises (DX/VPN)✗ Not supported✓ Yes
Cross-region access✗✓ (via VPC peering / TGW)
SetupAdd a route to the route tableCreate an ENI in the subnet
DNS resolutionPublic DNS → private routePrivate DNS name
Default use caseAll traffic within the VPCHybrid: on-prem needs to access DynamoDB

Exam keyword:

  • "Most cost-effective access to DynamoDB from VPC" → Gateway Endpoint (free)
  • "Access DynamoDB from on-premises through Direct Connect/VPN" → Interface Endpoint (PrivateLink)
  • "Hybrid architecture, on-prem app calls DynamoDB privately" → Interface Endpoint

Note: S3 also has both endpoint types with a similar pattern (S3 Interface Endpoint GA 2021 for hybrid use cases).

2. VPC Peering

How it works

┌─────────────────┐┌─────────────────┐│VPCA│Peering│VPCB││10.0.0.0/16│◄───────►│172.16.0.0/16││││││RouteTable:││RouteTable:││172.16.0.0/16││10.0.0.0/16││→pcx-xxxxx││→pcx-xxxxx│└─────────────────┘└─────────────────┘

Key Characteristics

  • Non-transitive: Traffic cannot transit through peered VPC
  • Cross-region: Supported with inter-region peering
  • Cross-account: Supported with accepter approval
  • No overlapping CIDR: VPCs cannot have overlapping IP ranges

Transitive Peering Problem

┌─────────────────┐│VPCA│└────────┬────────┘│Peering┌────────┴────────┐│VPCB│└────────┬────────┘│Peering┌────────┴────────┐│VPCC│└─────────────────┘A←→B:✓(directpeering)B←→C:✓(directpeering)A←→C:✗(notransitiverouting)Solution:UseTransitGateway

VPC Peering Limitations

LimitationDetail
Max peers per VPC125
BandwidthNo aggregate limit
Transitive routingNot supported
Overlapping CIDRNot supported
DNS resolutionNeeds enablement

3. Multi-VPC Architectures

Pattern 1: Hub-and-Spoke (Full Mesh Peering)

┌─────────────────┐│VPCHub││(Shared)│└────────┬────────┘│┌───────────────────┼───────────────────┐│││▼▼▼┌─────────────────┐┌─────────────────┐┌─────────────────┐│VPCSpoke1││VPCSpoke2││VPCSpoke3││(ProdApp1)││(ProdApp2)││(Dev)│└─────────────────┘└─────────────────┘└─────────────────┘Pros:Simple,noadditionalcostCons:Doesnotscalewell(n*(n-1)/2peerings)
┌─────────────────┐│TransitGateway│└────────┬────────┘│┌────────────────────────┼────────────────────────┐│││││▼▼▼▼▼┌───────┐┌───────┐┌───────┐┌───────┐┌───────┐│VPC1││VPC2││VPC3││VPN││DX│└───────┘└───────┘└───────┘└───────┘└───────┘Pros:Scaleswell,centralizedmanagementCons:Per-attachmentandper-GBcost

4. Private DNS with VPC

Route 53 Private Hosted Zone

┌─────────────────────────────────────────────────────────┐│Route53PrivateHostedZone││(internal.company.com)││││Records:││-app.internal.company.com→10.0.1.50││-db.internal.company.com→10.0.2.100││-api.internal.company.com→10.0.3.75│└────────────────────────────┬────────────────────────────┘│AssociatedwithVPCs:│┌───────────────────┼───────────────────┐▼▼▼┌─────────┐┌─────────┐┌─────────┐│VPCA││VPCB││VPCC││(Prod)││(Dev)││(Test)│└─────────┘└─────────┘└─────────┘

Route 53 Resolver

On-Premises→AWS:┌───────────────┐┌─────────────────┐│On-Premises│DNSQuery│VPC││DNSServer│───────────────────►│Inbound│││(ForwardtoAWS)│Endpoint│└───────────────┘└─────────────────┘AWS→On-Premises:┌─────────────────┐┌───────────────┐│VPC│DNSQuery│On-Premises││Outbound│─────────────────►│DNSServer││Endpoint│(Forwardto││││on-prem)││└─────────────────┘└───────────────┘

5. VPC Design Best Practices

CIDR Planning

CompanyCIDR:10.0.0.0/8Production:10.0.0.0/12(1MIPs)├──Prod-VPC-1:10.0.0.0/16├──Prod-VPC-2:10.1.0.0/16└──Prod-VPC-3:10.2.0.0/16Development:10.64.0.0/12(1MIPs)├──Dev-VPC-1:10.64.0.0/16└──Dev-VPC-2:10.65.0.0/16Testing:10.128.0.0/12(1MIPs)└──Test-VPC-1:10.128.0.0/16

Subnet Design

VPCCIDR:10.0.0.0/16AZ-aSubnets:├──Public:10.0.0.0/24(Webservers,ALB)├──Private:10.0.1.0/24(Appservers)├──Database:10.0.2.0/24(RDS,ElastiCache)└──Reserved:10.0.3.0/24(Futureuse)AZ-bSubnets:├──Public:10.0.10.0/24├──Private:10.0.11.0/24├──Database:10.0.12.0/24└──Reserved:10.0.13.0/24AZ-cSubnets:├──Public:10.0.20.0/24├──Private:10.0.21.0/24├──Database:10.0.22.0/24└──Reserved:10.0.23.0/24

Part 2: Transit Gateway Deep Dive

1. Transit Gateway Overview

Definition

AWS Transit Gateway is a regional network transit hub that lets you connect:

  • VPCs (same or different accounts)
  • VPN connections
  • AWS Direct Connect gateways
  • Transit Gateway peering (cross-region)

Architecture

┌─────────────────────────────────────────────────────────┐│TRANSITGATEWAY││││┌─────────────────────────────────────────────────┐│││RouteTables││││┌─────────────┐┌─────────────┐│││││DefaultRT││ProdRT│││││└─────────────┘└─────────────┘│││└─────────────────────────────────────────────────┘││││┌─────────────────────────────────────────────────┐│││Attachments││││┌─────┐┌─────┐┌─────┐┌─────┐┌─────┐│││││VPC1││VPC2││VPC3││VPN││DX│││││└─────┘└─────┘└─────┘└─────┘└─────┘│││└─────────────────────────────────────────────────┘│└─────────────────────────────────────────────────────────┘

2. Attachments

Types of Attachments

┌─────────────────────────────────────────────────────────┐│ATTACHMENTTYPES││││1.VPCAttachment││-ConnectVPCtoTransitGateway││-CreatesENIinspecifiedsubnets││-OneattachmentperVPC││││2.VPNAttachment││-Site-to-SiteVPNconnection││-Upto1.25Gbpspertunnel││-ECMPforhigherbandwidth││││3.DirectConnectGatewayAttachment││-ConnecttoDirectConnect││-TransitVIFrequired││││4.TransitGatewayPeeringAttachment││-ConnectTransitGatewayscross-region││-Staticroutingonly││││5.ConnectAttachment(GRE/SD-WAN)││-Third-partyappliances││-Upto5GbpsperConnectpeer│└─────────────────────────────────────────────────────────┘

VPC Attachment Details

┌─────────────────────────────────────────────────────────┐│VPC││││┌──────────────────┐┌──────────────────┐│││SubnetAZ-a││SubnetAZ-b││││││││││┌────────────┐││┌────────────┐│││││TGWENI││││TGWENI││││││10.0.1.10││││10.0.2.10│││││└────────────┘││└────────────┘│││└──────────────────┘└──────────────────┘││││VPCRouteTable:││┌────────────────────────────────────────────────┐│││0.0.0.0/0→tgw-xxxxx(TransitGateway)│││└────────────────────────────────────────────────┘│└─────────────────────────────────────────────────────────┘BestPractice:CreateTGWattachmentsubnetineachAZ

3. Route Tables

Default vs Custom Route Tables

TransitGatewayRouteTables:┌─────────────────────────────────────────────────────────┐│DefaultRouteTable(Auto-created)││││-Allattachmentsassociatedbydefault││-Allattachmentspropagateroutesbydefault││-Fullmeshconnectivity││││Routes:││┌────────────────┬────────────────────────────┐│││CIDR│Attachment│││├────────────────┼────────────────────────────┤│││10.0.0.0/16│vpc-prod(propagated)││││10.1.0.0/16│vpc-dev(propagated)││││192.168.0.0/16│vpn-onprem(propagated)│││└────────────────┴────────────────────────────┘│└─────────────────────────────────────────────────────────┘┌─────────────────────────────────────────────────────────┐│CustomRouteTable(Segmentation)││││-Manuallycreateandconfigure││-Choosewhichattachmentsassociate││-Choosewhichroutespropagate││-Enablenetworkisolation│└─────────────────────────────────────────────────────────┘

Route Types

TypeDescription
StaticManually added, highest priority
PropagatedAutomatically learned from attachments
BlackholeDrop traffic matching this route

4. Network Segmentation

Isolation Pattern

Requirement:ProductioncannottalktoDevelopment┌─────────────────────────────────────────────────────────┐│TransitGateway││││┌─────────────────────┐┌─────────────────────┐│││ProdRouteTable││DevRouteTable││││││││││Associated:││Associated:││││-VPC-Prod││-VPC-Dev││││-VPC-Shared││-VPC-Shared││││││││││Propagations:││Propagations:││││-VPC-Prod││-VPC-Dev││││-VPC-Shared││-VPC-Shared││││(NOTVPC-Dev)││(NOTVPC-Prod)│││└─────────────────────┘└─────────────────────┘││││Attachments:││┌─────────┐┌─────────┐┌─────────────────────┐│││VPC-Prod││VPC-Dev││VPC-Shared││││Associate││Associate││AssociatetoBOTH││││toProd││toDev││routetables│││└─────────┘└─────────┘└─────────────────────┘│└─────────────────────────────────────────────────────────┘Result:-Prod↔Shared:✓-Dev↔Shared:✓-Prod↔Dev:✗(isolated)

Shared Services Pattern

┌─────────────────────────────────────────────────────────┐│SharedServicesVPC││││┌──────────────────────────────────────────────────┐│││-ActiveDirectory││││-CI/CDtools││││-Monitoring││││-DNS(Route53Resolver)│││└──────────────────────────────────────────────────┘│││││TGWAttachment│└───────────────────────────┼─────────────────────────────┘│┌───────────┴───────────┐│TransitGateway│└───────────┬───────────┘│┌──────────────────────┼──────────────────────┐▼▼▼┌─────────┐┌─────────┐┌─────────┐│Prod││Dev││Test││VPCs││VPCs││VPCs│└─────────┘└─────────┘└─────────┘

5. Hybrid Connectivity

VPN with Transit Gateway

┌─────────────────────────────────────────────────────────┐│On-PremisesDataCenter││││┌─────────────────────────────────────────────────┐│││CustomerGateway││││(192.168.1.1)│││└─────────────────────────────────────────────────┘││││└───────────────────────────┼─────────────────────────────┘│IPsecVPNTunnels(2tunnelsforHA)│┌───────────────────────────┼─────────────────────────────┐│TransitGateway││││┌─────────────────────────────────────────────────┐│││VPNAttachment││││(Site-to-SiteVPN)│││└─────────────────────────────────────────────────┘│││││RoutingtoallconnectedVPCs│└─────────────────────────────────────────────────────────┘

ECMP for Higher VPN Bandwidth

WithoutECMP:1.25Gbps(singletunnel)WithECMP(Equal-CostMulti-Path):┌──────────────────────────┐│On-PremisesRouter│└────────────┬─────────────┘│┌────────┴────────┐││┌───┴────┐┌────┴───┐│VPN1││VPN2││1.25Gbps││1.25Gbps│└───┬────┘└────┬───┘││└────────┬────────┘│┌────────────┴───────────┐│TransitGateway││ECMP:2.5Gbps│└────────────────────────┘Canscaleupto50GbpswithmultipleVPNs

6. Transit Gateway Peering

Cross-Region Peering

┌─────────────────────────────────────────────────────────┐│Region:ap-southeast-1││││┌───────────────────────────────────────────────────┐│││TransitGatewayA││││││││┌────────┐┌────────┐┌────────┐│││││VPC1││VPC2││VPC3│││││└────────┘└────────┘└────────┘│││└───────────────────────────────────────────────────┘││││└───────────────────────────┼─────────────────────────────┘│TransitGatewayPeering(Cross-Region)│┌───────────────────────────┼─────────────────────────────┐│Region:us-east-1│││││┌───────────────────────────────────────────────────┐│││TransitGatewayB││││││││┌────────┐┌────────┐┌────────┐│││││VPC4││VPC5││VPC6│││││└────────┘└────────┘└────────┘│││└───────────────────────────────────────────────────┘│└─────────────────────────────────────────────────────────┘Note:Staticroutesonly(noBGPpropagationacrosspeering)

7. Costs

Pricing Model

ComponentCost (varies by region)
Attachment~$0.05/hour
Data processed~$0.02/GB
VPN AttachmentStandard VPN pricing
Peering dataStandard data transfer

Cost Optimization

1. Consolidate VPCs where possible
   - Fewer attachments = lower cost

2. Use VPC Peering for high-bandwidth pairs
   - No per-GB charge

3. Monitor data transfer
   - CloudWatch metrics for TGW

Part 3: AWS Direct Connect

1. Direct Connect Overview

Definition

AWS Direct Connect is a dedicated network connection from on-premises to AWS that provides:

  • Lower latency than the internet
  • Consistent network performance
  • Reduced bandwidth costs (for high volume)
  • Private connectivity

Connection Types

┌─────────────────────────────────────────────────────────┐│DIRECTCONNECTOPTIONS││││1.DedicatedConnection││├──1Gbps││├──10Gbps││├──100Gbps││└──400Gbps(launched2024)││PhysicalportatAWSDirectConnectlocation││MACsec:10/100/400Gbpsdedicated││││2.HostedConnection││├──50Mbpsto10Gbps││ViaAWSPartner(APN)││Fasterprovisioning(daysvsweeks)││││3.HostedVirtualInterface(VIF)││Shareapartner'sconnection││Nophysicalportownership│└─────────────────────────────────────────────────────────┘

2. Architecture

Physical Architecture

┌─────────────────────────────────────────────────────────┐│YourDataCenter││││┌─────────────────────────────────────────────────┐│││YourRouter/Network│││└───────────────────────┬─────────────────────────┘│││││CrossConnect(Fiber)││tocolocationfacility│└──────────────────────────┼──────────────────────────────┘│┌──────────────────────────┼──────────────────────────────┐│AWSDirectConnectLocation(ColocationFacility)│││││┌─────────────┐┌─────┴─────┐│││YourCage│───│AWSCage││││(Partner)│││││└─────────────┘└───────────┘│││││AWSBackboneNetwork│└──────────────────────────┼──────────────────────────────┘│┌──────┴──────┐│AWS││Regions│└─────────────┘

Logical Architecture

┌─────────────────────────────────────────────────────────┐│DirectConnect││││PhysicalConnection:dxcon-xxxxx│││││┌──────────────────┼──────────────────┐│││││││▼▼▼││┌─────────┐┌─────────┐┌─────────┐│││Private││Public││Transit││││VIF││VIF││VIF│││└────┬────┘└────┬────┘└────┬────┘│││││││▼▼▼││┌─────────┐┌─────────┐┌─────────┐│││Virtual││AWS││Transit││││Private││Public││Gateway││││Gateway││Services│││││└────┬────┘└─────────┘└────┬────┘││││││▼▼││┌──────────┐┌─────────┐│││VPCs││Multiple││││(1region)││VPCs│││└──────────┘└─────────┘│└─────────────────────────────────────────────────────────┘

3. Virtual Interfaces (VIFs)

Private VIF

Purpose:AccessVPCsviaVirtualPrivateGateway┌────────────────┐┌────────────────────────┐│On-Premises││VPC││││││Network:│Private│┌────────────────┐││192.168.0.0/16│──VIF────►││VirtualPrivate││││││Gateway││└────────────────┘│└────────────────┘││││Accessto:││-EC2instances││-RDSdatabases││-Privateresources│└────────────────────────┘Limitations:-SingleVGW=SingleVPC-Max50private/publicVIFsperdedicatedconnection-DXGatewayassociatesupto20VGWs(or6TGWs)→useDXGateway/TransitVIFtoscaletomanyVPCs-PrivateVIF+VGWdirectly:sameregiononly(DXGatewayallowscross-region)

Public VIF

Purpose:AccessAWSpublicservices(S3,DynamoDB,etc.)┌────────────────┐┌────────────────────────┐│On-Premises││AWSPublicServices││││││Network:│Public│-S3││192.168.0.0/16│──VIF────►│-DynamoDB││││-SQS││+PublicIPs││-SNS││forBGP││-EC2publicIPs│└────────────────┘└────────────────────────┘Requirements:-PublicASN(orAWS-provided)-PublicIPprefixesyouown-Canaccessservicesinanyregion

Transit VIF

Purpose:ConnecttoTransitGateway(multipleVPCs)┌────────────────┐┌────────────────────────┐│On-Premises││DirectConnect││││Gateway││Network:│Transit││││192.168.0.0/16│──VIF────►││││││▼│└────────────────┘│┌────────────────┐│││TransitGateway│││└───────┬────────┘│││││┌──────┴──────┐││▼▼▼││VPC1VPC2VPC3│└────────────────────────┘Benefits:-SingleVIFformultipleVPCs-Cross-regionaccess(viaTGWpeering)-Betterscalability

4. Direct Connect Gateway

Purpose

Connect Direct Connect to multiple VPCs across regions

┌────────────────┐│On-Premises││││┌──────────┐│││Router│││└────┬─────┘│└───────┼────────┘│PrivateVIF│▼┌─────────────────────────────────────────────────────────┐│DirectConnectGateway││(Globalresource)││││┌──────────────────┬──────────────────┐││▼▼▼││┌──────────┐┌──────────┐┌──────────┐│││VGW││VGW││VGW││││us-east-1││eu-west-1││ap-se-1│││└────┬─────┘└────┬─────┘└────┬─────┘│││││││▼▼▼││VPCUSVPCEUVPCAsia│└─────────────────────────────────────────────────────────┘Benefits:-SingleDXconnectiontomultipleregions-NoneedformultipleVIFsperregion-Simplifiedmanagement

5. High Availability Design

Single Location (Low Resilience)

┌────────────────┐┌─────────────────┐│On-Premises│────►│DXLocation1││││││Single││Single││Connection││Connection│└────────────────┘└─────────────────┘Risk:Singlepointoffailure

Dual Connections (Medium Resilience)

┌────────────────┐┌─────────────────┐│On-Premises│════►│DXLocation1││││││Two││Connection1││Connections││Connection2│└────────────────┘└─────────────────┘Risk:Locationfailureaffectsboth
┌────────────────┐│On-Premises││││┌──────────┐│││Router1│──┼──────────►DXLocation1│└──────────┘│(Connection1)│││┌──────────┐│││Router2│──┼──────────►DXLocation2│└──────────┘│(Connection2)└────────────────┘Benefits:-Surviveslocationfailure-Survivesrouterfailure-Maintenancewithoutdowntime

Maximum Resilience

┌────────────────┐┌─────────────────┐│On-Premises││DXLocation1││DataCenter1│════►│Connection1a││││Connection1b│└────────────────┘└─────────────────┘┌────────────────┐┌─────────────────┐│On-Premises││DXLocation2││DataCenter2│════►│Connection2a││││Connection2b│└────────────────┘└─────────────────┘4connectionsacross2locationsand2datacenters

6. Backup with VPN

Direct Connect + VPN Backup

┌─────────────────────────────────────────────────────────┐│RoutingPriority││││1.DirectConnect(Primary)││-Lowerlatency││-Higherbandwidth││-BGPASpathshorter││││2.Site-to-SiteVPN(Backup)││-Viainternet││-ActivateswhenDXfails││-BGPASpathprepending(longerpath)│└─────────────────────────────────────────────────────────┘Configuration:-UsesameBGPASNforboth-ASpathprependingonVPN-BFDforfastfailoverdetection

Purpose

Bundle multiple physical connections for:

  • Higher bandwidth
  • Active-Active load balancing
┌─────────────────────────────────────────────────────────┐│LinkAggregationGroup(LAG)││││┌─────────────────────────────────────────────────┐│││PhysicalConnections││││││││┌──────────┐┌──────────┐┌──────────┐│││││10Gbps││10Gbps││10Gbps││││││Port││Port││Port│││││└────┬─────┘└────┬─────┘└────┬─────┘│││││││││││└─────────────┼─────────────┘│││││││││LAG:30Gbps│││└─────────────────────────────────────────────────┘│└─────────────────────────────────────────────────────────┘Requirements:-Samebandwidthperconnection-SameDXlocation-Max4connectionsperLAG-Terminateonsamedevice

Definition

SiteLink is a feature enabled on a Virtual Interface attached to a Direct Connect Gateway. It lets traffic flow directly between Direct Connect locations (on-premises site ↔ on-premises site) over the AWS global backbone, WITHOUT detouring through any Region or VPC.

┌─────────────────────────────────────────────────────────┐│SiteLink││││┌──────────────┐┌──────────────┐│││DCNewYork││DCLondon││││(On-premises)││(On-premises)│││└──────┬───────┘└──────┬───────┘││││││▼▼││┌──────────────┐┌──────────────┐│││DXLocation││DXLocation││││(NewYork)││(London)││││VIFSiteLink││VIFSiteLink││││enabled││enabled│││└──────┬───────┘└──────┬───────┘││││││└────────►AWSGlobal◄─────────────┘││Backbone││││Traffic:NY↔LondonDIRECTLY││DoesNOTtraverseanyRegion/VPC│└─────────────────────────────────────────────────────────┘

How it works

  • Enable SiteLink on each VIF (private or transit VIF) attached to the DX Gateway
  • VIFs on the same DX Gateway with SiteLink enabled can route to each other: BGP routes learned from one site are advertised to the other site through the DX Gateway
  • Traffic takes the shortest path on the AWS backbone between the 2 DX locations, with no hairpin through a Region
  • You can create multiple DX Gateways to separate routing between groups of sites (segmentation)

Use cases

  • Replace a private WAN/MPLS between data centers at different DX locations, even across countries/continents, using the AWS global backbone instead of leasing dedicated circuits
  • Site-to-site connectivity when the DCs already have Direct Connect: no need to build extra MPLS/leased lines
  • Combined: the same VIF can both access VPCs (via DX Gateway) and talk site-to-site (SiteLink)

Pricing

  • Billed separately: per hour for each SiteLink-enabled VIF + data transfer between DX locations
  • Exam trade-off: SiteLink costs more than regular DX traffic, but is much cheaper and faster than building/maintaining a global MPLS WAN yourself

Exam Keywords

Keyword in the questionAnswer
"Connect data centers to each other using Direct Connect"SiteLink
"Avoid MPLS/private WAN between sites", "retire MPLS circuits"SiteLink
"Site-to-site traffic without traversing a Region/VPC"SiteLink
"Data centers in multiple countries need to connect, DX already in place"SiteLink on DX Gateway

Review Questions

  1. How do Gateway Endpoints and Interface Endpoints differ?

    Show answer

    Gateway Endpoint: S3 and DynamoDB only, free, added to the route table, no ENI created. Interface Endpoint: most AWS services, paid (~$0.01/hour/AZ + $0.01/GB), creates an ENI with a private IP in the subnet, supports Private DNS. Interface Endpoints use PrivateLink and can be used for custom services (via NLB). A Gateway Endpoint is simple and free for S3/DynamoDB; an Interface Endpoint is for other services that need private access.

  2. Does VPC Peering support transitive routing?

    Show answer

    No. VPC Peering has no transitive routing. If A-B are peered and B-C are peered, A cannot reach C through B. You must create a direct A-C peering. With many VPCs (N VPCs), you need N×(N-1)/2 peering connections, which does not scale. Transit Gateway solves this: hub-and-spoke, transitive routing, N connections instead of N² connections.

  3. When should you use VPC Peering vs Transit Gateway?

    Show answer

    VPC Peering when: 2-4 VPCs need to connect, no transitive routing is needed, you want to reduce cost (peering is free, TGW charges attachment + processing), and you do not need centralized routing control. Transit Gateway when: more than 5 VPCs, transitive routing is needed, you need a centralized network hub (VPN + DX + VPCs from one point), you need cross-region (TGW peering), or you need network segmentation with separate route tables.

  4. What is a Route 53 Resolver Inbound endpoint used for?

    Show answer

    An Inbound Endpoint lets on-premises DNS servers forward queries to Route 53 Resolver to resolve AWS private hosted zones and VPC internal hostnames. On-premises DNS forwards requests to the Inbound Endpoint IPs (in the VPC) over Direct Connect or VPN. Conversely, an Outbound Endpoint lets EC2 instances in the VPC forward DNS queries out to on-premises DNS servers.

  5. Why do you need to plan CIDR ranges carefully?

    Show answer

    Overlapping CIDRs make it impossible to peer VPCs (VPC Peering does not work with overlapping CIDRs). With Transit Gateway, overlapping CIDRs cause routing ambiguity. Multi-account environments need non-overlapping CIDRs across all VPCs/accounts. AWS IPAM helps centralize CIDR management. Plan from the start: assign CIDR ranges per account/Region (for example: 10.0.0.0/8 for the whole org, split into /12 per region, /16 per account).

  6. What are the Transit Gateway attachment types?

    Show answer

    VPC attachment, VPN attachment (Site-to-Site VPN), Direct Connect Gateway attachment, Transit Gateway Peering (cross-region), Connect attachment (SD-WAN via GRE tunnel), Peering attachment (cross-account TGW peering). Each attachment can be associated with its own route table in the TGW to control routing. All connections route through the TGW, with no need for direct connections between them.

  7. How do you isolate Prod and Dev traffic?

    Show answer

    Multiple route tables in the TGW: create a "Prod route table" and a "Dev route table". Prod VPC attachments associate with the Prod route table; Dev VPC attachments associate with the Dev route table. The Prod route table has no routes to Dev VPCs → Prod cannot reach Dev. The Dev route table can include Shared Services routes (logging, CI/CD) but no Prod routes. Elegant network segmentation without needing a separate TGW.

  8. How does ECMP help VPN bandwidth?

    Show answer

    Equal-Cost Multi-Path routing with TGW lets you load balance traffic across multiple VPN tunnels or connections simultaneously. Each Site-to-Site VPN has 2 tunnels, each tunnel ~1.25 Gbps. With ECMP on TGW: multiple VPN connections on the same path → aggregate bandwidth. Example: 4 VPN connections × 2 tunnels × 1.25 Gbps = ~10 Gbps effective bandwidth. ECMP requires BGP with route propagation to work.

  9. Does Transit Gateway Peering support BGP?

    Show answer

    No. TGW Peering (cross-region TGW to TGW) uses static routes, not BGP. You must manually add static routes for cross-region prefixes in the TGW route tables. This differs from VPN attachments and DX attachments (which support BGP). TGW Peering is a Layer 3 connection with the bandwidth limits and latency of cross-region connectivity. It suits global architectures that need inter-region connectivity.

  10. How is Transit Gateway priced?

Show answer

Two components: (1) Attachment fee ($0.05/hour per attachment): each VPC, VPN, DX connection attached to the TGW is billed hourly, (2) Data processing fee ($0.02/GB): each GB that passes through the TGW. Compare with VPC Peering: no attachment fee, no processing fee, only cross-AZ data transfer. TGW is more expensive but scalable. Cost planning: with 20 VPCs: 20 × $0.05 × 730h ≈ $730/month in attachment fees alone.

  1. How do Private VIF, Public VIF, and Transit VIF differ?
Show answer

Private VIF: connects to a specific VPC via a Virtual Private Gateway, accessing the private IP space in the VPC. Public VIF: connects to AWS public endpoints (S3, EC2 public IPs, CloudFront origins); traffic goes over DX but to public IP space. Transit VIF: connects to a Transit Gateway; one VIF serves many VPCs. A Transit VIF requires a DX Gateway. Choose: Private VIF for 1 VPC, Transit VIF for many VPCs, Public VIF for S3/public services.

  1. What is a Direct Connect Gateway used for?
Show answer

A DX Gateway lets 1 DX connection access many VPCs across multiple Regions and accounts. Without a DX Gateway: 1 Private VIF connects to only 1 VPC. With a DX Gateway: 1 Private VIF → DX Gateway → many VGWs (Virtual Private Gateways) in different VPCs. It is also used with Transit Gateway (Transit VIF → DX Gateway → TGW). A DX Gateway is a global resource and does not belong to any Region.

  1. What should a High Availability design include?
Show answer

(1) Redundant DX connections from two different DX locations (not the same physical facility), (2) Redundant customer routers (not a single router), (3) Diverse cross-connects in the DX location, (4) VPN backup in case all DX fails (VPN over the internet with automatic failover), (5) BGP failover configured correctly (DX route preference higher than VPN). Maximum HA: 2 DX locations × 2 connections/location + VPN backup.

  1. What is a Link Aggregation Group (LAG)?
Show answer

A LAG bundles multiple DX connections into one logical connection using LACP (Link Aggregation Control Protocol). Example: 4 × 1 Gbps connections in a LAG = a 4 Gbps logical link. Benefits: aggregate bandwidth, active-active (load balance) or active-standby redundancy, a single management point. All connections in a LAG must have the same speed, the same DX location, and the same port type (dedicated). Maximum 4 connections per LAG.

  1. Why do you need a VPN backup for Direct Connect?
Show answer

DX has an SLA, but the SLA level depends on the architecture: 99.99% only with Maximum Resiliency (≥2 locations, ≥2 connections per location), 99.9% with High Resiliency (2 locations, 1 connection/location), while a single connection gets only 95%: one cut fiber or DX location maintenance and you lose connectivity. So with a single DX connection, you need a VPN backup over the internet (or a second DX connection) to keep connectivity when DX fails. BGP config: DX routes have higher preference (lower MED/higher local preference) → DX is used when available; when DX fails, BGP converges and traffic reroutes over VPN automatically. VPN bandwidth is lower than DX but enough for failover.

  1. A company has data centers in New York and London, each already with Direct Connect. They want to drop the MPLS circuit between the 2 DCs. What is the solution?
Show answer

Use Direct Connect SiteLink: enable SiteLink on the VIFs (attached to the same DX Gateway) at both DX locations → New York ↔ London traffic flows directly over the AWS global backbone, without going through any Region/VPC and without MPLS. Cost: per hour for each SiteLink-enabled VIF + data transfer between the 2 DX locations, usually cheaper than maintaining a cross-country MPLS WAN. Keyword: "connect data centers to each other using Direct Connect", "avoid/retire MPLS between sites" → SiteLink.

Hands-on Exercises

Part 1: VPC Advanced Concepts

  • Create S3 Gateway Endpoint
  • Create Interface Endpoint for Secrets Manager
  • Setup VPC Peering between 2 VPCs
  • Configure Route 53 Private Hosted Zone

Part 2: Transit Gateway Deep Dive

  • Create Transit Gateway
  • Attach 2 VPCs
  • Configure route tables for segmentation
  • Setup VPN attachment (optional)

Part 3: AWS Direct Connect

  • Study Direct Connect location map
  • Design an HA architecture for on-premises
  • Calculate bandwidth requirements
  • Review pricing calculator

References


Next lesson →