Thuta Learning
AWS Advanced
Advanced NetworkingDevOpsအဆင့်မြင့်

Hybrid Connectivity: Site-to-Site VPN၊ Direct Connect နဲ့ Hybrid DNS

AWS Advancedသင်ခန်းစာ 850 မိနစ်

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Tunnel နှစ်ခုလုံးနဲ့ BGP ပါတဲ့ Site-to-Site VPN ကို virtual private gateway ဒါမှမဟုတ် Transit Gateway ပေါ်မှာ configure လုပ်တတ်ဖို့
  • Dedicated နဲ့ hosted Direct Connect ကြား ရွေးတတ်ပြီး မှန်ကန်တဲ့ virtual interface type ကို ရွေးတတ်ဖို့
  • Direct Connect redundancy နဲ့ VPN ကို backup အဖြစ်သုံးတဲ့ resilient hybrid network ကို design လုပ်တတ်ဖို့
  • Hybrid DNS အတွက် Route 53 Resolver inbound နဲ့ outbound endpoint တွေကို သုံးတတ်ဖို့

ရိုးရိုးလေး ရှင်းပြမယ်

ရိုးရိုးလေး ရှင်းပြရရင်

ကိုယ့် office ကို AWS နဲ့ ချိတ်တာက မြို့နှစ်မြို့ကို ချိတ်တာနဲ့ တူပါတယ်။ Site-to-Site VPN ဆိုတာ public အဝေးပြေးလမ်းမပေါ်က သံချပ်ကာကားတစ်စီးပါ — စီစဉ်ရမြန်ပြီး encrypt လုပ်ထားပေမဲ့ လမ်းကို လူတိုင်းနဲ့ မျှသုံးရတာမို့ အမြန်နှုန်းနဲ့ ခရီးကြာချိန် ပြောင်းလဲနေတတ်ပါတယ်။ Direct Connect ကတော့ မြို့နှစ်မြို့ကြား private ရထားလမ်းတစ်ခုပါ — ဆောက်ဖို့ ရက်သတ္တပတ်တွေ ကြာပေမဲ့ အများကြီး ပိုသယ်နိုင်ပြီး အမြန်နှုန်း တည်ငြိမ်ပါတယ်။

အလေးအနက်ထားတဲ့ ကုမ္ပဏီတွေက နှစ်ခုလုံး ထားကြပါတယ် — နေ့စဉ် traffic အတွက် ရထားလမ်းနဲ့ ရထားလမ်း ပိတ်ထားတဲ့အချိန်အတွက် standby ထားတဲ့ သံချပ်ကာကား။ နောက်ဆုံးအနေနဲ့ မြို့နှစ်မြို့လုံးမှာ မျှသုံးတဲ့ ဖုန်းစာအုပ်တစ်အုပ် လိုပါတယ်။ Route 53 Resolver endpoint တွေက ဘက်တစ်ဖက်စီက server တွေကို တစ်ဖက်မှာရှိတဲ့ name တွေကို ရှာနိုင်အောင် လုပ်ပေးပါတယ်။

Problem → Why → Solution

ပြဿနာ: tunnel တစ်ခု၊ link တစ်ခု၊ DNS မရှိ

ကုမ္ပဏီတစ်ခုက သူ့ order service ကို AWS ဆီ ရွှေ့ပေမဲ့ ERP database ကိုတော့ ကိုယ်ပိုင် data center ထဲမှာ ဆက်ထားပါတယ်။ ပထမဆုံး connection က အမြန်လုပ်ထားတဲ့ VPN တစ်ခုပါ — network engineer က tunnel တစ်ခုကို static route နဲ့ configure လုပ်ပြီး ပြီးပြီလို့ သတ်မှတ်လိုက်ပါတယ်။ တစ်လအကြာမှာ AWS က အဲဒီ tunnel endpoint ပေါ်မှာ ပုံမှန် maintenance လုပ်တော့ tunnel က မိနစ်အတော်ကြာ ကျသွားပြီး application က database ကို မရောက်နိုင်တာကြောင့် order တိုင်း fail ဖြစ်ပါတယ်။

ပြီးတော့ ဒုတိယ ပြဿနာ ပေါ်လာပါတယ် — application ကို on-premises DNS server တွေပဲ သိတဲ့ erp.corp.example.internal နဲ့ configure လုပ်ထားပါတယ်။ VPC ထဲက instance တွေက အဲဒီ domain ကို တစ်ခါမှ မကြားဖူးတဲ့ VPC resolver ကို သုံးကြတာကြောင့် engineer တွေက configuration file တွေထဲမှာ IP address တွေကို hard-code လုပ်ကြတော့တာပါပဲ။

the-fragile-setup.sh
# A single static route and (on the office router) only tunnel 1 configured
aws ec2 create-vpn-connection --type ipsec.1 \
  --customer-gateway-id cgw-0a1b2c3d4e5f67890 \
  --vpn-gateway-id vgw-0a1b2c3d4e5f67890 \
  --options StaticRoutesOnly=true
aws ec2 create-vpn-connection-route \
  --vpn-connection-id vpn-0a1b2c3d4e5f67890 \
  --destination-cidr-block 172.16.0.0/12

# From an EC2 instance in the VPC:
#   $ nslookup erp.corp.example.internal   -> NXDOMAIN

ဘာကြောင့် fail ဖြစ်တာလဲ

AWS က tunnel တွေကို တစ်ခုချင်း maintain လုပ်တာကြောင့်ပဲ VPN connection တိုင်းမှာ tunnel နှစ်ခု ပါလာတာပါ — တစ်ခုတည်းသုံးရင် plan ထားတဲ့ outage တွေ ဖြစ်မှာ သေချာပါတယ်။ Static route တွေက failure တွေကို ရှောင်ပြီး လမ်းကြောင်းမပြောင်းပေးနိုင်ဘဲ hybrid DNS မပါတဲ့ hybrid network က team တွေကို ပျက်စီးလွယ်တဲ့ hard-coded IP တွေဆီ တွန်းပို့ပါတယ်။ Resilience ကို link၊ routing နဲ့ name တွေ အတူတကွ design လုပ်ရပါတယ်။

အဓိက concept: link၊ routing နဲ့ name

Site-to-Site VPN။ ကိုယ့် router ကို ဖော်ပြတဲ့ customer gateway resource တစ်ခု (သူ့ public IP နဲ့ BGP ASN) နဲ့ VPC တစ်ခုနဲ့ attach လုပ်ထားတဲ့ virtual private gateway ဒါမှမဟုတ် Transit Gateway ပေါ်မှာ ဆုံးတဲ့ VPN connection တစ်ခုကို ဆောက်ပါတယ်။ VPN connection တိုင်းမှာ မတူတဲ့ AWS endpoint နှစ်ခုဆီ သွားတဲ့ IPsec tunnel နှစ်ခု ရှိပါတယ် — နှစ်ခုလုံး configure လုပ်ပါ။ BGP နဲ့ဆိုရင် route တွေကို dynamic ဖလှယ်ပြီး traffic က စက္ကန့်ပိုင်းအတွင်း ကျန်းမာတဲ့ tunnel ဆီ ပြောင်းသွားပါတယ်။ Static routing ကတော့ BGP မ run နိုင်တဲ့ device တွေအတွက်ပဲ ဖြစ်ပါတယ်။

Scale ကြီးရင် Transit Gateway ပေါ်မှာ ဆုံးတာက default ရွေးချယ်မှုပါ — VPN တစ်ခုက attach လုပ်ထားတဲ့ VPC တိုင်းကို ရောက်ပြီး standard tunnel တစ်ခုက 1.25 Gbps လောက်မှာ အမြင့်ဆုံးဖြစ်တာကြောင့် bandwidth တိုးဖို့ VPN connection အများကြီးကို ECMP နဲ့ run နိုင်ပါတယ်။ Virtual private gateway က ပိုရိုးရှင်းပေမဲ့ VPC တစ်ခုတည်းကိုပဲ ဆောင်ရွက်ပေးပြီး tunnel တွေကြား load-balance မလုပ်ပါဘူး။

Direct Connect။ ကိုယ့် router ကနေ Direct Connect location တစ်ခုမှာရှိတဲ့ AWS ဆီ physical connection တစ်ခုပါ။ Dedicated connection တွေက AWS ဆီက မှာယူရတဲ့ port အပြည့် (1၊ 10၊ 100 Gbps နဲ့ အထက်) တွေဖြစ်ပြီး hosted connection တွေကတော့ Direct Connect Partner တစ်ခုကနေ provision လုပ်ပေးတဲ့ capacity သေးသေးတွေပါ — colocation facility ထဲမှာ မရှိရင် အများအားဖြင့် ပိုမြန်တဲ့ ရွေးချယ်မှုပါ။ Connection ပေါ်မှာ virtual interface (VIF) တွေကို ဆောက်ပါတယ် —

VIF typeရောက်နိုင်တာ
Private VIFVirtual private gateway ဒါမှမဟုတ် Direct Connect gateway ကနေ VPC တွေ
Transit VIFDirect Connect gateway ကနေ Transit Gateway တွေ
Public VIFInternet မဖြတ်ဘဲ S3 public IP range လို AWS public endpoint တွေ

Direct Connect gateway က global object တစ်ခုပါ — gateway တစ်ခုက ကိုယ့် VIF တွေကို Region အများကြီးထဲက virtual private gateway ဒါမှမဟုတ် Transit Gateway တွေနဲ့ ချိတ်ပေးနိုင်ပါတယ်။ Direct Connect traffic က private ဖြစ်ပေမဲ့ default အားဖြင့် encrypt မလုပ်ထားပါဘူး — MACsec က ထောက်ပံ့တဲ့ dedicated connection တွေပေါ်မှာ layer-2 encryption ထည့်ပေးပြီး Direct Connect ပေါ်မှာ IPsec VPN run တာက နောက်ထပ် အသုံးများတဲ့ option ပါ။

Resilience နဲ့ DNS။ Connection တွေ fail ဖြစ်တတ်တာကြောင့် production design တွေက connection အနည်းဆုံး နှစ်ခု — အကောင်းဆုံးက Direct Connect location နှစ်ခုမှာ — သုံးပြီး အများအပြားက backup လမ်းကြောင်းအဖြစ် Transit Gateway တစ်ခုတည်းပေါ်မှာ VPN တစ်ခု ထပ်ထည့်ကြပါတယ်။ နောက်ဆုံးအနေနဲ့ Route 53 Resolver က DNS ကမ္ဘာနှစ်ခုကို ပေါင်းပေးပါတယ် — inbound endpoint က on-premises DNS server တွေကို AWS private zone တွေကို forward လုပ်ဖို့ ကိုယ့် VPC ထဲက IP address တွေ ပေးပြီး outbound endpoint နဲ့ forwarding rule တွေက corporate domain တွေအတွက် query တွေကို on-premises DNS server တွေဆီ ပို့ပေးပါတယ်။ Laptop တွေကနေ access လိုတဲ့ remote user တွေကတော့ တခြားပြဿနာ ဖြစ်ပြီး AWS Client VPN နဲ့ ဖြေရှင်းပါတယ်။

text
HYBRID EDGE ON A TRANSIT GATEWAY
--------------------------------
  ON-PREMISES 172.16.0.0/12                         AWS us-east-1
  +----------------------+
  | router (ASN 65010)   |==[ Direct Connect: transit VIF ]==> [DX gateway]
  |                      |                                         |
  |                      |--[ VPN tunnel 1 ]--+                    |
  |                      |--[ VPN tunnel 2 ]--+--> [VPN attach]    |
  | DNS 172.16.0.10      |                           |             |
  +----------------------+                           v             v
                                               +-------------------------+
                                               |     Transit Gateway     |
                                               |  DX preferred, VPN = B  |
                                               +-------------------------+
                                                   |               |
                                               prod VPC        shared VPC
                                                            (Resolver in/out)
စိတ်ထဲမှာ မှတ်ထားရမယ့်ပုံ
  1. VPN: TGW ပေါ်မှာ tunnel 2 ခု + BGP
  2. DX: bandwidth နဲ့ တည်ငြိမ်တဲ့ latency
  3. ဒုတိယ link: VPN ဒါမှမဟုတ် DX
  4. Resolver endpoint တွေက DNS ပေါင်း

Hybrid design တစ်ခုက သူ့ရဲ့ အားအနည်းဆုံး layer လောက်ပဲ resilient ဖြစ်ပါတယ် — router တစ်ခုတည်းနဲ့ link နှစ်ခု ဒါမှမဟုတ် DNS fallback မပါတဲ့ link နှစ်ခုက အတူတူ fail ဖြစ်နေဦးမှာပါ။

လက်တွေ့ ဥပမာ: Transit Gateway ပေါ်က VPN နဲ့ hybrid DNS

ဒီ CloudFormation template က hybrid edge သေးသေးလေးတစ်ခုရဲ့ AWS ဘက်ကို ဆောက်ပါတယ် — office router အတွက် customer gateway တစ်ခု၊ ရှိပြီးသား Transit Gateway ပေါ်က BGP VPN connection တစ်ခုနဲ့ shared-services VPC ထဲက Route 53 Resolver inbound နဲ့ outbound endpoint တွေ၊ corp.example.internal ကို on-premises DNS server ဆီ forward လုပ်တဲ့ rule တစ်ခုပါ။

hybrid-edge.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Hybrid edge - BGP VPN on a Transit Gateway plus hybrid DNS

Parameters:
  TransitGatewayId:
    Type: String
    Description: Existing Transit Gateway (tgw-...)
  VpcId:
    Type: AWS::EC2::VPC::Id
    Description: Shared-services VPC that hosts the Resolver endpoints
  SubnetA:
    Type: AWS::EC2::Subnet::Id
  SubnetB:
    Type: AWS::EC2::Subnet::Id
  OfficeRouterIp:
    Type: String
    Default: 203.0.113.10
  OnPremCidr:
    Type: String
    Default: 172.16.0.0/12
  OnPremDnsIp:
    Type: String
    Default: 172.16.0.10

Resources:
  OfficeRouter:
    Type: AWS::EC2::CustomerGateway
    Properties:
      Type: ipsec.1
      BgpAsn: 65010
      IpAddress: !Ref OfficeRouterIp
      Tags:
        - Key: Name
          Value: yangon-office

  OfficeVpn:
    Type: AWS::EC2::VPNConnection
    Properties:
      Type: ipsec.1
      CustomerGatewayId: !Ref OfficeRouter
      TransitGatewayId: !Ref TransitGatewayId
      StaticRoutesOnly: false # BGP: routes and failover are dynamic
      Tags:
        - Key: Name
          Value: yangon-office-vpn

  ResolverSg:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: DNS between on-premises and the Resolver endpoints
      VpcId: !Ref VpcId
      SecurityGroupIngress:
        - { IpProtocol: udp, FromPort: 53, ToPort: 53, CidrIp: !Ref OnPremCidr }
        - { IpProtocol: tcp, FromPort: 53, ToPort: 53, CidrIp: !Ref OnPremCidr }
      SecurityGroupEgress:
        - { IpProtocol: udp, FromPort: 53, ToPort: 53, CidrIp: !Ref OnPremCidr }
        - { IpProtocol: tcp, FromPort: 53, ToPort: 53, CidrIp: !Ref OnPremCidr }

  InboundEndpoint: # on-prem DNS forwards AWS private zones to these IPs
    Type: AWS::Route53Resolver::ResolverEndpoint
    Properties:
      Name: from-on-prem
      Direction: INBOUND
      SecurityGroupIds: [!Ref ResolverSg]
      IpAddresses:
        - SubnetId: !Ref SubnetA
        - SubnetId: !Ref SubnetB

  OutboundEndpoint: # VPC queries for corporate domains leave through these
    Type: AWS::Route53Resolver::ResolverEndpoint
    Properties:
      Name: to-on-prem
      Direction: OUTBOUND
      SecurityGroupIds: [!Ref ResolverSg]
      IpAddresses:
        - SubnetId: !Ref SubnetA
        - SubnetId: !Ref SubnetB

  CorpForwardRule:
    Type: AWS::Route53Resolver::ResolverRule
    Properties:
      Name: corp-example-internal
      DomainName: corp.example.internal
      RuleType: FORWARD
      ResolverEndpointId: !GetAtt OutboundEndpoint.ResolverEndpointId
      TargetIps:
        - Ip: !Ref OnPremDnsIp
          Port: "53"

  CorpForwardRuleAssociation:
    Type: AWS::Route53Resolver::ResolverRuleAssociation
    Properties:
      ResolverRuleId: !GetAtt CorpForwardRule.ResolverRuleId
      VPCId: !Ref VpcId

Outputs:
  VpnConnectionId:
    Value: !Ref OfficeVpn
  InboundEndpointId:
    Value: !GetAtt InboundEndpoint.ResolverEndpointId
  CorpRuleId:
    Description: Share this rule with other accounts through AWS RAM
    Value: !GetAtt CorpForwardRule.ResolverRuleId

Code ကို တစ်ပိုင်းချင်း ရှင်းပြမယ်

  1. Customer gatewayBgpAsn: 65010

    ကိုယ့် router ကို AWS ဆီ ဖော်ပြပေးတာပါ — သူ့ public IP နဲ့ private ASN။ BGP က ဘက်နှစ်ဖက်ကို ခွဲခြားသိနိုင်အောင် Transit Gateway ရဲ့ Amazon-side ASN နဲ့ မတူရပါဘူး။

  2. BGP VPN on the TGWStaticRoutesOnly: false

    Connection က tunnel နှစ်ခုကို အလိုအလျောက် ရပါတယ်။ BGP နဲ့ဆိုရင် office က 172.16.0.0/12 ကို advertise လုပ်ပြီး TGW က သူသိတဲ့ VPC range တွေကို advertise လုပ်ကာ fail ဖြစ်တဲ့ tunnel ကို ဘယ်သူမှ route မပြင်ရဘဲ withdraw လုပ်ပေးပါတယ်။ VPN က တခြား attachment တွေလိုပဲ associate နဲ့ propagate လုပ်ရတဲ့ TGW attachment တစ်ခု ဖြစ်လာပါတယ်။

  3. Two AZs per endpointIpAddresses: - SubnetId: !Ref SubnetA - SubnetId: !Ref SubnetB

    Resolver endpoint တစ်ခုစီက IP address အနည်းဆုံး နှစ်ခု လိုပါတယ်၊ သူတို့ကို မတူတဲ့ AZ တွေထဲ ထားတာက AZ တစ်ခု fail ဖြစ်လည်း DNS ဆက်အလုပ်လုပ်အောင် ထားပေးပါတယ်။ Fixed IP တွေက optional ဖြစ်ပြီး မထည့်ရင် AWS က address တွေ ပေးပြီး နောက်မှ ရှာကြည့်ရပါတယ်။

  4. Forwarding ruleDomainName: corp.example.internal

    Associate လုပ်ထားတဲ့ VPC တွေကနေ ဒီ domain (နဲ့ သူ့ subdomain တွေ) အတွက် query တွေက outbound endpoint ကနေ 172.16.0.10 ဆီ ထွက်သွားပါတယ်။ ကျန်တာအားလုံးကိုတော့ ပုံမှန် VPC resolver က ဆက်ဖြေပေးပါတယ်။

You should see
aws cloudformation deploy ပြီးရင် stack က VpnConnectionId (vpn-...)၊ InboundEndpointId နဲ့ CorpRuleId ကို output ထုတ်ပေးပါတယ်။ Download လုပ်ထားတဲ့ configuration နဲ့ office router ကို configure မလုပ်မချင်း tunnel နှစ်ခုလုံး DOWN လို့ ပြပါတယ်။ BGP တက်လာတာနဲ့ describe-vpn-connections က tunnel နှစ်ခုလုံး UP လို့ report လုပ်ပြီး shared VPC ထဲက EC2 instance တစ်ခုကနေ nslookup erp.corp.example.internal လုပ်ရင် on-premises address ကို ပြန်ပေးပါတယ်။
VPC instance ကနေ on-prem name တစ်ခုကို DNS lookup လုပ်ပုံ
  1. App က VPC resolver (.2) ကို မေး
  2. corp.example.internal rule နဲ့ ကိုက်လား
  3. Outbound endpoint က query ကို forward
  4. On-prem DNS 172.16.0.10 က ဖြေ

corp.example.internal အောက်က name

Answered by on-prem DNS

တခြား name

Answered by the VPC resolver

Transit Gateway နဲ့ Direct Connect

Connection တစ်ခု provision ဖြစ်ပြီးတာနဲ့ (letter of authorization၊ colocation facility ထဲက cross-connect နဲ့ အများအားဖြင့် ရက်သတ္တပတ် အနည်းငယ်) AWS ဘက်မှာ object သုံးခုပဲ ရှိပါတယ် — Direct Connect gateway တစ်ခု၊ on-premises ဆီ advertise လုပ်မယ့် prefix တွေကို စာရင်းပြုစုထားတဲ့ အဲဒီ gateway နဲ့ ကိုယ့် Transit Gateway ကြား association တစ်ခုနဲ့ gateway ပေါ်မှာ ဆုံးတဲ့ connection ပေါ်က transit VIF တစ်ခုပါ။

Association ပေါ်က allowed prefix တွေက ကိုယ့် data center သိရမယ့်အရာတွေဖြစ်လို့ VPC တိုင်းကို advertise မလုပ်ဘဲ 10.0.0.0/8 လို summary တွေကို advertise လုပ်ပါ။ Direct Connect gateway၊ Transit Gateway နဲ့ ကိုယ့် router အတွက် မတူတဲ့ private ASN တွေကို သုံးပါ။

direct-connect.sh
TGW_ID=tgw-0a1b2c3d4e5f67890

# 1. Global Direct Connect gateway (its own private ASN)
DXGW_ID=$(aws directconnect create-direct-connect-gateway \
  --direct-connect-gateway-name core-dxgw --amazon-side-asn 64600 \
  --query 'directConnectGateway.directConnectGatewayId' --output text)

# 2. Associate it with the Transit Gateway; these prefixes go to on-prem
aws directconnect create-direct-connect-gateway-association \
  --direct-connect-gateway-id $DXGW_ID --gateway-id $TGW_ID \
  --add-allowed-prefixes-to-direct-connect-gateway cidr=10.0.0.0/8

# 3. Transit VIF on the physical connection, landing on the DX gateway
VIF="virtualInterfaceName=prod-transit,vlan=101,asn=65010,mtu=8500"
VIF="$VIF,addressFamily=ipv4,directConnectGatewayId=$DXGW_ID"
aws directconnect create-transit-virtual-interface \
  --connection-id dxcon-fg5678gh --new-transit-virtual-interface "$VIF"

# 4. Health checks you will run often
aws directconnect describe-virtual-interfaces --connection-id dxcon-fg5678gh \
  --query 'virtualInterfaces[].[virtualInterfaceName,virtualInterfaceState]'
aws ec2 describe-vpn-connections --vpn-connection-ids vpn-0a1b2c3d4e5f67890 \
  --query 'VpnConnections[0].VgwTelemetry[].[OutsideIpAddress,Status]' \
  --output table

Resiliency model တွေနဲ့ ဘယ်လမ်းကြောင်းက အနိုင်ရလဲ

Modelပုံစံကျော်လွှားနိုင်တာ
Development and testLocation တစ်ခုမှာ connection နှစ်ခု၊ device မတူDevice ဒါမှမဟုတ် port တစ်ခု fail
High resiliencyLocation နှစ်ခုမှာ connection တစ်ခုစီLocation တစ်ခုလုံး fail
Maximum resiliencyLocation နှစ်ခုမှာ connection နှစ်ခုစီLocation fail နဲ့ device fail တစ်ပြိုင်နက်
DX plus VPN backupDX link တစ်ခု ဒါမှမဟုတ် အများ၊ TGW တစ်ခုတည်းပေါ်မှာ VPNDX ဆုံးရှုံးမှု၊ bandwidth လျော့ပြီး

Destination တစ်ခုတည်းကို Direct Connect ကနေရော VPN ကနေရော သိလာတဲ့အခါ Transit Gateway က longest-prefix match ကို အရင်သုံးပြီး prefix တူမှသာ VPN route တွေထက် Direct Connect route တွေကို ပိုနှစ်သက်ပါတယ်။ VPN backup က Direct Connect route ကို withdraw မလုပ်မချင်း အလုပ်မလုပ်ဘဲ စောင့်နေတာ အဲဒီနည်းနဲ့ပါ။ လမ်းကြောင်း နှစ်ခုလုံးမှာ တူညီတဲ့ prefix တွေကို advertise လုပ်ပြီး ပြန်လာတဲ့ ဦးတည်ချက်ကို လွှမ်းမိုးဖို့ ကိုယ့် router ပေါ်မှာ AS-path prepending လို BGP attribute တွေကို သုံးပါ။

Production မှာ

Production မှာ တကယ်လုပ်ပုံ

ပုံမှန် rollout တစ်ခုက ဒီနေ့ပဲ အသင့်ဖြစ်တာကြောင့် VPN နဲ့ စပြီး migration က တကယ့် data တွေကို ရွှေ့လာတဲ့အခါ bandwidth နဲ့ ခန့်မှန်းနိုင်တဲ့ latency အတွက် Direct Connect ကို ထည့်ပါတယ်။ အဖြစ်များတဲ့ နောက်ဆုံးအခြေအနေကတော့ location နှစ်ခုမှာ hosted ဒါမှမဟုတ် dedicated connection နှစ်ခုကနေ Direct Connect gateway နဲ့ transit VIF တွေဆီ ဝင်ပြီး Transit Gateway တစ်ခုတည်းပေါ်က BGP VPN ကို နောက်ဆုံး လမ်းကြောင်းအဖြစ် ထားတာပါ။ Network team က BGP session တစ်ခုကို ပိတ်ပြီး traffic ရွှေ့သွားတာကို စောင့်ကြည့်ကာ failover ကို အချိန်ဇယားနဲ့ စမ်းသပ်ပါတယ် — မစမ်းသပ်ရသေးတဲ့ backup လမ်းကြောင်းက များသောအားဖြင့် ပျက်နေတတ်လို့ပါ။

DNS ကို shared-services VPC ထဲမှာ ဗဟိုပြုထားပါတယ် — inbound endpoint တစ်စုံနဲ့ outbound endpoint တစ်စုံ၊ forwarding rule တွေကို AWS RAM ကနေ account တိုင်းကို share လုပ်ပြီး spoke VPC တစ်ခုစီနဲ့ associate လုပ်ပါတယ်။ On-premises DNS server တွေကတော့ AWS private hosted zone တွေအတွက် inbound endpoint IP တွေကို ညွှန်တဲ့ conditional forwarder တွေ ရပါတယ်။

အိမ်ကနေ အလုပ်လုပ်တဲ့ ဝန်ထမ်းတွေကိုတော့ AWS Client VPN နဲ့ သီးခြား ကိုင်တွယ်ပါတယ် — Active Directory ဒါမှမဟုတ် SAML identity provider နဲ့ user တွေကို authenticate လုပ်ပြီး Transit Gateway တစ်ခုတည်းနဲ့ attach လုပ်ထားတဲ့ VPC တစ်ခုထဲ ရောက်စေတဲ့ managed OpenVPN-based remote-access service တစ်ခုပါ။

အမှားများ

အဖြစ်များတဲ့ အမှားတွေ

အမှား ၁: VPN tunnel တစ်ခုတည်းကိုပဲ configure လုပ်တာ

AWS က tunnel endpoint တွေကို တစ်ခုချင်း update လုပ်ပြီး ဒုတိယ tunnel က traffic သယ်မယ်လို့ ယူဆကာ ကြိုတင် အသိပေးပါတယ်။ Tunnel 1 ကိုပဲ configure လုပ်ထားတဲ့ router က maintenance window တိုင်းမှာ မှောင်သွားပါတယ်။ Tunnel နှစ်ခုလုံး configure လုပ်၊ BGP သုံးပြီး tunnel တစ်ခုစီအတွက် TunnelState CloudWatch metric ပေါ်မှာ alarm ထားပါ။

အမှား ၂: မတော်တဆ အနိုင်ရသွားတဲ့ backup လမ်းကြောင်း

Office က VPN ကနေ 172.16.0.0/16 ကို advertise လုပ်ပြီး Direct Connect ကနေ 172.16.0.0/12 ကိုပဲ advertise လုပ်ရင် longest-prefix match က traffic ကို VPN ကနေ အမြဲတမ်း ပို့နေမှာဖြစ်ပြီး ဈေးကြီးတဲ့ Direct Connect link က အလကား ထိုင်နေပါလိမ့်မယ်။ ဆန့်ကျင်ဘက် အမှားဖြစ်တဲ့ တစ်ခါမှ မစမ်းသပ်ရသေးတဲ့ VPN ကတော့ Direct Connect fail ဖြစ်တဲ့အချိန်မှာ အတိအကျ fail ဖြစ်ပါတယ်။ နှစ်ဖက်လုံးမှာ တူညီတဲ့ prefix တွေကို advertise လုပ်ပြီး failover ကို ပုံမှန် စမ်းသပ်ပါ။

အမှား ၃: Direct Connect ကို encrypt လုပ်ထားတယ်လို့ ယူဆတာ

Direct Connect က private circuit တစ်ခုဖြစ်ပြီး encrypt လုပ်ထားတဲ့ circuit မဟုတ်ပါဘူး။ Compliance က encryption in transit ကို လိုအပ်ရင် အစအဆုံး TLS၊ ထောက်ပံ့တဲ့ dedicated connection တွေပေါ်မှာ MACsec ဒါမှမဟုတ် Direct Connect link ပေါ်မှာ IPsec VPN ကို သုံးပြီး ဘယ်ဟာကို ရွေးခဲ့လဲ မှတ်တမ်းတင်ထားပါ။

Best Practices

Best practice များ

  • VPC တိုင်း edge တစ်ခုတည်းကနေ အကျိုးရှိအောင် VPN နဲ့ Direct Connect ကို Transit Gateway ပေါ်မှာ ဆုံးအောင် လုပ်ပါ။
  • ကိုယ့် router၊ TGW နဲ့ Direct Connect gateway အတွက် မတူတဲ့ private ASN တွေနဲ့ နေရာတိုင်းမှာ BGP ကို သုံးပါ။
  • Physical လမ်းကြောင်း အနည်းဆုံး နှစ်ခု ဆောက်ပြီး failover ကို အချိန်ဇယားနဲ့ စမ်းသပ်ပါ။
  • EC2 ပေါ်မှာ DNS server တွေ run မယ့်အစား Resolver endpoint တွေကို ဗဟိုပြုပြီး forwarding rule တွေကို AWS RAM နဲ့ share လုပ်ပါ။

💰 Cost & Cleanup

Site-to-Site VPN connection တစ်ခုကို connection-hour အလိုက်နဲ့ data transfer out အလိုက် charge လုပ်ပြီး Transit Gateway ပေါ်မှာဆိုရင် နာရီအလိုက်နဲ့ GB အလိုက် charge ကျတဲ့ attachment တစ်ခုလည်း ဖြစ်ပါတယ်။ Route 53 Resolver endpoint တွေကို IP address (ENI) တစ်ခုစီ နာရီအလိုက် charge လုပ်တာကြောင့် ဒီ lab ထဲက IP နှစ်ခုစီပါတဲ့ endpoint နှစ်ခုက တစ်နာရီကို ENI-hour လေးခု charge ကျပြီး forward လုပ်တဲ့ query သန်းတိုင်းအတွက်လည်း charge ရှိပါတယ်။ Direct Connect က connection အတွက် port-hour နဲ့ နှုန်းလျှော့ထားတဲ့ data transfer out ကို charge လုပ်ပြီး dedicated port တစ်ခုက connection ကို မဖျက်မချင်း ဆက် charge ကျနေပါတယ်။ ဒီထဲက ဘာမှ free tier မဟုတ်ပါဘူး — ပြီးတာနဲ့ stack ကို ချက်ချင်းဖျက်ပြီး service တစ်ခုစီရဲ့ pricing page မှာ လက်ရှိ rate တွေကို စစ်ကြည့်ပါ။

စမ်းပြီးရင် ဖျက်ဖို့ command

bash
# VPN, customer gateway and Resolver endpoints from the template
aws cloudformation delete-stack --stack-name hybrid-edge
aws cloudformation wait stack-delete-complete --stack-name hybrid-edge

# Only if you created Direct Connect objects:
aws directconnect delete-virtual-interface --virtual-interface-id dxvif-ffabc123
aws directconnect delete-direct-connect-gateway-association \
  --association-id $DXGW_ASSOC_ID
aws directconnect delete-direct-connect-gateway --direct-connect-gateway-id $DXGW_ID

Mini challenge

Mini challenge: AWS name တွေကို on-premises ကနေ resolve ဖြစ်အောင် လုပ်ပါ

Template က corp.example.internal ကို အပြင်ဘက် forward လုပ်ပြီးသားပါ။ အခု on-premises server တွေက shared VPC နဲ့ associate လုပ်ထားတဲ့ AWS private hosted zone ဖြစ်တဲ့ aws.example.internal ထဲက name တွေကို resolve လုပ်နိုင်ရပါမယ်။ On-prem DNS team လိုအပ်တဲ့ inbound endpoint IP တွေကို ရှာပြီး သူတို့ကို test command တစ်ခု ပေးပါ။

  • Stack output တွေထဲက InboundEndpointId ကို ဖတ်ပါ
  • Endpoint ရဲ့ IP address တွေကို route53resolver CLI နဲ့ list လုပ်ပါ
  • On-prem အတွက် conditional-forwarder ညွှန်ကြားချက်နဲ့ dig test တစ်ခု ရေးပါ

ရလဒ်: Shared VPC ထဲက private IP နှစ်ခု (AZ တစ်ခုကို တစ်ခု) ရပါမယ်။ On-prem team က aws.example.internal အတွက် conditional forwarder ကို နှစ်ခုလုံးဆီ ထည့်ပြီးနောက် office server တစ်ခုကနေ dig လုပ်ရင် private hosted zone ထဲက record ကို ပြန်ရပါတယ်။

အရိပ်အမြွက် ကြည့်ရန်

Outputs ပေါ်မှာ --query ပါတဲ့ describe-stacks က ID ကို ယူပေးပြီး list-resolver-endpoint-ip-addresses က IP တစ်ခုကို entry တစ်ခုစီ ပြန်ပေးပါတယ်။ Forwarder target က အဲဒီ IP တွေဖြစ်ပြီး on-premises host တွေ မရောက်နိုင်တဲ့ .2 address က VPC resolver မဟုတ်ပါဘူး။

အဖြေ ကြည့်ရန်
bash
INBOUND_ID=$(aws cloudformation describe-stacks --stack-name hybrid-edge \
  --query "Stacks[0].Outputs[?OutputKey=='InboundEndpointId'].OutputValue" \
  --output text)

aws route53resolver list-resolver-endpoint-ip-addresses \
  --resolver-endpoint-id $INBOUND_ID \
  --query 'IpAddresses[].[Ip,SubnetId,Status]' --output table

# Hand to the on-prem DNS team:
#   conditional forwarder: aws.example.internal -> both IPs above
# Test from an office server (replace with one of the listed IPs):
dig +short app.aws.example.internal @10.24.0.37

Quick Quiz 1 / 3

Office router တစ်ခုမှာ Site-to-Site VPN ရဲ့ tunnel 1 ကိုပဲ configure လုပ်ထားပါတယ်။ AWS က အဲဒီ tunnel endpoint ပေါ်မှာ maintenance လုပ်တဲ့အခါ ဘာဖြစ်မလဲ။

Quick Quiz 2 / 3

Transit Gateway တစ်ခုမှာ Direct Connect လမ်းကြောင်းနဲ့ VPN backup ရှိပြီး နှစ်ခုလုံး BGP သုံးပါတယ်။ On-premises က Direct Connect ကနေ 172.16.0.0/12 ကို၊ VPN ကနေ 172.16.0.0/16 ကို advertise လုပ်ပါတယ်။ 172.16.5.10 ဆီ traffic ကို ဘယ်လမ်းကြောင်းက သယ်မလဲ။

Quick Quiz 3 / 3

EC2 instance တွေက on-premises DNS server တွေပေါ်မှာပဲ ရှိတဲ့ erp.corp.example.internal ကို resolve လုပ်ရပါမယ်။ ဘာကို setup လုပ်ရမလဲ။

မှတ်ထားရမယ့် အချက်များ

  • Site-to-Site VPN တိုင်းမှာ tunnel နှစ်ခု ရှိပါတယ်၊ နှစ်ခုလုံး configure လုပ်ပြီး BGP ကို အကောင်းဆုံး Transit Gateway ပေါ်မှာ သုံးပါ။
  • Direct Connect က private၊ bandwidth မြင့်တဲ့ link တွေ ပေးပါတယ်၊ dedicated ဒါမှမဟုတ် hosted နဲ့ private၊ transit ဒါမှမဟုတ် public VIF ကို ရွေးပါ။
  • Resilience ဆိုတာ physical လမ်းကြောင်း နှစ်ခုနဲ့ စမ်းသပ်ပြီးသား failover ပါ၊ longest-prefix match က DX-over-VPN preference ကို အနိုင်ယူပါတယ်။
  • Route 53 Resolver inbound endpoint တွေက AWS name တွေကို on-prem ကနေ ရှာတာကို ဆောင်ရွက်ပေးပြီး outbound endpoint နဲ့ rule တွေက ပြောင်းပြန်ကို လုပ်ပေးပါတယ်။

What is AWS Site-to-Site VPN? — AWS Documentation

What is AWS Direct Connect? — AWS Documentation

What is Route 53 Resolver? — AWS Documentation

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Hybrid Connectivity: Site-to-Site VPN၊ Direct Connect နဲ့ Hybrid DNS | Thuta Learning