调用CreateVpnGateway接口创建VPN网关。
接口说明
-
在您创建 VPN 网关前,建议您先了解 VPN 网关的使用限制。更多信息,请参见 VPN 网关使用限制。
-
部分地域的 VPN 网关实例默认仅支持创建双隧道模式 IPsec-VPN 连接,您在这些地域调用
CreateVpnGateway接口创建 VPN 网关实例时,除了需要输入必填参数外,还需要输入 VSwitchId 和 DisasterRecoveryVSwitchId 参数的值。关于支持双隧道模式 IPsec-VPN 连接的地域和可用区信息,请参见IPsec-VPN 连接升级为双隧道模式。 -
CreateVpnGateway 接口属于异步接口,即系统先返回一个实例 ID,但该 VPN 网关尚未创建成功,系统后台的创建任务仍在进行。您可以调用 DescribeVpnGateway 查询 VPN 网关的创建状态:
当 VPN 网关处于 provisioning 状态时,表示 VPN 网关正在创建中。
当 VPN 网关处于 active 状态时,表示 VPN 网关创建成功。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
vpc:CreateVpnGateway |
create |
*VpnGateway
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
VPN 网关所在的地域。您可以通过调用 DescribeRegions 接口获取地域 ID。 |
cn-hangzhou |
| Name |
string |
否 |
VPN 网关的名称,默认值为 VPN 网关的 ID。 长度为 2~100 个字符,不能以 |
MYVPN |
| VpcId |
string |
是 |
VPN 网关所属的 VPC 实例 ID。 |
vpc-bp1ub1yt9cvakoelj**** |
| InstanceChargeType |
string |
否 |
VPN 网关的计费方式。仅取值:POSTPAY,按量计费。 |
中国站示例值:PREPAY,国际站示例值:POSTPAY |
| Period |
integer |
否 |
购买时长。单位:月。取值:1~9、12、24 或 36。 |
1 |
| AutoPay |
boolean |
否 |
是否自动支付 VPN 网关的账单。取值:
说明
为了成功创建 VPN 网关实例,建议您开启自动支付。如果您关闭了自动支付,则需要手动支付账单才能成功创建 VPN 网关实例。 |
false |
| Bandwidth |
integer |
是 |
VPN 网关的带宽规格。单位:Mbps。
说明
部分地域下 VPN 网关支持的最大带宽规格为 500 Mbps。更多信息,请参见 VPN 网关使用限制。 |
5 |
| EnableIpsec |
boolean |
否 |
是否开启 IPsec-VPN 功能。取值:
|
true |
| EnableSsl |
boolean |
否 |
是否开启 SSL-VPN 功能。取值:
|
false |
| SslConnections |
integer |
否 |
允许同时连接的最大客户端数量。取值:5(默认值)、10、20、50、100、200、500、1000。 |
5 |
| VSwitchId |
string |
否 |
指定 VPN 网关实例关联的交换机实例。
|
vsw-bp1j5miw2bae9s2vt**** |
| VpnType |
string |
否 |
VPN 网关类型。取值:
|
Normal |
| ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。 |
02fb3da4**** |
| NetworkType |
string |
否 |
VPN 网关的网络类型。取值:
|
public |
| DisasterRecoveryVSwitchId |
string |
否 |
指定 VPN 网关实例关联的第二个交换机实例。
关于支持双隧道模式 IPsec-VPN 连接的地域和可用区的信息,请参见IPsec-VPN 连接升级为双隧道模式。 |
vsw-p0wiz7obm0tbimu4r**** |
| ResourceGroupId |
string |
否 |
VPN 网关所属的资源组 ID。
|
rg-acfmzs372yg**** |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| VpnGatewayId |
string |
VPN 网关实例 ID。 |
vpn-uf68lxhgr7ftbqr3p**** |
| RequestId |
string |
请求 ID。 |
EB2C156A-41F8-49CC-A756-D55AFC8BFD69 |
| Name |
string |
VPN 网关的名称。 |
MYVPN |
| OrderId |
integer |
订单 ID。 如果您未选择自动支付 VPN 网关的账单,请前往阿里云费用与成本完成支付。 |
208240895400460 |
示例
正常返回示例
JSON格式
{
"VpnGatewayId": "vpn-uf68lxhgr7ftbqr3p****",
"RequestId": "EB2C156A-41F8-49CC-A756-D55AFC8BFD69",
"Name": "MYVPN",
"OrderId": 208240895400460
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidVpcId.NotFound | The specified VPC id does not exist in our records. | |
| 400 | InvalidName | The specified value of Name not supported. | |
| 400 | InvalidSpec.NotFound | The specified Spec does not exist in our records. | |
| 400 | InvalidPeriod | The specified period is not valid | |
| 400 | ChargeType.NotSupport | The specified charge type is not support. | |
| 400 | InventoryNotEnough | The inventory is not enough. | |
| 400 | UnnecessarySslConnection | The SSL connection is unnecessary for ssl vpn disabled. | |
| 400 | InvalidVpnEnable | Either IPsec or SSL VPN must be set enable. | |
| 400 | Resource.QuotaFull | The quota of resource is full | |
| 400 | InvalidVSwitchId.NotFound | The specified vswitchId is not found. | |
| 400 | OperationFailed.InventoryNotEnough | No enough available resource. Try another vswitch with different available zone. | |
| 400 | Forbidden.OperateShareResource | Operating shared resources is forbidden. | |
| 400 | OperationFailed.IpNotEnough | Operation failed because private ip address of the virtual switch is not enough. | |
| 400 | Forbidden.NoSLRPermission | User not authorized to create service linked role. | |
| 400 | OperationFailed.VSwitchConflict | The vswitch can't create vpn. Try another vswitch. | |
| 400 | OperationFailed.AzNotSupport | Current available zone can't create vpn. Try another vswitch with different available zone. | |
| 400 | OperationFailed.NetworkTypeNotMatch | Create NationalStandard vpn with private networkType is unsupported. | |
| 400 | OperationFailed.SslNotSupport | Enable ssl vpn with private networkType is unsupported. | 私网类型VPN网关不支持开启SSL功能。 |
| 400 | Forbidden.TagKey.Duplicated | The specified tag key already exists. | 标签资源重复 |
| 400 | SizeLimitExceeded.TagNum | The maximum number of tags is exceeded. | 标签数量超限 |
| 400 | InvalidParameter.TagValue | The specified parameter TagValue is invalid. | 指定的参数TagValue不合规范。 |
| 400 | InvalidParameter.TagKey | The specified parameter TagKey is invalid. | 指定的参数TagKey不合规范。 |
| 400 | Duplicated.TagKey | The specified parameter TagKey is duplicated. | 指定的参数TagKey重复。 |
| 400 | InternalError | The request processing has failed due to some unknown error, exception or failure. | |
| 400 | InvalidVSwitchId.FirstVswitchNotSupport | The available zone of vswitch1 not supported. | 主vSwitch所在可用区不支持。 |
| 400 | InvalidVSwitchId.VswitchIdShouldDifferent | The VSwitch ids should be different. | 主备可用区不能相同。 |
| 400 | InvalidVSwitchId.FirstVswitchIpNotEnough | The ip of vswitch1 not enough. | 主vSwitch中可用IP数量不足。 |
| 400 | InvalidVSwitchId.SecondVswitchIpNotEnough | The ip of vswitch2 not enough. | 备vSwitch中的可用IP不足。 |
| 400 | InvalidVSwitchId.ZoneIdShouldDifferent | Two vSwitches should belong to different Availability Zones. | 创建双隧道VPN时指定的两个虚拟交换机必须要属于不同可用区 |
| 400 | MissingParam.VSwitchId | The parameter VSwitchId is missing. | 参数VSwitchId缺失 |
| 400 | MissingParam.DisasterRecoveryVSwitchId | The parameter DisasterRecoveryVSwitchId is missing. | 参数DisasterRecoveryVSwitchId缺失。 |
| 400 | InvalidDisasterRecoveryVSwitchId.NotFound | The specified DisasterRecoveryVSwitchId does not exist in the specified region. | 该交换机在该地域内不存在。 |
| 400 | InvalidVSwitchId.SecondVswitchNotSupport | The zone of the DisasterRecoveryVSwitch does not support creating a ha-tunnel VPN. | 备可用区虚拟交换机所在可用区不支持创建双隧道VPN,请更换虚拟交换机。 |
| 404 | InvalidRegionId.NotFound | The specified region is not found during access authentication. | 接入认证时未找到指定区域。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。