You can call this operation to create a customer 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 CreateCustomerGateway

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

IpAddress String Yes 116.xx.xx.12

The public IP address of the VPN gateway in the on-premises data center.

RegionId String Yes cn-shanghai

The region ID of the customer gateway.

You can call the DescribeRegions operation to query the region ID.

ClientToken String No 02fb3da4-130e-11e9-8e44-0016e04115b

The client token that is used to ensure the idempotence of the request.

The value of this parameter is generated by the client. The value must be unique among different requests and must be 1 to 64 ASCII characters in length.

Name String No Gateway

The name of the customer gateway.

The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, periods (.), underscores (_), and hyphens (-). The value cannot start with http:// or https://.

Description String No Gateway

The description of the customer gateway.

The description must be 2 to 256 characters in length. It must start with a letter or Chinese character and cannot start with http:// or https://.

Asn String No 10001

The autonomous system number of the on-premises data center.

Response parameters

Parameter Type Example Description
CustomerGatewayId String cgw-bp1aw0a5nfff03xp1****

The ID of the customer gateway.

IpAddress String 101.xx.xx.12

The public IP address of the VPN Gateway in the on-premises data center.

Name String test

The name of the customer gateway.

Description String test

The description of the customer gateway.

CreateTime Long 1493363486000

The time when the customer gateway was created.

RequestId String cgw-bp1aw0a5nfff03xp1pcqc

The ID of the request.

Examples

Sample requests

https://vpc.aliyuncs.com/?Action=CreateCustomerGateway
&IpAddress=116.xx.xx.12
&RegionId=cn-shanghai
&<Common request parameter>

Sample success response

XML format

<CreateCustomerGatewayResponse>
      <CustomerGatewayId>cgw-bp1aw0a5nfff03xp****</CustomerGatewayId>
      <RequestId>185E81B1-3916-4667-B48F-C52409B33F2B</RequestId>
      <CreateTime>1493363486000</CreateTime>
      <IpAddress>101.xx.xx.12</IpAddress>
</CreateCustomerGatewayResponse>

JSON format

{
    "CustomerGatewayId": "cgw-bp1jrawp82av6bws9****",
    "CreateTime": 1493363599000,
    "RequestId": "D32B3C26-6C6C-4988-93E9-D2A6444CE6AE",
    "IpAddress": "101.xx.xx.12"
}

Error codes

HTTP status code Error code Error message Description
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 not authorized to perform this operation on the specified resource. You can apply for the permission and try again.
403 Forbidden User not authorized to operate on the specified resource. The error message returned because you are not authorized to perform this operation on the specified resource. To require the permission, submit a ticket.
400 InvalidIpAddress.AlreadyExist Specified IpAddress is already exist. The error message returned because this IP address already exists, The IP addresses must be unique in the same region.
400 InvalidIpAddress.WrongFormat Specified IpAddress is invalid. The error message returned because the specified IP address is invalid.
400 InvalidName The name is not valid The error message returned because the format of the specified name parameter is invalid.
400 InvalidDescription The description is not valid The error message returned because the format of the description is invalid.
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.