AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
AWS Direct Connect 使用示例 AWS CLI
以下代码示例向您展示了如何使用with来执行操作和实现常见场景 AWS Direct Connect。 AWS Command Line Interface
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景的上下文查看操作。
每个示例都包含一个指向完整源代码的链接,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例演示如何使用 accept-direct-connect-gateway-association-proposal
。
- AWS CLI
-
接受网关关联提案
以下人员
accept-direct-connect-gateway-association-proposal
接受指定的提案。aws directconnect accept-direct-connect-gateway-association-proposal \ --direct-connect-gateway-id
11460968-4ac1-4fd3-bdb2-00599EXAMPLE
\ --proposal-idcb7f41cb-8128-43a5-93b1-dcaedEXAMPLE
\ --associated-gateway-owner-account111122223333
{
"directConnectGatewayAssociation":{
"directConnectGatewayId": "11460968-4ac1-4fd3-bdb2-00599EXAMPLE", "directConnectGatewayOwnerAccount": "111122223333", "associationState": "associating", "associatedGateway":{
"id": "tgw-02f776b1a7EXAMPLE", "type": "transitGateway", "ownerAccount": "111122223333", "region":"us-east-1"
},
"associationId": "6441f8bf-5917-4279-ade1-9708bEXAMPLE", "allowedPrefixesToDirectConnectGateway":[
{
"cidr":"192.168.1.0/30"
}
]
}
}
有关更多信息,请参阅 Dire AWS ct Connect 用户指南中的接受或拒绝 Transit Gateway 关联提案。
-
有关API详细信息,请参阅AWS CLI 命令参考AcceptDirectConnectGatewayAssociationProposal
中的。
-
以下代码示例演示如何使用 allocate-connection-on-interconnect
。
- AWS CLI
-
在互连上创建托管连接
以下
allocate-connection-on-interconnect
命令在互连上创建托管连接:aws directconnect allocate-connection-on-interconnect --bandwidth
500Mbps
--connection-namemydcinterconnect
--owner-account123456789012
--interconnect-iddxcon-fgktov66
--vlan101
输出:
{ "partnerName": "TIVIT", "vlan": 101, "ownerAccount": "123456789012", "connectionId": "dxcon-ffzc51m1", "connectionState": "ordering", "bandwidth": "500Mbps", "location": "TIVIT", "connectionName": "mydcinterconnect", "region": "sa-east-1" }
-
有关API详细信息,请参阅AWS CLI 命令参考AllocateConnectionOnInterconnect
中的。
-
以下代码示例演示如何使用 allocate-hosted-connection
。
- AWS CLI
-
在互连上创建托管连接
以下
allocate-hosted-connection
示例在指定的互连上创建托管连接。aws directconnect allocate-hosted-connection \ --bandwidth
500Mbps
\ --connection-namemydcinterconnect
\ --owner-account123456789012
-connection-id
dxcon-fgktov66
-vlan
101
输出:
{ "partnerName": "TIVIT", "vlan": 101, "ownerAccount": "123456789012", "connectionId": "dxcon-ffzc51m1", "connectionState": "ordering", "bandwidth": "500Mbps", "location": "TIVIT", "connectionName": "mydcinterconnect", "region": "sa-east-1" }
-
有关API详细信息,请参阅AWS CLI 命令参考AllocateHostedConnection
中的。
-
以下代码示例演示如何使用 allocate-private-virtual-interface
。
- AWS CLI
-
配置私有虚拟接口
以下
allocate-private-virtual-interface
命令配置一个由其他客户拥有的私有虚拟接口:aws directconnect allocate-private-virtual-interface --connection-id
dxcon-ffjrkx17
--owner-account123456789012
--new-private-virtual-interface-allocationvirtualInterfaceName=PrivateVirtualInterface,vlan=1000,asn=65000,authKey=asdf34example,amazonAddress=192.168.1.1/30,customerAddress=192.168.1.2/30
输出:
{ "virtualInterfaceState": "confirming", "asn": 65000, "vlan": 1000, "customerAddress": "192.168.1.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualInterfaceId": "dxvif-fgy8orxu", "authKey": "asdf34example", "routeFilterPrefixes": [], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <logical_connection id=\"dxvif-fgy8orxu\">\n <vlan>1000</vlan>\n <customer_address>192.168.1.2/30</customer_address>\n <amazon_address>192.168.1.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "192.168.1.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "PrivateVirtualInterface" }
-
有关API详细信息,请参阅AWS CLI 命令参考AllocatePrivateVirtualInterface
中的。
-
以下代码示例演示如何使用 allocate-public-virtual-interface
。
- AWS CLI
-
配置公共虚拟接口
以下
allocate-public-virtual-interface
命令配置一个由其他客户拥有的公共虚拟接口:aws directconnect allocate-public-virtual-interface --connection-id
dxcon-ffjrkx17
--owner-account123456789012
--new-public-virtual-interface-allocationvirtualInterfaceName=PublicVirtualInterface,vlan=2000,asn=65000,authKey=asdf34example,amazonAddress=203.0.113.1/30,customerAddress=203.0.113.2/30,routeFilterPrefixes=[{cidr=203.0.113.0/30},{cidr=203.0.113.4/30}]
输出:
{ "virtualInterfaceState": "confirming", "asn": 65000, "vlan": 2000, "customerAddress": "203.0.113.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualInterfaceId": "dxvif-fg9xo9vp", "authKey": "asdf34example", "routeFilterPrefixes": [ { "cidr": "203.0.113.0/30" }, { "cidr": "203.0.113.4/30" } ], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fg9xo9vp\">\n <vlan>2000</vlan>\n <customer_address>203.0.113.2/30</customer_address>\n <amazon_address>203.0.113.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>public</connection_type>\n</logical_connection>\n", "amazonAddress": "203.0.113.1/30", "virtualInterfaceType": "public", "virtualInterfaceName": "PublicVirtualInterface" }
-
有关API详细信息,请参阅AWS CLI 命令参考AllocatePublicVirtualInterface
中的。
-
以下代码示例演示如何使用 allocate-transit-virtual-interface
。
- AWS CLI
-
配置由指定 AWS 账户拥有的传输虚拟接口
以下
allocate-transit-virtual-interface
示例为指定账户配置传输虚拟接口。aws directconnect allocate-transit-virtual-interface \ --connection-id
dxlag-fEXAMPLE
\ --owner-account123456789012
\ --new-transit-virtual-interface-allocation"virtualInterfaceName=Example Transit Virtual Interface,vlan=126,asn=65110,mtu=1500,authKey=0xzxgA9YoW9h58u8SEXAMPLE,amazonAddress=192.168.1.1/30,customerAddress=192.168.1.2/30,addressFamily=ipv4,tags=[{key=Tag,value=Example}]"
输出:
{ "virtualInterface": { "ownerAccount": "123456789012", "virtualInterfaceId": "dxvif-fEXAMPLE", "location": "loc1", "connectionId": "dxlag-fEXAMPLE", "virtualInterfaceType": "transit", "virtualInterfaceName": "Example Transit Virtual Interface", "vlan": 126, "asn": 65110, "amazonSideAsn": 7224, "authKey": "0xzxgA9YoW9h58u8SEXAMPLE", "amazonAddress": "192.168.1.1/30", "customerAddress": "192.168.1.2/30", "addressFamily": "ipv4", "virtualInterfaceState": "confirming", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fEXAMPLE\">\n <vlan>126</vlan>\n <customer_address>192.168.1.2/30</customer_address>\n <amazon_address>192.168.1.1/30</amazon_address>\n <bgp_asn>65110</bgp_asn>\n <bgp_auth_key>0xzxgA9YoW9h58u8SEXAMPLE</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>transit</connection_type>\n</logical_connection>\n", "mtu": 1500, "jumboFrameCapable": true, "virtualGatewayId": "", "directConnectGatewayId": "", "routeFilterPrefixes": [], "bgpPeers": [ { "bgpPeerId": "dxpeer-fEXAMPLE", "asn": 65110, "authKey": "0xzxgA9YoW9h58u8EXAMPLE", "addressFamily": "ipv4", "amazonAddress": "192.168.1.1/30", "customerAddress": "192.168.1.2/30", "bgpPeerState": "pending", "bgpStatus": "down", "awsDeviceV2": "loc1-26wz6vEXAMPLE" } ], "region": "sa-east-1", "awsDeviceV2": "loc1-26wz6vEXAMPLE", "tags": [ { "key": "Tag", "value": "Example" } ] } }
有关更多信息,请参阅 Di AWS rect Connect 用户指南中的创建托管公交虚拟接口。
-
有关API详细信息,请参阅AWS CLI 命令参考AllocateTransitVirtualInterface
中的。
-
以下代码示例演示如何使用 associate-connection-with-lag
。
- AWS CLI
-
将连接与关联 LAG
以下示例将指定的连接与指定连接相关联LAG。
命令:
aws directconnect associate-connection-with-lag --lag-id
dxlag-fhccu14t
--connection-iddxcon-fg9607vm
输出:
{ "ownerAccount": "123456789012", "connectionId": "dxcon-fg9607vm", "lagId": "dxlag-fhccu14t", "connectionState": "requested", "bandwidth": "1Gbps", "location": "EqDC2", "connectionName": "Con2ForLag", "region": "us-east-1" }
-
有关API详细信息,请参阅AWS CLI 命令参考AssociateConnectionWithLag
中的。
-
以下代码示例演示如何使用 associate-hosted-connection
。
- AWS CLI
-
将托管连接与 LAG
以下示例将指定的托管连接与指定的LAG。
命令:
aws directconnect associate-hosted-connection --parent-connection-id
dxlag-fhccu14t
--connection-iddxcon-fg9607vm
输出:
{ "partnerName": "TIVIT", "vlan": 101, "ownerAccount": "123456789012", "connectionId": "dxcon-fg9607vm", "lagId": "dxlag-fhccu14t", "connectionState": "ordering", "bandwidth": "500Mbps", "location": "TIVIT", "connectionName": "mydcinterconnect", "region": "sa-east-1" }
-
有关API详细信息,请参阅AWS CLI 命令参考AssociateHostedConnection
中的。
-
以下代码示例演示如何使用 associate-virtual-interface
。
- AWS CLI
-
将虚拟接口与连接关联
以下示例将指定的虚拟接口与指定的虚拟接口相关联LAG。或者,要将虚拟接口与连接关联,请为其指定 Di AWS rect Connect 连接的 ID
--connection-id
;例如,dxcon-ffnikghc
。命令:
aws directconnect associate-virtual-interface --connection-id
dxlag-ffjhj9lx
--virtual-interface-iddxvif-fgputw0j
输出:
{ "virtualInterfaceState": "pending", "asn": 65000, "vlan": 123, "customerAddress": "169.254.255.2/30", "ownerAccount": "123456789012", "connectionId": "dxlag-ffjhj9lx", "addressFamily": "ipv4", "virtualGatewayId": "vgw-38e90b51", "virtualInterfaceId": "dxvif-fgputw0j", "authKey": "0x123pK5_VBqv.UQ3kJ4123_", "routeFilterPrefixes": [], "location": "CSVA1", "bgpPeers": [ { "bgpStatus": "down", "customerAddress": "169.254.255.2/30", "addressFamily": "ipv4", "authKey": "0x123pK5_VBqv.UQ3kJ4123_", "bgpPeerState": "deleting", "amazonAddress": "169.254.255.1/30", "asn": 65000 }, { "bgpStatus": "down", "customerAddress": "169.254.255.2/30", "addressFamily": "ipv4", "authKey": "0x123pK5_VBqv.UQ3kJ4123_", "bgpPeerState": "pending", "amazonAddress": "169.254.255.1/30", "asn": 65000 } ], "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fgputw0j\">\n <vlan>123</vlan>\n <customer_address>169.254.255.2/30</customer_address>\n <amazon_address>169.254.255.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>0x123pK5_VBqv.UQ3kJ4123_</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "169.254.255.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "VIF1A" }
-
有关API详细信息,请参阅AWS CLI 命令参考AssociateVirtualInterface
中的。
-
以下代码示例演示如何使用 confirm-connection
。
- AWS CLI
-
确认在互连上创建托管连接
以下
confirm-connection
命令确认在互连上创建托管连接:aws directconnect confirm-connection --connection-id
dxcon-fg2wi7hy
输出:
{ "connectionState": "pending" }
-
有关API详细信息,请参阅AWS CLI 命令参考ConfirmConnection
中的。
-
以下代码示例演示如何使用 confirm-private-virtual-interface
。
- AWS CLI
-
接受私有虚拟接口的所有权
以下
confirm-private-virtual-interface
命令接受其他客户创建的私有虚拟接口的所有权:aws directconnect confirm-private-virtual-interface --virtual-interface-id
dxvif-fgy8orxu
--virtual-gateway-idvgw-e4a47df9
输出:
{ "virtualInterfaceState": "pending" }
-
有关API详细信息,请参阅AWS CLI 命令参考ConfirmPrivateVirtualInterface
中的。
-
以下代码示例演示如何使用 confirm-public-virtual-interface
。
- AWS CLI
-
接受公共虚拟接口的所有权
以下
confirm-public-virtual-interface
命令接受其他客户创建的公共虚拟接口的所有权:aws directconnect confirm-public-virtual-interface --virtual-interface-id
dxvif-fg9xo9vp
输出:
{ "virtualInterfaceState": "verifying" }
-
有关API详细信息,请参阅AWS CLI 命令参考ConfirmPublicVirtualInterface
中的。
-
以下代码示例演示如何使用 confirm-transit-virtual-interface
。
- AWS CLI
-
接受传输虚拟接口的所有权
以下内容
confirm-transit-virtual-interface
接受其他客户创建的传输虚拟接口的所有权。aws directconnect confirm-transit-virtual-interface \ --virtual-interface-id
dxvif-fEXAMPLE
\ --direct-connect-gateway-id4112ccf9-25e9-4111-8237-b6c5dEXAMPLE
输出:
{ "virtualInterfaceState": "pending" }
有关更多信息,请参阅 Di AWS rect Connect 用户指南中的接受托管虚拟接口。
-
有关API详细信息,请参阅AWS CLI 命令参考ConfirmTransitVirtualInterface
中的。
-
以下代码示例演示如何使用 create-bgp-peer
。
- AWS CLI
-
创建对等互IPv6BGP连会话
以下示例在私有虚拟接口
dxvif-fg1vuj3d
上创建对IPv6BGP等会话。对等IPv6地址由 Amazon 自动分配。命令:
aws directconnect create-bgp-peer --virtual-interface-id
dxvif-fg1vuj3d
--new-bgp-peerasn=64600,addressFamily=ipv6
输出:
{ "virtualInterface": { "virtualInterfaceState": "available", "asn": 65000, "vlan": 125, "customerAddress": "169.254.255.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-fguhmqlc", "addressFamily": "ipv4", "virtualGatewayId": "vgw-f9eb0c90", "virtualInterfaceId": "dxvif-fg1vuj3d", "authKey": "0xC_ukbCerl6EYA0example", "routeFilterPrefixes": [], "location": "EqDC2", "bgpPeers": [ { "bgpStatus": "down", "customerAddress": "169.254.255.2/30", "addressFamily": "ipv4", "authKey": "0xC_ukbCerl6EYA0uexample", "bgpPeerState": "available", "amazonAddress": "169.254.255.1/30", "asn": 65000 }, { "bgpStatus": "down", "customerAddress": "2001:db8:1100:2f0:0:1:9cb4:4216/125", "addressFamily": "ipv6", "authKey": "0xS27kAIU_VHPjjAexample", "bgpPeerState": "pending", "amazonAddress": "2001:db8:1100:2f0:0:1:9cb4:4211/125", "asn": 64600 } ], "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fg1vuj3d\">\n <vlan>125</vlan>\n <customer_address>169.254.255.2/30</customer_address>\n <amazon_address>169.254.255.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>0xC_ukbCerl6EYA0uexample</bgp_auth_key>\n <ipv6_customer_address>2001:db8:1100:2f0:0:1:9cb4:4216/125</ipv6_customer_address>\n <ipv6_amazon_address>2001:db8:1100:2f0:0:1:9cb4:4211/125</ipv6_amazon_address>\n <ipv6_bgp_asn>64600</ipv6_bgp_asn>\n <ipv6_bgp_auth_key>0xS27kAIU_VHPjjAexample</ipv6_bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "169.254.255.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "Test" } }
-
有关API详细信息,请参阅AWS CLI 命令参考CreateBgpPeer
中的。
-
以下代码示例演示如何使用 create-connection
。
- AWS CLI
-
创建从您的网络到 Di AWS rect Connect 位置的连接
以下
create-connection
命令创建从您的网络到 Di AWS rect Connect 位置的连接:aws directconnect create-connection --location
TIVIT
--bandwidth1Gbps
--connection-name"Connection to AWS"
输出:
{ "ownerAccount": "123456789012", "connectionId": "dxcon-fg31dyv6", "connectionState": "requested", "bandwidth": "1Gbps", "location": "TIVIT", "connectionName": "Connection to AWS", "region": "sa-east-1" }
-
有关API详细信息,请参阅AWS CLI 命令参考CreateConnection
中的。
-
以下代码示例演示如何使用 create-direct-connect-gateway-association-proposal
。
- AWS CLI
-
创建将指定传输网关与指定的 Direct Connect 网关关联的提案
以下
create-direct-connect-gateway-association-proposal
示例创建了一个提案,该提案将指定的传输网关与指定的 Direct Connect 网关关联起来。aws directconnect create-direct-connect-gateway-association-proposal \ --direct-connect-gateway-id
11460968-4ac1-4fd3-bdb2-00599EXAMPLE
\ --direct-connect-gateway-owner-account111122223333
\ --gateway-idtgw-02f776b1a7EXAMPLE
\ --add-allowed-prefixes-to-direct-connect-gatewaycidr=192.168.1.0/30
输出:
{ "directConnectGatewayAssociationProposal": { "proposalId": "cb7f41cb-8128-43a5-93b1-dcaedEXAMPLE", "directConnectGatewayId": "11460968-4ac1-4fd3-bdb2-00599EXAMPLE", "directConnectGatewayOwnerAccount": "111122223333", "proposalState": "requested", "associatedGateway": { "id": "tgw-02f776b1a7EXAMPLE", "type": "transitGateway", "ownerAccount": "111122223333", "region": "us-east-1" }, "requestedAllowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.1.0/30" } ] } }
有关更多信息,请参阅 Di AWS rect Connect 用户指南中的创建 Transit Gateway 关联提案。
-
有关API详细信息,请参阅AWS CLI 命令参考CreateDirectConnectGatewayAssociationProposal
中的。
-
以下代码示例演示如何使用 create-direct-connect-gateway-association
。
- AWS CLI
-
将虚拟专用网关与 Direct Connect 网关关联
以下示例将虚拟专用网关
vgw-6efe725e
与 Direct Connect 网关相关联5f294f92-bafb-4011-916d-9b0bexample
。您必须在虚拟专用网关所在的区域中运行该命令。命令:
aws directconnect create-direct-connect-gateway-association --direct-connect-gateway-id
5f294f92-bafb-4011-916d-9b0bexample
--virtual-gateway-idvgw-6efe725e
输出:
{ "directConnectGatewayAssociation": { "associationState": "associating", "virtualGatewayOwnerAccount": "123456789012", "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bexample", "virtualGatewayId": "vgw-6efe725e", "virtualGatewayRegion": "us-east-2" } }
-
有关API详细信息,请参阅AWS CLI 命令参考CreateDirectConnectGatewayAssociation
中的。
-
以下代码示例演示如何使用 create-direct-connect-gateway
。
- AWS CLI
-
创建 Direct Connect 网关
以下示例创建了一个名为的 Direct Connect 网关
DxGateway1
。命令:
aws directconnect create-direct-connect-gateway --direct-connect-gateway-name
"DxGateway1"
输出:
{ "directConnectGateway": { "amazonSideAsn": 64512, "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bdexample", "ownerAccount": "123456789012", "directConnectGatewayName": "DxGateway1", "directConnectGatewayState": "available" } }
-
有关API详细信息,请参阅AWS CLI 命令参考CreateDirectConnectGateway
中的。
-
以下代码示例演示如何使用 create-interconnect
。
- AWS CLI
-
在合作伙伴的网络和之间建立互连 AWS
以下
create-interconnect
命令在 Direct Connect 合作伙伴的网络和特定 AWS 的 Di AWS rect Connect 位置之间创建互连:aws directconnect create-interconnect --interconnect-name
"1G Interconnect to AWS"
--bandwidth1Gbps
--locationTIVIT
输出:
{ "region": "sa-east-1", "bandwidth": "1Gbps", "location": "TIVIT", "interconnectName": "1G Interconnect to AWS", "interconnectId": "dxcon-fgktov66", "interconnectState": "requested" }
-
有关API详细信息,请参阅 “CreateInterconnect AWS CLI
命令参考”。
-
以下代码示例演示如何使用 create-lag
。
- AWS CLI
-
使用新LAG连接创建
以下示例创建了一个LAG并请求两个带宽为 1 Gbps 的新 AWS Direct Connect 连接。LAG
命令:
aws directconnect create-lag --location
CSVA1
--number-of-connections2
--connections-bandwidth1Gbps
--lag-name1GBLag
输出:
{ "awsDevice": "CSVA1-23u8tlpaz8iks", "numberOfConnections": 2, "lagState": "pending", "ownerAccount": "123456789012", "lagName": "1GBLag", "connections": [ { "ownerAccount": "123456789012", "connectionId": "dxcon-ffqr6x5q", "lagId": "dxlag-ffjhj9lx", "connectionState": "requested", "bandwidth": "1Gbps", "location": "CSVA1", "connectionName": "Requested Connection 1 for Lag dxlag-ffjhj9lx", "region": "us-east-1" }, { "ownerAccount": "123456789012", "connectionId": "dxcon-fflqyj95", "lagId": "dxlag-ffjhj9lx", "connectionState": "requested", "bandwidth": "1Gbps", "location": "CSVA1", "connectionName": "Requested Connection 2 for Lag dxlag-ffjhj9lx", "region": "us-east-1" } ], "lagId": "dxlag-ffjhj9lx", "minimumLinks": 0, "connectionsBandwidth": "1Gbps", "region": "us-east-1", "location": "CSVA1" }
LAG使用现有连接创建
以下示例根据您账户中的现有连接创建一个LAG,并请求LAG使用与现有连接相同的带宽和位置为的第二个新连接。
命令:
aws directconnect create-lag --location
EqDC2
--number-of-connections2
--connections-bandwidth1Gbps
--lag-name2ConnLAG
--connection-iddxcon-fgk145dr
输出:
{ "awsDevice": "EqDC2-4h6ce2r1bes6", "numberOfConnections": 2, "lagState": "pending", "ownerAccount": "123456789012", "lagName": "2ConnLAG", "connections": [ { "ownerAccount": "123456789012", "connectionId": "dxcon-fh6ljcvo", "lagId": "dxlag-fhccu14t", "connectionState": "requested", "bandwidth": "1Gbps", "location": "EqDC2", "connectionName": "Requested Connection 1 for Lag dxlag-fhccu14t", "region": "us-east-1" }, { "ownerAccount": "123456789012", "connectionId": "dxcon-fgk145dr", "lagId": "dxlag-fhccu14t", "connectionState": "down", "bandwidth": "1Gbps", "location": "EqDC2", "connectionName": "VAConn1", "region": "us-east-1" } ], "lagId": "dxlag-fhccu14t", "minimumLinks": 0, "connectionsBandwidth": "1Gbps", "region": "us-east-1", "location": "EqDC2" }
-
有关API详细信息,请参阅 “CreateLag AWS CLI
命令参考”。
-
以下代码示例演示如何使用 create-private-virtual-interface
。
- AWS CLI
-
创建私有虚拟接口
以下
create-private-virtual-interface
命令创建私有虚拟接口:aws directconnect create-private-virtual-interface --connection-id
dxcon-ffjrkx17
--new-private-virtual-interfacevirtualInterfaceName=PrivateVirtualInterface,vlan=101,asn=65000,authKey=asdf34example,amazonAddress=192.168.1.1/30,customerAddress=192.168.1.2/30,virtualGatewayId=vgw-aba37db6
输出:
{ "virtualInterfaceState": "pending", "asn": 65000, "vlan": 101, "customerAddress": "192.168.1.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualGatewayId": "vgw-aba37db6", "virtualInterfaceId": "dxvif-ffhhk74f", "authKey": "asdf34example", "routeFilterPrefixes": [], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-ffhhk74f\">\n <vlan>101</vlan>\n <customer_address>192.168.1.2/30</customer_address>\n <amazon_address>192.168.1.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "192.168.1.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "PrivateVirtualInterface" }
-
有关API详细信息,请参阅 “CreatePrivateVirtualInterface AWS CLI
命令参考”。
-
以下代码示例演示如何使用 create-public-virtual-interface
。
- AWS CLI
-
创建公共虚拟接口
以下
create-public-virtual-interface
命令创建公共虚拟接口:aws directconnect create-public-virtual-interface --connection-id
dxcon-ffjrkx17
--new-public-virtual-interfacevirtualInterfaceName=PublicVirtualInterface,vlan=2000,asn=65000,authKey=asdf34example,amazonAddress=203.0.113.1/30,customerAddress=203.0.113.2/30,routeFilterPrefixes=[{cidr=203.0.113.0/30},{cidr=203.0.113.4/30}]
输出:
{ "virtualInterfaceState": "verifying", "asn": 65000, "vlan": 2000, "customerAddress": "203.0.113.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualInterfaceId": "dxvif-fgh0hcrk", "authKey": "asdf34example", "routeFilterPrefixes": [ { "cidr": "203.0.113.0/30" }, { "cidr": "203.0.113.4/30" } ], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fgh0hcrk\">\n <vlan>2000</vlan>\n <customer_address>203.0.113.2/30</customer_address>\n <amazon_address>203.0.113.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>public</connection_type>\n</logical_connection>\n", "amazonAddress": "203.0.113.1/30", "virtualInterfaceType": "public", "virtualInterfaceName": "PublicVirtualInterface" }
-
有关API详细信息,请参阅 “CreatePublicVirtualInterface AWS CLI
命令参考”。
-
以下代码示例演示如何使用 create-transit-virtual-interface
。
- AWS CLI
-
创建中转虚拟接口
以下
create-transit-virtual-interface
示例为指定连接创建中转虚拟接口。aws directconnect create-transit-virtual-interface \ --connection-id
dxlag-fEXAMPLE
\ --new-transit-virtual-interface"virtualInterfaceName=Example Transit Virtual Interface,vlan=126,asn=65110,mtu=1500,authKey=0xzxgA9YoW9h58u8SvEXAMPLE,amazonAddress=192.168.1.1/30,customerAddress=192.168.1.2/30,addressFamily=ipv4,directConnectGatewayId=8384da05-13ce-4a91-aada-5a1baEXAMPLE,tags=[{key=Tag,value=Example}]"
输出:
{ "virtualInterface": { "ownerAccount": "1111222233333", "virtualInterfaceId": "dxvif-fEXAMPLE", "location": "loc1", "connectionId": "dxlag-fEXAMPLE", "virtualInterfaceType": "transit", "virtualInterfaceName": "Example Transit Virtual Interface", "vlan": 126, "asn": 65110, "amazonSideAsn": 4200000000, "authKey": "0xzxgA9YoW9h58u8SEXAMPLE", "amazonAddress": "192.168.1.1/30", "customerAddress": "192.168.1.2/30", "addressFamily": "ipv4", "virtualInterfaceState": "pending", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fEXAMPLE\">\n <vlan>126</vlan>\n <customer_address>192.168.1.2/30</customer_address>\n <amazon_address>192.168.1.1/30</amazon_address>\n <bgp_asn>65110</bgp_asn>\n <bgp_auth_key>0xzxgA9YoW9h58u8SvOmXRTw</bgp_auth_key>\n <amazon_bgp_asn>4200000000</amazon_bgp_asn>\n <connection_type>transit</connection_type>\n</logical_connection>\n", "mtu": 1500, "jumboFrameCapable": true, "virtualGatewayId": "", "directConnectGatewayId": "8384da05-13ce-4a91-aada-5a1baEXAMPLE", "routeFilterPrefixes": [], "bgpPeers": [ { "bgpPeerId": "dxpeer-EXAMPLE", "asn": 65110, "authKey": "0xzxgA9YoW9h58u8SEXAMPLE", "addressFamily": "ipv4", "amazonAddress": "192.168.1.1/30", "customerAddress": "192.168.1.2/30", "bgpPeerState": "pending", "bgpStatus": "down", "awsDeviceV2": "loc1-26wz6vEXAMPLE" } ], "region": "sa-east-1", "awsDeviceV2": "loc1-26wz6vEXAMPLE", "tags": [ { "key": "Tag", "value": "Example" } ] } }
有关更多信息,请参阅 Direct Connect 用户指南中的创建到 Direct Connect 网关的AWS 传输虚拟接口。
-
有关API详细信息,请参阅 “CreateTransitVirtualInterface AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-bgp-peer
。
- AWS CLI
-
从虚拟接口中删除BGP对等体
以下示例从虚拟接口中删除IPv6BGP对等体
dxvif-fg1vuj3d
。命令:
aws directconnect delete-bgp-peer --virtual-interface-id
dxvif-fg1vuj3d
--asn64600
--customer-address2001:db8:1100:2f0:0:1:9cb4:4216/125
输出:
{ "virtualInterface": { "virtualInterfaceState": "available", "asn": 65000, "vlan": 125, "customerAddress": "169.254.255.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-fguhmqlc", "addressFamily": "ipv4", "virtualGatewayId": "vgw-f9eb0c90", "virtualInterfaceId": "dxvif-fg1vuj3d", "authKey": "0xC_ukbCerl6EYA0example", "routeFilterPrefixes": [], "location": "EqDC2", "bgpPeers": [ { "bgpStatus": "down", "customerAddress": "169.254.255.2/30", "addressFamily": "ipv4", "authKey": "0xC_ukbCerl6EYA0uexample", "bgpPeerState": "available", "amazonAddress": "169.254.255.1/30", "asn": 65000 }, { "bgpStatus": "down", "customerAddress": "2001:db8:1100:2f0:0:1:9cb4:4216/125", "addressFamily": "ipv6", "authKey": "0xS27kAIU_VHPjjAexample", "bgpPeerState": "deleting", "amazonAddress": "2001:db8:1100:2f0:0:1:9cb4:4211/125", "asn": 64600 } ], "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fg1vuj3d\">\n <vlan>125</vlan>\n <customer_address>169.254.255.2/30</customer_address>\n <amazon_address>169.254.255.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>0xC_ukbCerl6EYA0example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "169.254.255.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "Test" } }
-
有关API详细信息,请参阅 “DeleteBgpPeer AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-connection
。
- AWS CLI
-
删除连接
以下
delete-connection
命令删除指定的连接:aws directconnect delete-connection --connection-id
dxcon-fg31dyv6
输出:
{ "ownerAccount": "123456789012", "connectionId": "dxcon-fg31dyv6", "connectionState": "deleted", "bandwidth": "1Gbps", "location": "TIVIT", "connectionName": "Connection to AWS", "region": "sa-east-1" }
-
有关API详细信息,请参阅 “DeleteConnection AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-direct-connect-gateway-association
。
- AWS CLI
-
删除 Direct Connect 网关关联
以下
delete-direct-connect-gateway-association
示例删除了与具有指定关联 ID 的传输网关的 Direct Connect 网关关联。aws directconnect delete-direct-connect-gateway-association --association-id
be85116d-46eb-4b43-a27a-da0c2ad648de
输出:
{ "directConnectGatewayAssociation": { "directConnectGatewayId": "11460968-4ac1-4fd3-bdb2-00599EXAMPlE", "directConnectGatewayOwnerAccount": "123456789012", "associationState": "disassociating", "associatedGateway": { "id": "tgw-095b3b0b54EXAMPLE", "type": "transitGateway", "ownerAccount": "123456789012", "region": "us-east-1" }, "associationId": " be85116d-46eb-4b43-a27a-da0c2ad648deEXAMPLE ", "allowedPrefixesToDirectConnectGateway": [ { "cidr": "192.0.1.0/28" } ] } }
有关更多信息,请参阅 Direc AWS t Connect 用户指南中的关联和取消关联中转网关。
-
有关API详细信息,请参阅 “DeleteDirectConnectGatewayAssociation AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-direct-connect-gateway
。
- AWS CLI
-
删除 Direct Connect 网关
以下示例删除了 Direct Connect 网关
5f294f92-bafb-4011-916d-9b0bexample
。命令:
aws directconnect delete-direct-connect-gateway --direct-connect-gateway-id
5f294f92-bafb-4011-916d-9b0bexample
输出:
{ "directConnectGateway": { "amazonSideAsn": 64512, "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bexample", "ownerAccount": "123456789012", "directConnectGatewayName": "DxGateway1", "directConnectGatewayState": "deleting" } }
-
有关API详细信息,请参阅 “DeleteDirectConnectGateway AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-interconnect
。
- AWS CLI
-
删除互连
以下
delete-interconnect
命令删除指定的互连:aws directconnect delete-interconnect --interconnect-id
dxcon-fgktov66
输出:
{ "interconnectState": "deleted" }
-
有关API详细信息,请参阅 “DeleteInterconnect AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-lag
。
- AWS CLI
-
要删除 LAG
以下示例删除指定的LAG。
命令:
aws directconnect delete-lag --lag-id
dxlag-ffrhowd9
输出:
{ "awsDevice": "EqDC2-4h6ce2r1bes6", "numberOfConnections": 0, "lagState": "deleted", "ownerAccount": "123456789012", "lagName": "TestLAG", "connections": [], "lagId": "dxlag-ffrhowd9", "minimumLinks": 0, "connectionsBandwidth": "1Gbps", "region": "us-east-1", "location": "EqDC2" }
-
有关API详细信息,请参阅 “DeleteLag AWS CLI
命令参考”。
-
以下代码示例演示如何使用 delete-virtual-interface
。
- AWS CLI
-
删除虚拟接口
以下
delete-virtual-interface
命令删除指定的虚拟接口:aws directconnect delete-virtual-interface --virtual-interface-id
dxvif-ffhhk74f
输出:
{ "virtualInterfaceState": "deleting" }
-
有关API详细信息,请参阅 “DeleteVirtualInterface AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-connection-loa
。
- AWS CLI
-
描述一下你的 LOA-CFA 用于使用 Linux 或 Mac OS X 进行连接
以下示例描述了您的 LOA-f CFA or 连接
dxcon-fh6ayh1d
。LOA-CFA 的内容采用 base64 编码。此命令使用--output
和--query
参数来控制输出并提取loaContent
结构的内容。命令的最后一部分使用该base64
实用程序对内容进行解码,并将输出发送到PDF文件中。aws directconnect describe-connection-loa --connection-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent|base64
--decode>
myLoaCfa.pdf
描述你的 LOA-CFA 用于使用 Windows 进行连接
前面的示例需要使用该
base64
实用程序来解码输出。在 Windows 计算机上,你可以certutil
改用。在以下示例中,第一个命令描述了您的 LOA-CFA for connection,dxcon-fh6ayh1d
并使用和--query
参数控制输出并将loaContent
结构的内容提取到名为的文件中myLoaCfa.base64
。--output
第二个命令使用该certutil
实用程序对文件进行解码并将输出发送到PDF文件中。aws directconnect describe-connection-loa --connection-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent
>
myLoaCfa.base64
certutil -decode myLoaCfa.base64 myLoaCfa.pdf
有关控制 AWS CLI输出的更多信息,请参阅《 AWS 命令行界面用户指南》中的通过AWS 命令行界面控制命令输出。
-
有关API详细信息,请参阅 “DescribeConnectionLoa AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-connections-on-interconnect
。
- AWS CLI
-
列出互连上的连接
以下
describe-connections-on-interconnect
命令列出了已在给定互连上置备的连接:aws directconnect describe-connections-on-interconnect --interconnect-id
dxcon-fgktov66
输出:
{ "connections": [ { "partnerName": "TIVIT", "vlan": 101, "ownerAccount": "123456789012", "connectionId": "dxcon-ffzc51m1", "connectionState": "ordering", "bandwidth": "500Mbps", "location": "TIVIT", "connectionName": "mydcinterconnect", "region": "sa-east-1" } ] }
-
有关API详细信息,请参阅 “DescribeConnectionsOnInterconnect AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-connections
。
- AWS CLI
-
列出当前区域的所有连接
以下
describe-connections
命令列出了当前区域中的所有连接:aws directconnect describe-connections
输出:
{ "connections": [ { "awsDevice": "EqDC2-123h49s71dabc", "ownerAccount": "123456789012", "connectionId": "dxcon-fguhmqlc", "lagId": "dxlag-ffrz71kw", "connectionState": "down", "bandwidth": "1Gbps", "location": "EqDC2", "connectionName": "My_Connection", "loaIssueTime": 1491568964.0, "region": "us-east-1" } ] }
-
有关API详细信息,请参阅 “DescribeConnections AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-direct-connect-gateway-association-proposals
。
- AWS CLI
-
描述您的 Direct Connect 网关关联提案
以下
describe-direct-connect-gateway-association-proposals
示例显示了有关您的 Direct Connect 网关关联提案的详细信息。aws directconnect describe-direct-connect-gateway-association-proposals
输出:
{ "directConnectGatewayAssociationProposals": [ { "proposalId": "c2ede9b4-bbc6-4d33-923c-bc4feEXAMPLE", "directConnectGatewayId": "11460968-4ac1-4fd3-bdb2-00599EXAMPLE", "directConnectGatewayOwnerAccount": "111122223333", "proposalState": "requested", "associatedGateway": { "id": "tgw-02f776b1a7EXAMPLE", "type": "transitGateway", "ownerAccount": "111122223333", "region": "us-east-1" }, "existingAllowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.2.0/30" }, { "cidr": "192.168.1.0/30" } ], "requestedAllowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.1.0/30" } ] }, { "proposalId": "cb7f41cb-8128-43a5-93b1-dcaedEXAMPLE", "directConnectGatewayId": "11560968-4ac1-4fd3-bcb2-00599EXAMPLE", "directConnectGatewayOwnerAccount": "111122223333", "proposalState": "accepted", "associatedGateway": { "id": "tgw-045776b1a7EXAMPLE", "type": "transitGateway", "ownerAccount": "111122223333", "region": "us-east-1" }, "existingAllowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.4.0/30" }, { "cidr": "192.168.5.0/30" } ], "requestedAllowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.5.0/30" } ] } ] }
有关更多信息,请参阅 Direc AWS t Connect 用户指南中的关联和取消关联中转网关。
-
有关API详细信息,请参阅 “DescribeDirectConnectGatewayAssociationProposals AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-direct-connect-gateway-associations
。
- AWS CLI
-
描述 Direct Connect 网关关联
以下示例描述了与 Direct Connect 网关的所有关联
5f294f92-bafb-4011-916d-9b0bexample
。命令:
aws directconnect describe-direct-connect-gateway-associations --direct-connect-gateway-id
5f294f92-bafb-4011-916d-9b0bexample
输出:
{ "nextToken": "eyJ2IjoxLCJzIjoxLCJpIjoiOU83OTFodzdycnZCbkN4MExHeHVwQT09IiwiYyI6InIxTEN0UEVHV0I1UFlkaWFnNlUxanJkRWF6eW1iOElHM0FRVW1MdHRJK0dxcnN1RWtvcFBKWFE2ZjRNRGdGTkhCa0tDZmVINEtZOEYwZ0dEYWZpbmU0ZnZMYVhKRjdXRVdENmdQZ1Y4d2w0PSJ9", "directConnectGatewayAssociations": [ { "associationState": "associating", "virtualGatewayOwnerAccount": "123456789012", "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bexample", "virtualGatewayId": "vgw-6efe725e", "virtualGatewayRegion": "us-east-2" }, { "associationState": "disassociating", "virtualGatewayOwnerAccount": "123456789012", "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bexample", "virtualGatewayId": "vgw-ebaa27db", "virtualGatewayRegion": "us-east-2" } ] }
-
有关API详细信息,请参阅 “DescribeDirectConnectGatewayAssociations AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-direct-connect-gateway-attachments
。
- AWS CLI
-
描述 Direct Connect 网关附件
以下示例描述了连接到 Direct Connect 网关的虚拟接口
5f294f92-bafb-4011-916d-9b0bexample
。命令:
aws directconnect describe-direct-connect-gateway-attachments --direct-connect-gateway-id
5f294f92-bafb-4011-916d-9b0bexample
输出:
{ "directConnectGatewayAttachments": [ { "virtualInterfaceOwnerAccount": "123456789012", "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bexample", "virtualInterfaceRegion": "us-east-2", "attachmentState": "attaching", "virtualInterfaceId": "dxvif-fg9zyabc" } ], "nextToken": "eyJ2IjoxLCJzIjoxLCJpIjoibEhXdlNpUXF5RzhoL1JyUW52SlV2QT09IiwiYyI6Im5wQjFHQ0RyQUdRS3puNnNXcUlINCtkTTA4dTk3KzBiU0xtb05JQmlaczZ6NXRIYmk3c3VESUxFTTd6a2FzVHM0VTFwaGJkZGNxTytqWmQ3QzMzOGRQaTVrTThrOG1zelRsV3gyMWV3VTNFPSJ9" }
-
有关API详细信息,请参阅 “DescribeDirectConnectGatewayAttachments AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-direct-connect-gateways
。
- AWS CLI
-
描述您的 Direct Connect 网关
以下示例描述了您的所有 Direct Connect 网关。
命令:
aws directconnect describe-direct-connect-gateways
输出:
{ "directConnectGateways": [ { "amazonSideAsn": 64512, "directConnectGatewayId": "cf68415c-f4ae-48f2-87a7-3b52cexample", "ownerAccount": "123456789012", "directConnectGatewayName": "DxGateway2", "directConnectGatewayState": "available" }, { "amazonSideAsn": 64512, "directConnectGatewayId": "5f294f92-bafb-4011-916d-9b0bdexample", "ownerAccount": "123456789012", "directConnectGatewayName": "DxGateway1", "directConnectGatewayState": "available" } ] }
-
有关API详细信息,请参阅 “DescribeDirectConnectGateways AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-hosted-connections
。
- AWS CLI
-
列出互连上的连接
以下示例列出了已在给定互连上置备的连接。
命令:
aws directconnect describe-hosted-connections --connection-id
dxcon-fgktov66
输出:
{ "connections": [ { "partnerName": "TIVIT", "vlan": 101, "ownerAccount": "123456789012", "connectionId": "dxcon-ffzc51m1", "connectionState": "ordering", "bandwidth": "500Mbps", "location": "TIVIT", "connectionName": "mydcinterconnect", "region": "sa-east-1" } ] }
-
有关API详细信息,请参阅 “DescribeHostedConnections AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-interconnect-loa
。
- AWS CLI
-
描述一下你的 LOA-CFA 用于使用 Linux 或 Mac OS X 的互连
以下示例描述了CFA用于互连
dxcon-fh6ayh1d
的 LOA-。LOA-CFA 的内容采用 base64 编码。此命令使用--output
和--query
参数来控制输出并提取loaContent
结构的内容。命令的最后一部分使用该base64
实用程序对内容进行解码,并将输出发送到PDF文件中。aws directconnect describe-interconnect-loa --interconnect-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent|base64
--decode>
myLoaCfa.pdf
描述一下你的 LOA-CFA 用于使用 Windows 进行互连
前面的示例需要使用该
base64
实用程序来解码输出。在 Windows 计算机上,你可以certutil
改用。在以下示例中,第一个命令描述了您的 LOA-CFA for interconnect,dxcon-fh6ayh1d
--output
并使用和--query
参数来控制输出并将loaContent
结构的内容提取到名myLoaCfa.base64
为的文件中。第二个命令使用该certutil
实用程序对文件进行解码并将输出发送到PDF文件中。aws directconnect describe-interconnect-loa --interconnect-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent
>
myLoaCfa.base64
certutil -decode myLoaCfa.base64 myLoaCfa.pdf
有关控制 AWS CLI输出的更多信息,请参阅《 AWS 命令行界面用户指南》中的通过AWS 命令行界面控制命令输出。
-
有关API详细信息,请参阅 “DescribeInterconnectLoa AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-interconnects
。
- AWS CLI
-
列出互连
以下
describe-interconnects
命令列出了您的 AWS 账户拥有的互连:aws directconnect describe-interconnects
输出:
{ "interconnects": [ { "region": "sa-east-1", "bandwidth": "1Gbps", "location": "TIVIT", "interconnectName": "1G Interconnect to AWS", "interconnectId": "dxcon-fgktov66", "interconnectState": "down" } ] }
-
有关API详细信息,请参阅 “DescribeInterconnects AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-lags
。
- AWS CLI
-
描述你的 LAGs
以下命令描述了当前区域的所有内容。LAGs
命令:
aws directconnect describe-lags
输出:
{ "lags": [ { "awsDevice": "EqDC2-19y7z3m17xpuz", "numberOfConnections": 2, "lagState": "down", "ownerAccount": "123456789012", "lagName": "DA-LAG", "connections": [ { "ownerAccount": "123456789012", "connectionId": "dxcon-ffnikghc", "lagId": "dxlag-fgsu9erb", "connectionState": "requested", "bandwidth": "10Gbps", "location": "EqDC2", "connectionName": "Requested Connection 1 for Lag dxlag-fgsu9erb", "region": "us-east-1" }, { "ownerAccount": "123456789012", "connectionId": "dxcon-fglgbdea", "lagId": "dxlag-fgsu9erb", "connectionState": "requested", "bandwidth": "10Gbps", "location": "EqDC2", "connectionName": "Requested Connection 2 for Lag dxlag-fgsu9erb", "region": "us-east-1" } ], "lagId": "dxlag-fgsu9erb", "minimumLinks": 0, "connectionsBandwidth": "10Gbps", "region": "us-east-1", "location": "EqDC2" } ] }
-
有关API详细信息,请参阅 “DescribeLags AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-loa
。
- AWS CLI
-
描述一下你的 LOA-CFA 用于使用 Linux 或 Mac OS X 进行连接
以下示例描述了您的 LOA-f CFA or 连接
dxcon-fh6ayh1d
。LOA-CFA 的内容采用 base64 编码。此命令使用--output
和--query
参数来控制输出并提取loaContent
结构的内容。命令的最后一部分使用该base64
实用程序对内容进行解码,并将输出发送到PDF文件中。aws directconnect describe-loa --connection-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent|base64
--decode>
myLoaCfa.pdf
描述你的 LOA-CFA 用于使用 Windows 进行连接
前面的示例需要使用该
base64
实用程序来解码输出。在 Windows 计算机上,你可以certutil
改用。在以下示例中,第一个命令描述了您的 LOA-CFA for connection,dxcon-fh6ayh1d
并使用和--query
参数控制输出并将loaContent
结构的内容提取到名为的文件中myLoaCfa.base64
。--output
第二个命令使用该certutil
实用程序对文件进行解码并将输出发送到PDF文件中。aws directconnect describe-loa --connection-id
dxcon-fh6ayh1d
--outputtext
--queryloa.loaContent
>
myLoaCfa.base64
certutil -decode myLoaCfa.base64 myLoaCfa.pdf
有关控制 AWS CLI输出的更多信息,请参阅《 AWS 命令行界面用户指南》中的通过AWS 命令行界面控制命令输出。
-
有关API详细信息,请参阅 “DescribeLoa AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-locations
。
- AWS CLI
-
列出 AWS Direct Connect 合作伙伴和地点
以下
describe-locations
命令列出当前区域的 AWS Direct Connect 合作伙伴和地点:aws directconnect describe-locations
输出:
{ "locations": [ { "locationName": "NAP do Brasil, Barueri, Sao Paulo", "locationCode": "TNDB" }, { "locationName": "Tivit - Site Transamerica (Sao Paulo)", "locationCode": "TIVIT" } ] }
-
有关API详细信息,请参阅 “DescribeLocations AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-tags
。
- AWS CLI
-
描述您的 Di AWS rect Connect 资源的标签
以下命令描述了连接的标签
dxcon-abcabc12
。命令:
aws directconnect describe-tags --resource-arns
arn:aws:directconnect:us-east-1:123456789012:dxcon/dxcon-abcabc12
输出:
{ "resourceTags": [ { "resourceArn": "arn:aws:directconnect:us-east-1:123456789012:dxcon/dxcon-abcabc12", "tags": [ { "value": "VAConnection", "key": "Name" } ] } ] }
-
有关API详细信息,请参阅 “DescribeTags AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-virtual-gateways
。
- AWS CLI
-
列出虚拟专用网关
以下
describe-virtual-gateways
命令列出了您的 AWS 账户拥有的虚拟专用网关:aws directconnect describe-virtual-gateways
输出:
{ "virtualGateways": [ { "virtualGatewayId": "vgw-aba37db6", "virtualGatewayState": "available" } ] }
-
有关API详细信息,请参阅 “DescribeVirtualGateways AWS CLI
命令参考”。
-
以下代码示例演示如何使用 describe-virtual-interfaces
。
- AWS CLI
-
列出所有虚拟接口
以下
describe-virtual-interfaces
命令列出了与您的 AWS 账户关联的所有虚拟接口的相关信息:aws directconnect describe-virtual-interfaces --connection-id
dxcon-ffjrkx17
输出:
{ "virtualInterfaces": [ { "virtualInterfaceState": "down", "asn": 65000, "vlan": 101, "customerAddress": "192.168.1.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualGatewayId": "vgw-aba37db6", "virtualInterfaceId": "dxvif-ffhhk74f", "authKey": "asdf34example", "routeFilterPrefixes": [], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-ffhhk74f\">\n <vlan>101</vlan>\n <customer_address>192.168.1.2/30</customer_address>\n <amazon_address>192.168.1.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>private</connection_type>\n</logical_connection>\n", "amazonAddress": "192.168.1.1/30", "virtualInterfaceType": "private", "virtualInterfaceName": "PrivateVirtualInterface" }, { "virtualInterfaceState": "verifying", "asn": 65000, "vlan": 2000, "customerAddress": "203.0.113.2/30", "ownerAccount": "123456789012", "connectionId": "dxcon-ffjrkx17", "virtualGatewayId": "", "virtualInterfaceId": "dxvif-fgh0hcrk", "authKey": "asdf34example", "routeFilterPrefixes": [ { "cidr": "203.0.113.4/30" }, { "cidr": "203.0.113.0/30" } ], "location": "TIVIT", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fgh0hcrk\">\n <vlan>2000</vlan>\n <customer_address>203.0.113.2/30</customer_address>\n <amazon_address>203.0.113.1/30</amazon_address>\n <bgp_asn>65000</bgp_asn>\n <bgp_auth_key>asdf34example</bgp_auth_key>\n <amazon_bgp_asn>7224</amazon_bgp_asn>\n <connection_type>public</connection_type>\n</logical_connection>\n", "amazonAddress": "203.0.113.1/30", "virtualInterfaceType": "public", "virtualInterfaceName": "PublicVirtualInterface" } ] }
-
有关API详细信息,请参阅 “DescribeVirtualInterfaces AWS CLI
命令参考”。
-
以下代码示例演示如何使用 disassociate-connection-from-lag
。
- AWS CLI
-
取消连接与的关联 LAG
以下示例取消指定连接与指定连接的关联。LAG
命令:
aws directconnect disassociate-connection-from-lag --lag-id
dxlag-fhccu14t
--connection-iddxcon-fg9607vm
输出:
{ "ownerAccount": "123456789012", "connectionId": "dxcon-fg9607vm", "connectionState": "requested", "bandwidth": "1Gbps", "location": "EqDC2", "connectionName": "Con2ForLag", "region": "us-east-1" }
-
有关API详细信息,请参阅 “DisassociateConnectionFromLag AWS CLI
命令参考”。
-
以下代码示例演示如何使用 tag-resource
。
- AWS CLI
-
向 Di AWS rect Connect 资源添加标签
以下命令向连接添加一个密钥为
Name
、值VAConnection
为的标签dxcon-abcabc12
。如果命令成功,则不返回任何输出。命令:
aws directconnect tag-resource --resource-arn
arn:aws:directconnect:us-east-1:123456789012:dxcon/dxcon-abcabc12
--tags"key=Name,value=VAConnection"
-
有关API详细信息,请参阅 “TagResource AWS CLI
命令参考”。
-
以下代码示例演示如何使用 untag-resource
。
- AWS CLI
-
从 Di AWS rect Connect 资源中移除标签
以下命令
Name
从连接中删除带有密钥的标签dxcon-abcabc12
。如果命令成功,则不返回任何输出。命令:
aws directconnect untag-resource --resource-arn
arn:aws:directconnect:us-east-1:123456789012:dxcon/dxcon-abcabc12
--tag-keysName
-
有关API详细信息,请参阅 “UntagResource AWS CLI
命令参考”。
-
以下代码示例演示如何使用 update-direct-connect-gateway-association
。
- AWS CLI
-
更新 Direct Connect 网关关联的指定属性
以下
update-direct-connect-gateway-association
示例将指定的CIDR区块添加到 Direct Connect 网关关联。aws directconnect update-direct-connect-gateway-association \ --association-id
820a6e4f-5374-4004-8317-3f64bEXAMPLE
\ --add-allowed-prefixes-to-direct-connect-gatewaycidr=192.168.2.0/30
输出:
{ "directConnectGatewayAssociation": { "directConnectGatewayId": "11460968-4ac1-4fd3-bdb2-00599EXAMPLE", "directConnectGatewayOwnerAccount": "111122223333", "associationState": "updating", "associatedGateway": { "id": "tgw-02f776b1a7EXAMPLE", "type": "transitGateway", "ownerAccount": "111122223333", "region": "us-east-1" }, "associationId": "820a6e4f-5374-4004-8317-3f64bEXAMPLE", "allowedPrefixesToDirectConnectGateway": [ { "cidr": "192.168.2.0/30" }, { "cidr": "192.168.1.0/30" } ] } }
有关更多信息,请参阅 Di rect Connect 用户指南中的使用 Di AWS rect Connect 网关。
-
有关API详细信息,请参阅 “UpdateDirectConnectGatewayAssociation AWS CLI
命令参考”。
-
以下代码示例演示如何使用 update-lag
。
- AWS CLI
-
要更新 LAG
以下示例更改了指定的名称LAG。
命令:
aws directconnect update-lag --lag-id
dxlag-ffjhj9lx
--lag-name2ConnLag
输出:
{ "awsDevice": "CSVA1-23u8tlpaz8iks", "numberOfConnections": 2, "lagState": "down", "ownerAccount": "123456789012", "lagName": "2ConnLag", "connections": [ { "ownerAccount": "123456789012", "connectionId": "dxcon-fflqyj95", "lagId": "dxlag-ffjhj9lx", "connectionState": "requested", "bandwidth": "1Gbps", "location": "CSVA1", "connectionName": "Requested Connection 2 for Lag dxlag-ffjhj9lx", "region": "us-east-1" }, { "ownerAccount": "123456789012", "connectionId": "dxcon-ffqr6x5q", "lagId": "dxlag-ffjhj9lx", "connectionState": "requested", "bandwidth": "1Gbps", "location": "CSVA1", "connectionName": "Requested Connection 1 for Lag dxlag-ffjhj9lx", "region": "us-east-1" } ], "lagId": "dxlag-ffjhj9lx", "minimumLinks": 0, "connectionsBandwidth": "1Gbps", "region": "us-east-1", "location": "CSVA1" }
-
有关API详细信息,请参阅 “UpdateLag AWS CLI
命令参考”。
-
以下代码示例演示如何使用 update-virtual-interface-attributes
。
- AWS CLI
-
更新虚拟接口的 MTU
以下
update-virtual-interface-attributes
示例更新MTU了指定虚拟接口的。aws directconnect update-virtual-interface-attributes \ --virtual-interface-id
dxvif-fEXAMPLE
\ --mtu1500
输出:
{ "ownerAccount": "1111222233333", "virtualInterfaceId": "dxvif-fEXAMPLE", "location": "loc1", "connectionId": "dxlag-fEXAMPLE", "virtualInterfaceType": "transit", "virtualInterfaceName": "example transit virtual interface", "vlan": 125, "asn": 650001, "amazonSideAsn": 64512, "authKey": "0xzxgA9YoW9h58u8SEXAMPLE", "amazonAddress": "169.254.248.1/30", "customerAddress": "169.254.248.2/30", "addressFamily": "ipv4", "virtualInterfaceState": "down", "customerRouterConfig": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<logical_connection id=\"dxvif-fEXAMPLE\">\n <vlan>125</vlan>\n <customer_address>169.254.248.2/30</customer_address>\n <amazon_address>169.254.248.1/30</amazon_address>\n <bgp_asn>650001</bgp_asn>\n <bgp_auth_key>0xzxgA9YoW9h58u8SEXAMPLE</bgp_auth_key>\n <amazon_bgp_asn>64512</amazon_bgp_asn>\n <connection_type>transit</connection_type>\n</logical_connection>\n", "mtu": 1500, "jumboFrameCapable": true, "virtualGatewayId": "", "directConnectGatewayId": "879b76a1-403d-4700-8b53-4a56ed85436e", "routeFilterPrefixes": [], "bgpPeers": [ { "bgpPeerId": "dxpeer-fEXAMPLE", "asn": 650001, "authKey": "0xzxgA9YoW9h58u8SEXAMPLE", "addressFamily": "ipv4", "amazonAddress": "169.254.248.1/30", "customerAddress": "169.254.248.2/30", "bgpPeerState": "available", "bgpStatus": "down", "awsDeviceV2": "loc1-26wz6vEXAMPLE" } ], "region": "sa-east-1", "awsDeviceV2": "loc1-26wz6vEXAMPLE", "tags": [] }
有关更多信息,请参阅 Di AWS rect Connect 用户指南中的MTU为私有虚拟接口或传输虚拟接口设置网络。
-
有关API详细信息,请参阅 “UpdateVirtualInterfaceAttributes AWS CLI
命令参考”。
-