ã¯ããã« æ€èšŒã§Azureç°å¢ãšAWSç°å¢ãVPNæ¥ç¶ããç°å¢ãå¿
èŠãšãªãã以äžèšäºãåèã«ç°å¢ãæ§ç¯ããããšããŸããã æäœéã®ã³ã¹ãã§ãå¿
èŠãªæã«äœã£ããæ¶ããããæ°è»œã«ã§ããããããã³ãã¬ãŒãåããŠã¿ããšããèšäºã§ãã ãã¥ãŒããªã¢ã« - ããŒã¿ã«ã䜿çšã㊠Azure ãš ã¢ããŸã³ ãŠã§ã ãµãŒãã¹ (AWS) éã® BGP å¯Ÿå¿æ¥ç¶ãæ§æãã - Azure VPN Gateway ãã®ãã¥ãŒããªã¢ã«ã§ã¯ãã¢ã¯ãã£ã/ã¢ã¯ãã£ã VPN Gateway ãš AWS äžã® 2 ã€ã®ãµã€ã鿥ç¶ã䜿çšã㊠Azure ãš AWS ãæ¥ç¶ããæ¹æ³ã«ã€ããŠèª¬æããŸãã learn.microsoft.com äžèšèšäºã®å®å
šäœã¯ã¢ã¯ãã£ã-ã¢ã¯ãã£ãæ§æãã€ïŒã€ã®ãã³ãã«ã§æ§æãããŠããŸãããä»åã¯ã¢ã¯ãã£ã-ã¢ã¯ãã£ããç¡å¹ã«ããŠãã³ãã«ã1ã€ã ãæ§æããŠãŸããæ®µéçã«ã¯æé·æã§ãã äžæçãªæ€èšŒçšéãªã®ã§ãæäœéã®æ§æã§ã€ãªããã°ããããšããææ³ã§ããã€ã¡ãŒãžã¯ãããªæãã æŠèŠå³ å³ãšããŠã¯ã以äžã®ãããªæãã§ãã ãã³ãã¬ãŒã ãã³ãã¬ãŒãã¯3ã€çšæããŠããŸããããã¯ãªãœãŒã¹æ§ç¯åŸã«æãåºãããå€ãå¿
èŠãªãªãœãŒã¹ãããããã§ãã äŸãã°ãAWSåŽã®ã«ã¹ã¿ããŒã²ãŒããŠã§ã€ã«Azureã®ãããªãã¯IPãå¿
èŠã§ããããšãã äœæã®å€§ãŸããªæµãã¯ä»¥äžã®éãã§ãã Step äœæ¥é
ç® åè Step1ïŒãAzureãNWåºç€äœæ â VNetã»ãµããããã®äœæ â¡Virtual Network Gatewayçšãããªãã¯IPã®äœæ 察å¿ãã³ãã¬ãŒãïŒ azure_network_resource.json Step2ïŒãAWSãVPNãªãœãŒã¹äœæ â VPCäœæ â¡ã«ã¹ã¿ããŒã²ãŒããŠã§ã€äœæ â¢ä»®æ³ãããã¯ãŒã¯ã²ãŒããŠã§ã€äœæ â£VPNæ¥ç¶äœæ â€ã«ãŒãäŒæ¬ã®æå¹å 察å¿ãã³ãã¬ãŒãïŒaws_vpn_resource.yaml Step3ïŒãAzureãVPNãªãœãŒã¹äœæ â Local Network Gatewayäœæ â¡Virtual Network Gatewayäœæ â¢VPNæ¥ç¶äœæ 察å¿ãã³ãã¬ãŒãïŒazure_vpn_resource.json Step1 ïŒãAzureãNWåºç€äœæ æå®ããŠãããã©ã¡ãŒã¿ ãã©ã¡ãŒã¿å ããã©ã«ãå€ åè vnetName VNet1 äœæããVNetã®åå vnetAddressPrefix 10.1.0.0/16 äœæããVNetã®CIDRç¯å² subnet1Prefix 10.1.0.0/24 GatewaySubnetã®CIDRç¯å² vpnpipName VNet1GWpip ãããªãã¯IPã®åå ã³ãŒã ãã¡ã€ã«åïŒazure_network_resource.json { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.6.18.56646", "templateHash": "10806234693722113459" } }, "parameters": { "vnetName": { "type": "string", "metadata": { "description": "VNet Name" }, "defaultValue": "VNet1" }, "vnetAddressPrefix": { "type": "string", "metadata": { "description": "VNet CIDR range" }, "defaultValue": "10.1.0.0/16" }, "subnet1Prefix": { "type": "string", "metadata": { "description": "Gateway Subnet CIDR range" }, "defaultValue": "10.1.0.0/24" }, "vpnpipName": { "type": "string", "metadata": { "description": "Public IP Name" }, "defaultValue": "VNet1GWpip" } }, "resources": [ { "type": "Microsoft.Network/virtualNetworks", "apiVersion": "2024-05-01", "name": "[parameters('vnetName')]", "location": "[resourceGroup().location]", "properties": { "addressSpace": { "addressPrefixes": [ "[parameters('vnetAddressPrefix')]" ] }, "subnets": [ { "name": "GatewaySubnet", "properties": { "addressPrefix": "[parameters('subnet1Prefix')]" } } ] } }, { "type": "Microsoft.Network/publicIPAddresses", "apiVersion": "2024-05-01", "name": "[parameters('vpnpipName')]", "location": "[resourceGroup().location]", "sku": { "name": "Standard", "tier": "Regional" }, "properties": { "publicIPAllocationMethod": "Static", "idleTimeoutInMinutes": 4 } } ] } Step2ïŒãAWSãVPNãªãœãŒã¹äœæ æå®ããŠãããã©ã¡ãŒã¿ ãã©ã¡ãŒã¿å ããã©ã«ãå€ åè myVPCName VPC1 äœæããVPCã®åå myVPCCIDR 10.2.0.0/16 äœæããVPCã®CIDRç¯å² VGWName AzureGW ä»®æ³ãããã¯ãŒã¯ã²ãŒããŠã§ã€ã®åå CGWName ToAzureInstance0 ã«ã¹ã¿ããŒã²ãŒããŠã§ã€ã®åå VPNConnectionName ToAzureConnection VPNæ¥ç¶ã®åå CustomBGPASN 65000 AzureåŽGatewayã®ASN azurepip ãªã Step1ã§äœæãããããªãã¯IPãæå® ã³ãŒã ãã¡ã€ã«åïŒaws_vpn_resource.yaml AWSTemplateFormatVersion: '2010-09-09' Description: Create a Virtual Private Gateway and Customer Gateway Parameters: myVPCName: Type: String Default: "VPC1" # VPCã®åå myVPCCIDR: Type: String Default: "10.2.0.0/16" # VPCã®CIDRç¯å² VGWName: Type: String Default: "AzureGW" # ä»®æ³ãããã¯ãŒã¯ã²ãŒããŠã§ã€ã®ãªãœãŒã¹å CGWName: Type: String Default: "ToAzureInstance0" # ã«ã¹ã¿ã ãããã¯ãŒã¯ã²ãŒããŠã§ã€ã®ãªãœãŒã¹å VPNConnectionName: Type: String Default: "ToAzureConnection" # VPNæ¥ç¶ã®åå CustomBGPASN: Type: Number Default: 65000 # ä»»æã®ASNãå
¥å azurepip: # ã¹ã¿ãã¯äœææã«AzureåŽã®ãããªãã¯IPãå
¥åããã Type: String Resources: # VPCã®äœæ myVPC: Type: AWS::EC2::VPC Properties: CidrBlock: !Ref myVPCCIDR Tags: - Key: Name Value: !Ref myVPCName MyVpcDefaultRouteTable: Type: AWS::EC2::RouteTable Properties: VpcId: !Ref myVPC # ä»®æ³ãã©ã€ããŒãã²ãŒããŠã§ã€ã®äœæ VirtualPrivateGateway: Type: AWS::EC2::VPNGateway Properties: Type: ipsec.1 Tags: - Key: Name Value: !Ref VGWName # ä»®æ³ãã©ã€ããŒãã²ãŒããŠã§ã€ãVPCã«ã¢ã¿ãã VPCGatewayAttachment: Type: AWS::EC2::VPCGatewayAttachment Properties: VpcId: !Ref myVPC VpnGatewayId: !Ref VirtualPrivateGateway # ã«ã¹ã¿ããŒã²ãŒããŠã§ã€ã®äœæ CustomerGateway: Type: AWS::EC2::CustomerGateway Properties: BgpAsn: !Ref CustomBGPASN IpAddress: !Ref azurepip # ã«ã¹ã¿ããŒã²ãŒããŠã§ã€ã®ãããªãã¯IPã¢ãã¬ã¹ Type: ipsec.1 Tags: - Key: Name Value: !Ref CGWName # VPNæ¥ç¶ã®äœæ VPNConnection: Type: AWS::EC2::VPNConnection Properties: Type: ipsec.1 CustomerGatewayId: !Ref CustomerGateway VpnGatewayId: !Ref VirtualPrivateGateway StaticRoutesOnly: false # åçã«ãŒãã£ã³ã°ãšããã Tags: - Key: Name Value: !Ref VPNConnectionName VpnTunnelOptionsSpecifications: - TunnelInsideCidr: "169.254.21.0/30" # ãã³ãã«1ã®å
éšIPv4 CIDR - TunnelInsideCidr: "169.254.22.0/30" # ãã³ãã«2ã®å
éšIPv4 CIDR # ã«ãŒãäŒæ¬ã®æå¹å EnableRoutePropagation: Type: AWS::EC2::VPNGatewayRoutePropagation Properties: RouteTableIds: - !Ref MyVpcDefaultRouteTable VpnGatewayId: !Ref VirtualPrivateGateway DependsOn: VPCGatewayAttachment Outputs: VirtualPrivateGatewayId: Description: "The ID of the Virtual Private Gateway" Value: !Ref VirtualPrivateGateway CustomerGatewayId: Description: "The ID of the Customer Gateway" Value: !Ref CustomerGateway VPNConnectionId: Description: "The ID of the VPN Connection" Value: !Ref VPNConnection Step3ïŒãAzureãVPNãªãœãŒã¹äœæ æå®ããŠãããã©ã¡ãŒã¿ ãã©ã¡ãŒã¿å ããã©ã«ãå€ åè myVNet VNet1 Step1ã§äœæããVNetã®åå publicIpName VNet1GWpip Step1ã§äœæãããããªãã¯IPã®åå localNetworkGatewayName lngw_test Local Network Gatewayã®åå asn 64512 AWSåŽã®ASN bgpPeeringAddress 169.254.21.1 Local Network Gatewayã®ãã¢IP customBgpIpAddress 169.254.21.2 Virtual Network Gatewayã®ãã¢IP virtualNetworkGatewayName vngw_test Virtual Network Gatewayã®åå vngwasn 65000 AzureåŽã®ASN gatewaySku VpnGw1 VPN Gatewayã®SKUãæå® virtualNetworkConnectionName AWSTunnel1toAzureInstance0 VPNæ¥ç¶ã®åå gatewayIpAddress ãªã Step2ã§äœæããVPNæ¥ç¶(ãã³ãã«1)ã®ãããªãã¯IPãæå® PreSharedKey ãªã Step2ã§äœæããVPNæ¥ç¶ã®äºåå
±æéµãæå® ã³ãŒã ãã¡ã€ã«åïŒaws_vpn_resource.yaml { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "myVNet": { "type": "string", "metadata": { "description": "VNet Name" }, "defaultValue": "VNet1" }, "publicIpName": { "type": "string", "metadata": { "description": "PublicIPAddress Name" }, "defaultValue": "VNet1GWpip" }, "localNetworkGatewayName": { "type": "string", "metadata": { "description": "LocalNetworkGateway Name" }, "defaultValue": "lngw_test" }, "asn": { "type": "int", "metadata": { "description": "Autonomous System Number (ASN) for BGP" }, "defaultValue": 64512 }, "bgpPeeringAddress": { "type": "string", "metadata": { "description": "BGP peering address for LocalNetworkGateway" }, "defaultValue": "169.254.21.1" }, "customBgpIpAddress": { "type": "string", "metadata": { "description": "BGP peering address for VirtualNetworkGateway" }, "defaultValue": "169.254.21.2" }, "virtualNetworkGatewayName": { "type": "string", "metadata": { "description": "Name of the virtual network gateway" }, "defaultValue": "vngw_test" }, "vngwasn": { "type": "int", "metadata": { "description": "Autonomous System Number (ASN) for BGP" }, "defaultValue": 65000 }, "gatewaySku": { "type": "string", "metadata": { "description": "SKU for the virtual network gateway" }, "defaultValue": "VpnGw1", "allowedValues": [ "Basic", "VpnGw1", "VpnGw2", "VpnGw3", "VpnGw4", "VpnGw5" ] }, "virtualNetworkConnectionName": { "type": "string", "metadata": { "description": "Name of the VPN Connection" }, "defaultValue": "AWSTunnel1toAzureInstance0" }, "gatewayIpAddress": { "type": "string", "metadata": { "description": "AWS Public IP Address" } }, "PreSharedKey": { "type": "string", "metadata": { "description": "Pre-SharedKey" } } }, "resources": [ { "type": "Microsoft.Network/localNetworkGateways", "apiVersion": "2024-05-01", "name": "[parameters('localNetworkGatewayName')]", "location": "[resourceGroup().location]", "properties": { "gatewayIpAddress": "[parameters('gatewayIpAddress')]", "bgpSettings": { "asn": "[parameters('asn')]", "bgpPeeringAddress": "[parameters('bgpPeeringAddress')]" } } }, { "type": "Microsoft.Network/virtualNetworkGateways", "apiVersion": "2024-05-01", "name": "[parameters('virtualNetworkGatewayName')]", "location": "[resourceGroup().location]", "properties": { "ipConfigurations": [ { "name": "vnetGatewayConfig", "properties": { "privateIPAllocationMethod": "Dynamic", "subnet": { "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('myVNet'), 'GatewaySubnet')]" }, "publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIpName'))]" } } } ], "gatewayType": "Vpn", "vpnType": "RouteBased", "enableBgp": true, "activeActive": false, "sku": { "name": "[parameters('gatewaySku')]", "tier": "[parameters('gatewaySku')]" }, "bgpSettings": { "asn": "[parameters('vngwasn')]", "bgpPeeringAddresses": [ { "ipconfigurationId": "[resourceId('Microsoft.Network/virtualNetworkGateways/ipConfigurations', parameters('virtualNetworkGatewayName'), 'vnetGatewayConfig')]", "customBgpIpAddresses": [ "[parameters('customBgpIpAddress')]" ] } ] } } }, { "type": "Microsoft.Network/connections", "apiVersion": "2024-05-01", "name": "[parameters('virtualNetworkConnectionName')]", "location": "[resourceGroup().location]", "dependsOn": [ "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('virtualNetworkGatewayName'))]", "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]" ], "properties": { "virtualNetworkGateway1": { "id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('virtualNetworkGatewayName'))]" }, "localNetworkGateway2": { "id": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]" }, "connectionType": "IPsec", "sharedKey": "[parameters('PreSharedKey')]", "enableBgp": true } } ], "outputs": { "localNetworkGatewayId": { "type": "string", "value": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]" }, "VirtualNetworkGatewayId": { "type": "string", "value": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('localNetworkGatewayName'))]" } } } æé ããããã¯äžèšãã³ãã¬ãŒããçšããç°¡åãªæ§ç¯æé ãèšèŒããŸãããªãã现ããç»é¢é·ç§»çã¯æé ãçããŠããŸãã®ã§ãäºæ¿ãã ããã ãªããAzure CLIãã€ã³ã¹ããŒã«ãããŠããããšãåæãšãªããŸããã€ã³ã¹ããŒã«æé ã¯ä»¥äžåç
§ã§ãã Azure CLI ãã€ã³ã¹ããŒã«ããæ¹æ³ Azure CLI ã¯ãWindowsãmacOSãããã³ Linux ç°å¢ã«ã€ã³ã¹ããŒã«ã§ããŸãã Docker ã³ã³ãããŒããã³ Azure Cloud Shell ã§ãå®è¡ã§ããŸãã learn.microsoft.com ãªãœãŒã¹æ§ç¯æé â Azure CLIã䜿ããã以äžã³ãã³ãã§Azureã«ãã°ã€ã³ããŸãã az login â¡AzureåŽã«ãªãœãŒã¹ã°ã«ãŒãããªãå Žåã¯ä»¥äžã³ãã³ãã§ãªãœãŒã¹ã°ã«ãŒããäœæããŠäžããã az group create --name <ãªãœãŒã¹ã°ã«ãŒãå> --location japaneast â¢ä»¥äžã³ãã³ãã§AzureãªãœãŒã¹ïŒNWé¢é£ïŒããããã€ããŸãã az deployment group create --resource-group <ãªãœãŒã¹ã°ã«ãŒãå> --template-file azure_network_resource.json ãããã€åŸãäœæãããããªãã¯IPã®ã¢ãã¬ã¹ãæ§ããŸãã â£AWSã³ã³ãœãŒã«ç»é¢ã®CloudFormationããã¹ã¿ãã¯ãäœæããŠãã ããã ãã³ãã¬ãŒããã¡ã€ã«ãèªã¿èŸŒãŸããŸãã ãã©ã¡ãŒã¿ãšããŠâ¢ã§ç¢ºèªããAzureåŽã®ãããªãã¯IPã¢ãã¬ã¹ãå
¥åããŸãã ãã®ä»ã¯ããã©èšå®ã®ãŸãŸã¹ã¿ãã¯ãéä¿¡ããã°OKã§ãã â€CloudFormationãæ£åžžçµäºããããVPNæ¥ç¶ç»é¢ã§ãã³ãã«ã®ãããªãã¯IPã確èªããŸãã â¥ãŸããæ§æãã¡ã€ã«ãããŠã³ããŒãããŸãã ããŠã³ããŒããããã¡ã€ã«å
ã«äºåå
±æéµãæžãããŠãã®ã§ãåŸã»ã©äœ¿ããŸãã âŠæåŸã«ä»¥äžã³ãã³ãã§AzureãªãœãŒã¹ïŒVPNé¢é£ïŒããããã€ããŸãã gatewayIpAddressã§â€ã§ç¢ºèªãããããªãã¯IPããPreSharedKeyã§â¥ã§ç¢ºèªããäºåå
±æéµãæå®ããŸãã az deployment group create --resource-group <ãªãœãŒã¹ã°ã«ãŒãå> --template-file azure_vpn_resource.json --parameters gatewayIpAddress=<â€ã§ç¢ºèªãããããªãã¯IP> PreSharedKey=<â¥ã§ç¢ºèªããäºåå
±æéµ> â以äžã®ããã«ãªã£ãŠãã°ãã€ãªãã£ãŠãã¯ãã§ãã â»Azureäžã§ä»®æ³VMãAWSäžã§EC2ãããŠãçéã§ããããšã確èªããŸããã ãAzureåŽã ãAWSåŽã ãªãœãŒã¹å逿é ãAzureã ãªãœãŒã¹ã°ã«ãŒããåé€ããããšã§äœæãããªãœãŒã¹ãå
šéšæ¶ããŸãã以äžã³ãã³ããå®è¡ãã ããã az group delete --name <ãªãœãŒã¹ã°ã«ãŒãå> ãAWSã CloudFormationã®ã¹ã¿ãã¯ãåé€ããããšã§äœæãããªãœãŒã¹ãå
šéšæ¶ããŸãã ããã㫠以äžãAWSãšAzureãVPNæ¥ç¶ããŠã¿ããã§ãããæ¬åœã«æ¥ç¶ãããšãã ãããäœã£ãŠãŸããããã ã¡ãªã¿ã«æ§ç¯å
šäœæµãã®ã§å€§äœ40åãããããããŸããâ»Azureã®VPNãªãœãŒã¹äœæã30åè¶
ãããã ã³ã³ã»ãããšããŠã¯AzureãAWSã«äœããªãç¶æ
ã§0ããäœãã£ãŠããšãšææ°ãã§ããã ãå°ãªãã£ãŠããšãæèããŸããã ãšã¯ãããAzureãšAWSãšããç°ãªããã©ãããã©ãŒã ããå€ãåŒã£åŒµã£ãŠããå¿
èŠãããã®ã§1ã€ã®ãã³ãã¬ãŒãã«ããããã®ã¯é£ãããæé ãäœã¹ããããã«åãããŠãã®ã§ããå°ã工倫ã§ããªãããªããšæã£ãŠãããšããã§ãã äœè£ãã§ãŠããã°ãã®ãã¡åé ã®Microsoftèšäºã®å®å
šäœãäœããããã«âŠããããšããã§ãã