devHọc Dev
EN
Bài học

Tuần 2 - Ngày 3: VPC nâng cao, Transit Gateway và Direct Connect

Tuần 2 – Ngày 3

Bài này gộp 3 chủ đề: VPC Advanced Concepts, Transit Gateway Deep Dive, AWS Direct Connect.

Mục tiêu học tập

  • Hiểu sâu về VPC Endpoints
  • Nắm vững VPC Peering và limitations
  • Biết cách thiết kế multi-VPC architectures
  • Hiểu kiến trúc và components của Transit Gateway
  • Nắm vững routing concepts và route tables
  • Biết cách implement network segmentation
  • Hiểu kiến trúc và components của Direct Connect
  • Nắm vững Virtual Interfaces (VIFs)
  • Biết cách design for high availability

Phần 1: VPC Advanced Concepts

1. VPC Endpoints

Types of VPC Endpoints

┌─────────────────────────────────────────────────────────┐│VPCENDPOINTS││││┌─────────────────────────────────────────────────┐│││GatewayEndpoints(Free)││││││││SupportedServices:││││-S3││││-DynamoDB││││││││Howitworks:││││-Entryinroutetable││││-TrafficstayswithinAWSnetwork││││-ChỉaccesstừresourceTRONGVPC││││-KHÔNGaccessđượctừon-premises││││(DirectConnect/VPN)│││└─────────────────────────────────────────────────┘││││┌─────────────────────────────────────────────────┐│││InterfaceEndpoints(Paid)││││││││SupportedServices:││││-MostAWSservices(100+)││││-AWSPrivateLinkservices││││-DynamoDB(quaPrivateLink,GA2023)││││-S3(PrivateLink,dùngchoon-premaccess)││││││││Howitworks:││││-ENIinyoursubnet││││-PrivateIPaddress││││-DNSresolutiontoprivateIP││││-Accessđượctừon-premisesquaDX/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 hỗ trợ cả hai loại endpoint — biết lựa chọn nào cho SAP-C02 scenario là quan trọng.

Tiêu chíDynamoDB Gateway EndpointDynamoDB Interface Endpoint (PrivateLink)
PricingMiễn phí$0.01/giờ/AZ + data processing
Access từ trong VPC✓✓
Access từ on-premises (DX/VPN)✗ Không hỗ trợ✓ Có
Cross-region access✗✓ (qua VPC peering / TGW)
SetupAdd route vào route tableTạo ENI trong subnet
DNS resolutionPublic DNS → private routePrivate DNS name
Use case mặc địnhMọi traffic trong VPCHybrid: on-prem cần truy cập 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

Lưu ý: S3 cũng có cả hai loại endpoint với pattern tương tự (S3 Interface Endpoint GA 2021 cho hybrid use case).

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

Phần 2: Transit Gateway Deep Dive

1. Transit Gateway Overview

Định nghĩa

AWS Transit Gateway là regional network transit hub cho phép kết nối:

  • 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

Phần 3: AWS Direct Connect

1. Direct Connect Overview

Định nghĩa

AWS Direct Connect là dedicated network connection từ on-premises đến AWS, cung cấp:

  • Lower latency so với internet
  • Consistent network performance
  • Reduced bandwidth costs (for high volume)
  • Private connectivity

Connection Types

┌─────────────────────────────────────────────────────────┐│DIRECTCONNECTOPTIONS││││1.DedicatedConnection││├──1Gbps││├──10Gbps││├──100Gbps││└──400Gbps(ramắt2024)││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-DXGatewayassociatetốiđa20VGWs(hoặc6TGWs)→dùngDXGateway/TransitVIFđểscalenhiềuVPC-PrivateVIF+VGWtrựctiếp:sameregiononly(DXGatewaythìcross-regionđược)

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 với 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

Định nghĩa

SiteLink là tính năng bật trên Virtual Interface gắn với Direct Connect Gateway, cho phép traffic đi trực tiếp giữa các Direct Connect locations (on-premises site ↔ on-premises site) qua AWS global backbone — KHÔNG cần đi vòng qua Region hay VPC nào.

┌─────────────────────────────────────────────────────────┐│SiteLink││││┌──────────────┐┌──────────────┐│││DCNewYork││DCLondon││││(On-premises)││(On-premises)│││└──────┬───────┘└──────┬───────┘││││││▼▼││┌──────────────┐┌──────────────┐│││DXLocation││DXLocation││││(NewYork)││(London)││││VIFSiteLink││VIFSiteLink││││enabled││enabled│││└──────┬───────┘└──────┬───────┘││││││└────────►AWSGlobal◄─────────────┘││Backbone││││Traffic:NY↔LondonTRỰCTIẾP││KHÔNGđiquaRegion/VPCnào│└─────────────────────────────────────────────────────────┘

Cách hoạt động

  • Bật SiteLink trên từng VIF (private hoặc transit VIF) attach vào DX Gateway
  • Các VIF cùng một DX Gateway có SiteLink enabled sẽ route được với nhau: BGP routes học từ site này được advertise sang site kia qua DX Gateway
  • Traffic đi đường ngắn nhất trên AWS backbone giữa 2 DX locations — không hairpin qua Region
  • Có thể tạo nhiều DX Gateways để phân tách routing giữa các nhóm sites (segmentation)

Use case

  • Thay thế private WAN/MPLS giữa các data centers ở các DX locations khác nhau — kể cả khác quốc gia/châu lục — tận dụng AWS global backbone thay vì thuê circuit riêng
  • Site-to-site connectivity khi các DC đã có sẵn Direct Connect: không cần dựng thêm MPLS/leased line
  • Kết hợp: cùng một VIF vừa access VPC (qua DX Gateway) vừa nói chuyện site-to-site (SiteLink)

Pricing

  • Tính phí riêng: per-hour cho mỗi VIF bật SiteLink + data transfer giữa các DX locations
  • Trade-off exam: SiteLink đắt hơn traffic DX thường, nhưng rẻ và nhanh hơn nhiều so với tự dựng/duy trì MPLS WAN toàn cầu

Exam Keywords

Keyword trong đềĐáp án
"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 ở nhiều quốc gia cần kết nối, đã có DX"SiteLink trên DX Gateway

Câu hỏi ôn tập

  1. Gateway Endpoint và Interface Endpoint khác nhau như thế nào?

    Xem đáp án

    Gateway Endpoint: chỉ S3 và DynamoDB, miễn phí, được add vào route table, không tạo ENI. Interface Endpoint: hầu hết AWS services, có phí (~$0.01/giờ/AZ + $0.01/GB), tạo ENI với Private IP trong subnet, hỗ trợ Private DNS. Interface Endpoint dùng PrivateLink — có thể dùng cho custom services (qua NLB). Gateway Endpoint đơn giản và miễn phí cho S3/DynamoDB; Interface Endpoint cho other services cần private access.

  2. VPC Peering có hỗ trợ transitive routing không?

    Xem đáp án

    Không — VPC Peering không có transitive routing. Nếu A-B peer và B-C peer: A không thể reach C qua B. Phải tạo direct A-C peering. Với nhiều VPCs (N VPCs), cần N×(N-1)/2 peering connections — không scalable. Transit Gateway giải quyết: hub-and-spoke, transitive routing, N connections thay vì N² connections.

  3. Khi nào nên dùng VPC Peering vs Transit Gateway?

    Xem đáp án

    VPC Peering khi: 2-4 VPCs cần kết nối, không cần transitive routing, muốn giảm cost (peering miễn phí, TGW có phí attachment + processing), không cần centralized routing control. Transit Gateway khi: nhiều hơn 5 VPCs, cần transitive routing, cần centralized network hub (VPN + DX + VPCs từ 1 điểm), cần cross-region (TGW peering), cần network segmentation với route tables riêng.

  4. Route 53 Resolver Inbound endpoint dùng để làm gì?

    Xem đáp án

    Inbound Endpoint cho phép on-premises DNS servers forward queries đến Route 53 Resolver để resolve AWS private hosted zones và VPC internal hostnames. On-premises DNS forward requests đến Inbound Endpoint IPs (trong VPC) qua Direct Connect hoặc VPN. Ngược lại, Outbound Endpoint cho phép VPC EC2 instances forward DNS queries ra on-premises DNS servers.

  5. Tại sao cần plan CIDR ranges carefully?

    Xem đáp án

    Overlapping CIDRs gây không thể peering VPCs (VPC Peering không hoạt động với overlapping CIDRs). Với Transit Gateway, overlapping CIDRs gây routing ambiguity. Multi-account environments cần non-overlapping CIDRs across tất cả VPCs/accounts. AWS IPAM giúp centralize CIDR management. Planning từ đầu: assign CIDR ranges per account/Region (ví dụ: 10.0.0.0/8 cho toàn org, chia /12 per region, /16 per account).

  6. Transit Gateway attachment types là gì?

    Xem đáp án

    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). Mỗi attachment có thể associate với route table riêng trong TGW để control routing. Tất cả các kết nối đều route qua TGW — không cần direct connections between them.

  7. Làm sao để isolate Prod và Dev traffic?

    Xem đáp án

    Multiple route tables trong TGW: tạo "Prod route table" và "Dev route table". Prod VPC attachments associate với Prod route table; Dev VPC attachments associate với Dev route table. Prod route table không có routes đến Dev VPCs → Prod không thể reach Dev. Dev route table có thể include Shared Services routes (logging, CI/CD) nhưng không Prod routes. Elegant network segmentation mà không cần separate TGW.

  8. ECMP giúp gì cho VPN bandwidth?

    Xem đáp án

    Equal-Cost Multi-Path routing với TGW cho phép load balance traffic qua nhiều VPN tunnels hoặc connections đồng thời. Mỗi Site-to-Site VPN có 2 tunnels, mỗi tunnel ~1.25 Gbps. Với ECMP trên TGW: multiple VPN connections cùng tuyến → aggregate bandwidth. Ví dụ: 4 VPN connections × 2 tunnels × 1.25 Gbps = ~10 Gbps effective bandwidth. Cần BGP với route propagation để ECMP hoạt động.

  9. Transit Gateway Peering có hỗ trợ BGP không?

    Xem đáp án

    Không — TGW Peering (cross-region TGW to TGW) dùng static routes, không BGP. Cần manually add static routes cho cross-region prefixes trong TGW route tables. Khác với VPN attachments và DX attachments (hỗ trợ BGP). TGW Peering là Layer 3 connection — có bandwidth limits và latency của cross-region connectivity. Phù hợp cho global architectures cần inter-region connectivity.

  10. Chi phí Transit Gateway tính như thế nào?

Xem đáp án

Hai thành phần: (1) Attachment fee ($0.05/giờ per attachment) — mỗi VPC, VPN, DX connection gắn vào TGW tính phí theo giờ, (2) Data processing fee ($0.02/GB) — mỗi GB đi qua TGW. So sánh VPC Peering: không có attachment fee, không có processing fee — chỉ cross-AZ data transfer. TGW đắt hơn nhưng scalable. Plan cost: với 20 VPCs: 20 × $0.05 × 730h ≈ $730/tháng chỉ attachment fees.

  1. Private VIF, Public VIF, Transit VIF khác nhau như thế nào?
Xem đáp án

Private VIF: connect đến một VPC cụ thể qua Virtual Private Gateway — access private IP space trong VPC. Public VIF: connect đến AWS public endpoints (S3, EC2 public IPs, CloudFront origins) — traffic qua DX nhưng đến public IP space. Transit VIF: connect đến Transit Gateway — một VIF serve nhiều VPCs. Transit VIF cần DX Gateway. Chọn: Private VIF cho 1 VPC, Transit VIF cho nhiều VPCs, Public VIF cho S3/public services.

  1. Direct Connect Gateway dùng để làm gì?
Xem đáp án

DX Gateway cho phép 1 DX connection access nhiều VPCs trong nhiều Regions và accounts. Không có DX Gateway: 1 Private VIF chỉ connect 1 VPC. Với DX Gateway: 1 Private VIF → DX Gateway → nhiều VGWs (Virtual Private Gateways) trong các VPCs khác nhau. Cũng dùng với Transit Gateway (Transit VIF → DX Gateway → TGW). DX Gateway là global resource — không thuộc Region nào.

  1. High Availability design nên có gì?
Xem đáp án

(1) Redundant DX connections từ hai DX locations khác nhau (không cùng physical facility), (2) Redundant routers của customer (không single router), (3) Diverse cross-connects trong DX location, (4) VPN backup khi cả DX fail (VPN qua internet với automatic failover), (5) BGP failover configured đúng (DX route preference cao hơn VPN). Maximum HA: 2 DX locations × 2 connections/location + VPN backup.

  1. Link Aggregation Group (LAG) là gì?
Xem đáp án

LAG gộp nhiều DX connections vào một logical connection sử dụng LACP (Link Aggregation Control Protocol). Ví dụ: 4 × 1 Gbps connections trong LAG = 4 Gbps logical link. Lợi ích: aggregate bandwidth, active-active (load balance) hoặc active-standby redundancy, single management point. Tất cả connections trong LAG phải cùng tốc độ, cùng DX location, cùng port (dedicated). Tối đa 4 connections per LAG.

  1. Tại sao cần VPN backup cho Direct Connect?
Xem đáp án

DX có SLA, nhưng mức SLA phụ thuộc kiến trúc: 99.99% chỉ khi Maximum Resiliency (≥2 location, mỗi location ≥2 connection), 99.9% với High Resiliency (2 location, 1 connection/location), còn một connection đơn lẻ chỉ 95% — một sợi fiber đứt hay DX location bảo trì là mất kết nối. Vì vậy với một DX connection, cần VPN backup qua internet (hoặc DX connection thứ hai) để đảm bảo connectivity khi DX fail. Config BGP: DX routes có higher preference (lower MED/higher local preference) → DX được dùng khi available; khi DX fail, BGP converge và traffic reroute qua VPN tự động. VPN bandwidth thấp hơn DX nhưng đủ cho failover.

  1. Công ty có data centers ở New York và London, mỗi nơi đã có Direct Connect. Họ muốn bỏ MPLS circuit giữa 2 DC. Giải pháp?
Xem đáp án

Dùng Direct Connect SiteLink: bật SiteLink trên các VIF (attach vào cùng một DX Gateway) ở cả 2 DX locations → traffic New York ↔ London đi trực tiếp qua AWS global backbone, không cần qua Region/VPC nào và không cần MPLS. Chi phí: per-hour cho mỗi VIF bật SiteLink + data transfer giữa 2 DX locations — thường rẻ hơn duy trì MPLS WAN xuyên quốc gia. Keyword: "connect data centers to each other using Direct Connect", "avoid/retire MPLS between sites" → SiteLink.

Bài tập thực hành

Phần 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

Phần 2: Transit Gateway Deep Dive

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

Phần 3: AWS Direct Connect

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

Tài liệu tham khảo


Bài tiếp theo →