将 CreateCustomerGateway 与 CLI 配合使用 - Amazon Elastic Compute Cloud

CreateCustomerGateway 与 CLI 配合使用

以下代码示例演示如何使用 CreateCustomerGateway

CLI
AWS CLI

创建客户网关

此示例为其外部接口创建一个具有指定 IP 地址的客户网关。

命令:

aws ec2 create-customer-gateway --type ipsec.1 --public-ip 12.1.2.3 --bgp-asn 65534

输出:

{ "CustomerGateway": { "CustomerGatewayId": "cgw-0e11f167", "IpAddress": "12.1.2.3", "State": "available", "Type": "ipsec.1", "BgpAsn": "65534" } }
PowerShell
Tools for PowerShell V4

示例 1:此示例创建指定的客户网关。

New-EC2CustomerGateway -Type ipsec.1 -PublicIp 203.0.113.12 -BgpAsn 65534

输出:

BgpAsn : 65534 CustomerGatewayId : cgw-1a2b3c4d IpAddress : 203.0.113.12 State : available Tags : {} Type : ipsec.1
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet 参考(V4)》中的 CreateCustomerGateway

Tools for PowerShell V5

示例 1:此示例创建指定的客户网关。

New-EC2CustomerGateway -Type ipsec.1 -PublicIp 203.0.113.12 -BgpAsn 65534

输出:

BgpAsn : 65534 CustomerGatewayId : cgw-1a2b3c4d IpAddress : 203.0.113.12 State : available Tags : {} Type : ipsec.1
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet 参考(V5)》中的 CreateCustomerGateway

有关 AWS SDK 开发人员指南和代码示例的完整列表,请参阅 使用 AWS SDK 创建 Amazon EC2 资源。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。