Creates a VPN gateway by calling the CreateVpnGateway operation.
Operation description
-
Before you create a VPN gateway, we recommend that you familiarize yourself with the limits of VPN gateways. For more information, see VPN gateway limits.
-
VPN gateway instances in some regions support only dual-tunnel mode IPsec-VPN connections by default. When you call the
CreateVpnGatewayoperation to create a VPN gateway instance in these regions, you must specify the VSwitchId and DisasterRecoveryVSwitchId parameters in addition to the required parameters. For information about the regions and zones that support dual-tunnel mode IPsec-VPN connections, see Upgrade an IPsec-VPN connection to dual-tunnel mode. -
CreateVpnGateway is an asynchronous operation. After you call this operation, the system returns an instance ID, but the VPN gateway is not yet created. The creation task is still running in the background. You can call DescribeVpnGateway to query the creation status of the VPN gateway:
If the VPN gateway is in the provisioning state, the VPN gateway is being created.
If the VPN gateway is in the active state, the VPN gateway is created.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:CreateVpnGateway |
create |
*VpnGateway
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the VPN gateway. You can call the DescribeRegions operation to query the region ID. |
cn-hangzhou |
| Name |
string |
No |
The name of the VPN gateway. The default value is the ID of the VPN gateway. The name must be 2 to 100 characters in length. It cannot start with |
MYVPN |
| VpcId |
string |
Yes |
The ID of the VPC-connected instance to which the VPN gateway belongs. |
vpc-bp1ub1yt9cvakoelj**** |
| InstanceChargeType |
string |
No |
The billing method of the VPN gateway. Set the value to POSTPAY, which specifies the pay-as-you-go billing method. |
中国站示例值:PREPAY,国际站示例值:POSTPAY |
| Period |
integer |
No |
The subscription duration. Unit: months. Valid values: 1 to 9, 12, 24, and 36. |
1 |
| AutoPay |
boolean |
No |
Specifies whether to automatically pay the bill for the VPN gateway. Valid values:
Note
To successfully create a VPN gateway instance, enable automatic payment. If you disable automatic payment, you must manually pay the bill to create the VPN gateway instance. |
false |
| Bandwidth |
integer |
Yes |
The bandwidth specification of the VPN gateway. Unit: Mbit/s.
Note
The maximum bandwidth specification supported by VPN gateways in some regions is 500 Mbit/s. For more information, see VPN gateway limits. |
5 |
| EnableIpsec |
boolean |
No |
Specifies whether to enable the IPsec-VPN feature. Valid values:
|
true |
| EnableSsl |
boolean |
No |
Specifies whether to enable the SSL-VPN feature. Valid values:
|
false |
| SslConnections |
integer |
No |
The maximum number of clients that can be simultaneously connected. Valid values: 5 (default), 10, 20, 50, 100, 200, 500, and 1000. |
5 |
| VSwitchId |
string |
No |
The vSwitch associated with the VPN gateway instance.
|
vsw-bp1j5miw2bae9s2vt**** |
| VpnType |
string |
No |
The type of the VPN gateway. Valid values:
|
Normal |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The client token can contain only ASCII characters. Note
If you do not specify this parameter, the system uses the RequestId of the API request as the ClientToken. The RequestId may be different for each API request. |
02fb3da4**** |
| NetworkType |
string |
No |
The network type of the VPN gateway. Valid values:
|
public |
| DisasterRecoveryVSwitchId |
string |
No |
The second vSwitch associated with the VPN VPC-connected instance.
For information about the regions and zones that support dual-tunnel mode IPsec-VPN connections, see Upgrade an IPsec-VPN connection to dual-tunnel mode. |
vsw-p0wiz7obm0tbimu4r**** |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the VPN gateway belongs.
|
rg-acfmzs372yg**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response parameters. |
||
| VpnGatewayId |
string |
The instance ID of the VPN gateway. |
vpn-uf68lxhgr7ftbqr3p**** |
| RequestId |
string |
The request ID. |
EB2C156A-41F8-49CC-A756-D55AFC8BFD69 |
| Name |
string |
The name of the VPN gateway. |
MYVPN |
| OrderId |
integer |
The order ID. If you did not enable automatic payment for the VPN gateway bill, go to Expenses and Costs to complete the payment.. |
208240895400460 |
Examples
Success response
JSON format
{
"VpnGatewayId": "vpn-uf68lxhgr7ftbqr3p****",
"RequestId": "EB2C156A-41F8-49CC-A756-D55AFC8BFD69",
"Name": "MYVPN",
"OrderId": 208240895400460
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. | You cannot enable the SSL feature for a private VPN gateway. |
| 400 | Forbidden.TagKey.Duplicated | The specified tag key already exists. | The tag resources are duplicate. |
| 400 | SizeLimitExceeded.TagNum | The maximum number of tags is exceeded. | The number of tags has reached the upper limit. |
| 400 | InvalidParameter.TagValue | The specified parameter TagValue is invalid. | The error message returned because the specified tag value is invalid. |
| 400 | InvalidParameter.TagKey | The specified parameter TagKey is invalid. | The error message returned because the specified tag key is invalid. |
| 400 | Duplicated.TagKey | The specified parameter TagKey is duplicated. | The error message returned because the specified tag key already exists. |
| 400 | InternalError | The request processing has failed due to some unknown error, exception or failure. | |
| 400 | InvalidVSwitchId.SecondVswitchNotSupport | The available zone of vswitch2 not supported. | The zone of the secondary vSwitch does not support the feature. |
| 400 | InvalidVSwitchId.FirstVswitchNotSupport | The available zone of vswitch1 not supported. | The zone where the primary vSwitch is located is not supported. |
| 400 | InvalidVSwitchId.VswitchIdShouldDifferent | The VSwitch ids should be different. | The primary zone cannot be the same as the secondary zone. |
| 400 | InvalidVSwitchId.FirstVswitchIpNotEnough | The ip of vswitch1 not enough. | Insufficient number of available IPs in primary vSwitch. |
| 400 | InvalidVSwitchId.SecondVswitchIpNotEnough | The ip of vswitch2 not enough. | Insufficient IP addresses are available in the standby vSwitch. |
| 400 | InvalidVSwitchId.ZoneIdShouldDifferent | Two vSwitches should belong to different Availability Zones. | When you create a dual-tunnel VPN gateway, the two vSwitches that you specify must belong to different zones. |
| 404 | InvalidRegionId.NotFound | The specified region is not found during access authentication. | The specified area is not found during authentication. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.