Creates an IPsec-VPN connection.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateVpnConnection |
The operation that you want to perform. Set the value to CreateVpnConnection. |
RegionId | String | Yes | cn-shanghai |
The ID of the region where you want to create the IPsec-VPN connection. You can call the DescribeRegions operation to query the most recent region list. |
ClientToken | String | No | 02fb3da4-130e-11e9-8e44-001**** |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
CustomerGatewayId | String | Yes | vpn-bp1q8bgx4xnk**** |
The ID of the customer gateway. |
VpnGatewayId | String | Yes | vpn-bp1q8bgx4xnkm**** |
The ID of the VPN gateway. |
Name | String | No | IPsec |
The name of the IPsec-VPN connection. The name must be 2 to 128 characters in length and can contain digits, periods (.),
underscores (_), and hyphens (-). The name must start with a letter but cannot start
with |
LocalSubnet | String | Yes | 1.1.1.0/24,1.1.2.0/24 |
The CIDR block of the virtual private cloud (VPC) that is used to connect to the data center. This CIDR block is used in Phase 2 negotiations. Separate CIDR blocks with commas (,). Example: 192.168.1.0/24,192.168.2.0/24. |
RemoteSubnet | String | Yes | 1.1.1.0/24,1.1.2.0/24 |
The CIDR block of the data center. This CIDR block is used in Phase 2 negotiations. Separate CIDR blocks with commas (,). Example: 192.168.3.0/24,192.168.4.0/24. |
EffectImmediately | Boolean | No | false |
Specifies whether to delete the current IPsec tunnel and initiate negotiations again. Valid values:
|
IkeConfig | String | No | {"IkeVersion":"ikev1","IkeMode":"main","IkeEncAlg":"aes","IkeAuthAlg":"sha1","IkePfs":"group2","IkeLifetime":86400} |
The configuration of Phase 1 negotiations:
|
IpsecConfig | String | No | {"IpsecEncAlg":"aes","IpsecAuthAlg":"sha1","IpsecPfs":"group2","IpsecLifetime":86400} |
The configuration of Phase 2 negotiations:
|
HealthCheckConfig | String | No | {"enable":"true","dip":"192.168.XX.XX","sip":"192.168.XX.XX","interval":"3","retry":"3"} |
The health check configuration:
|
AutoConfigRoute | Boolean | No | true |
Specifies whether to automatically configure routes. Valid values:
|
EnableDpd | Boolean | No | true |
Specifies whether to enable the dead peer detection (DPD) feature. Valid values:
|
EnableNatTraversal | Boolean | No | true |
Specifies whether to enable NAT traversal. Valid values:
|
BgpConfig | String | No | {"EnableBgp":"true","LocalAsn":"45104","TunnelCidr":"169.254.11.0/30","LocalBgpIp":"169.254.11.1"} |
The Border Gateway Protocol (BGP) configurations:
|
RemoteCaCertificate | String | No | c20ycDI1NnYxIENBIChURVNUIFN**** |
The certificate authority (CA) certificate of the peer when a ShangMi (SM) VPN gateway is used to create the IPsec-VPN connection.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 082AD562-B8DB-4BB2-861F-DA1FCA01FD76 |
The ID of the request. |
VpnConnectionId | String | vco-bp15oes1py4i6**** |
The ID of the IPsec-VPN connection. |
Name | String | test |
The name of the IPsec-VPN connection. |
CreateTime | Long | 1544666102000 |
The time when the IPsec-VPN connection was created. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateVpnConnection
&CustomerGatewayId=vpn-bp1q8bgx4xnk****
&LocalSubnet=1.1.1.0/24,1.1.2.0/24
&RegionId=cn-shanghai
&RemoteSubnet=1.1.1.0/24,1.1.2.0/24
&VpnGatewayId=vpn-bp1q8bgx4xnkm****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateVpnConnectionResponse>
<RequestId>082AD562-B8DB-4BB2-861F-DA1FCA01FD76</RequestId>
<VpnConnectionId>vco-bp15oes1py4i6****</VpnConnectionId>
<Name>test</Name>
<CreateTime>1544666102000</CreateTime>
</CreateVpnConnectionResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "082AD562-B8DB-4BB2-861F-DA1FCA01FD76",
"VpnConnectionId" : "vco-bp15oes1py4i6****",
"Name" : "test",
"CreateTime" : 1544666102000
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | Resource.QuotaFull | The quota of resource is full | The error message returned because the resource quota is reached. |
400 | InvalidVpnConnection.AlreadyExists | Vpn connection already exists. | The error message returned because the IPsec-VPN connection already exists. |
400 | VpnGateway.Configuring | The specified service is configuring. | The error message returned because the specified service is being configured. Try again later. |
400 | VpnGateway.FinancialLocked | The specified service is financial locked. | The error message returned because the service is suspended due to overdue payments. Top up your account before you use the service. |
400 | VpnRouteEntry.Conflict | The specified route entry has conflict. | The error message returned the specified route conflicts with an existing route. |
400 | QuotaExceeded.PolicyBasedRoute | The maximum number of policy-based routes is exceeded. Existing routes: %s. Routes to be created: %s. Maximum routes: %s. | The error message returned because the number of policy-based routes reaches the upper limit. The maximum number of routes that you can create is %s. The number of existing routes is %s. You are creating %s routes. |
400 | IllegalParam.LocalSubnet | The specified "LocalSubnet" (%s) is invalid. | The error message returned because LocalSubnet is set to an invalid value. |
400 | IllegalParam.RemoteSubnet | The specified "RemoteSubnet" (%s) is invalid. | The error message returned because RemoteSubnet is set to an invalid value. |
400 | OperationFailed.CenLevelNotSupport | When the VPC to which the VPN gateway belongs is attached to a FULL-mode CEN, the VPN gateway cannot enable BGP. | The error message returned because you cannot enable BGP for a VPN gateway when the FULL mode is enabled for the Cloud Enterprise Network (CEN) instance to which the VPC of the VPN gateway is attached. |
403 | Forbbiden.SubUser | User not authorized to operate on the specified resource as your account is created by another user. | The error message returned because you are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again. |
403 | Forbidden | User not authorized to operate on the specified resource. | The error message returned because you are unauthorized to perform this operation on the specified resource. Apply for the required permissions and try again. |
404 | InvalidCustomerGatewayInstanceId.NotFound | The specified customer gateway instance id does not exist. | The error message returned because the specified customer gateway does not exist. Check whether the ID of the customer gateway is valid. |
404 | InvalidVpnGatewayInstanceId.NotFound | The specified vpn gateway instance id does not exist. | The error message returned because the specified VPN gateway does not exist. Check whether the specified VPN gateway is valid. |
For a list of error codes, visit the API Error Center.