Creates a VPN gateway.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateVpnGateway

The operation that you want to perform. Set the value to CreateVpnGateway.

RegionId String Yes cn-hangzhou

The region ID of the VPN gateway. You can call the DescribeRegions operation to query the most recent region list.

Name String No MYVPN

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, and can contain digits, underscores (_), and hyphens (-). It must start with a letter.

VpcId String Yes vpc-bp1ub1yt9cvakoelj****

The ID of the virtual private cloud (VPC) where you want to create the VPN gateway.

InstanceChargeType String No Example value for the Alibaba Cloud China site: PREPAY. Example value for the Alibaba Cloud International site: POSTPAY.

The billing method of the VPN gateway. Set the value to POSTPAY, which specifies the pay-as-you-go billing method.

Note This parameter is required when you create a VPN gateway.
Period Integer No 1

The subscription duration. Unit: months. Valid values: 1 to 9, 12, 24, and 36.

Note If the InstanceChargeType parameter is set to PREPAY, this parameter is required.
AutoPay Boolean No false

Specifies whether to enable automatic payment for the VPN gateway. Valid values:

  • true: yes
  • false (default): no
Bandwidth Integer Yes 5

The public bandwidth of the VPN gateway. Unit: Mbit/s.

Valid values: 5, 10, 20, 50, 100, and 200.

EnableIpsec Boolean No true

Specifies whether to enable the IPsec-VPN feature. Valid values:

  • true (default): yes
  • false: no
EnableSsl Boolean No false

Specifies whether to enable the SSL-VPN feature for the VPN gateway. Valid values:

  • true: yes
  • false (default): no
SslConnections Integer No 5

The maximum number of clients that can be connected at the same time. Valid values: 5, 10, and 20.

VSwitchId String No vsw-bp1j5miw2bae9s2vt****

The ID of the vSwitch to which the VPN gateway belongs.

VpnType String No Normal

The type of the VPN gateway. Valid values:

  • Normal (default): standard
  • NationalStandard: ShangMi (SM)
ClientToken String No 02fb3da4****

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. ClientToken can contain only ASCII characters.

NetworkType String No public

The network type of the VPN gateway. Valid values:

  • public (default): public VPN gateway
  • private: private VPN gateway

Response parameters

Parameter Type Example Description
VpnGatewayId String vpn-uf68lxhgr7ftbqr3p****

The ID of the VPN gateway.

RequestId String EB2C156A-41F8-49CC-A756-D55AFC8BFD69

The ID of the request.

Name String vpn-uf68lxhgr7ftbqr3p****

The name of the VPN gateway.

OrderId Long 208240895400460

The ID of the order.

If automatic payment is disabled, you must manually complete the payment for the VPN gateway in the Alibaba Cloud Management console.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateVpnGateway
&RegionId=cn-hangzhou
&Name=MYVPN
&VpcId=vpc-bp1ub1yt9cvakoelj****
&InstanceChargeType=PREPAY
&Period=1
&AutoPay=false
&Bandwidth=5
&EnableIpsec=true
&EnableSsl=true
&SslConnections=5
&VSwitchId=vsw-bp1j5miw2bae9s2vt****
&VpnType=Normal
&ClientToken=02fb3da4****
&NetworkType=public
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateVpnGatewayResponse>
<RequestId>EB2C156A-41F8-49CC-A756-D55AFC8BFD69</RequestId>
<VpnGatewayId>vpn-uf68lxhgr7ftbqr3p****</VpnGatewayId>
<OrderId>208240895400460</OrderId>
<Name>vpn-uf68lxhgr7ftbqr3p****</Name>
</CreateVpnGatewayResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "EB2C156A-41F8-49CC-A756-D55AFC8BFD69",
  "VpnGatewayId" : "vpn-uf68lxhgr7ftbqr3p****",
  "OrderId" : 208240895400460,
  "Name" : "vpn-uf68lxhgr7ftbqr3p****"
}

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.

For a list of error codes, visit the API Error Center.