You can call this operation to create 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.

Bandwidth Integer Yes 5

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

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

RegionId String Yes cn-hangzhou

The ID of the region where the VPN gateway is located. You can call DescribeRegionsto retrieve a list of region IDs.

VpcId String Yes vpc-bp1ub1yt9cvakoelj****

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

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 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or Chinese character and cannot start with http://orhttps://.

InstanceChargeType String No Example for China site: PREPAY. Example for international site: POSTPAY

The billing method of the VPN gateway. Set the value to POSTPAY, which indicates the subscription billing method:( Pay-As-You-Go).

Period Integer No 1

The subscription period. Valid values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, and 36.

Note If InstanceChargeType is set toPREPAY, this parameter is required.
AutoPay Boolean No false

Specifies whether the bills for the VPN Gateway are paid automatically. Valid values:

  • true: Bills are paid automatically.
  • false (default): Bills are not paid automatically
EnableIpsec Boolean No true

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

  • true(default): enables the IPsec-VPN feature.
  • false: disables the IPsec-VPN feature.
EnableSsl Boolean No true

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

  • true: enables the SSL-VPN feature.
  • false (default): disables the SSL-VPN feature.
SslConnections Integer No 5

The maximum number of clients that can be connected simultaneously. Valid values: 5,10, and20.

VSwitchId String No vsw-bp1j5miw2bae9s2vt****

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

Response parameters

Parameter Type Example Description
Name String myVpn

The name of the VPN gateway.

OrderId Long 20224940022015

The ID of the order. You can pay for the order in the console.

RequestId String 54B48E3D-DF70-471B-AA93-08E683A1B457

The ID of the request.

VpnGatewayId String vpn-bp1q8bgx4xnkm2ogj****

The ID of the VPN gateway.

Examples

Sample requests

http(s)://vpc.aliyuncs.com/? Action=CreateVpnGateway
&Bandwidth=5
&RegionId=cn-hangzhou
&VpcId=vpc-bp1ub1yt9cvakoelj****
&<Common request parameters>

Sample success responses

XML format

<CreateVpnGatewayResponse>
      <Name>myVpn</Name>
      <VpnGatewayId>vpn-bp1q8bgx4xnkm2ogj****</VpnGatewayId>
      <RequestId>54B48E3D-DF70-471B-AA93-08E683A1B457</RequestId>
</CreateVpnGatewayResponse>

JSON format

{
    "CreateVpnGatewayResponse": {
        "Name": "myVpn",
        "VpnGatewayId": "vpn-bp1q8bgx4xnkm2ogj****",
        "RequestId": "54B48E3D-DF70-471B-AA93-08E683A1B457"
    }
}

Error codes

HTTP status code Error code Error message Description
400 Resource.QuotaFull The quota of resource is full The error message returned because the resource quota has reached the upper limit.

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