All Products
Search
Document Center

:CreateEnhancedVpnGateway

Last Updated:May 13, 2026

Use the CreateEnhancedVpnGateway API to create an Enhanced VPN Gateway.

Operation description

  • Before you create an enhanced VPN gateway, we recommend that you review the VPN Gateway Usage Limits.

  • An enhanced VPN gateway supports only dual-tunnel mode IPsec-VPN connections. When you call the CreateEnhancedVpnGateway operation to create a VPN Gateway instance, you must specify the VSwitchId and DisasterRecoveryVSwitchId parameters in addition to other required parameters.

  • CreateEnhancedVpnGateway is an asynchronous operation. After you send a request, the system returns an instance ID and starts creating the enhanced VPN gateway in the background. You can call DescribeVpnGateway to query the creation status of the enhanced VPN gateway:

    • The provisioning state indicates that the gateway is being created.

    • The active state indicates that the gateway has been created.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region where you want to create the enhanced VPN gateway.

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

cn-hangzhou

Name

string

No

The name of the enhanced VPN gateway. If you do not specify this parameter, the gateway ID is used as the name.

The name must be 2 to 100 characters long, start with a letter, and not start with http:// or https://. It can contain only letters, digits, underscores (_), hyphens (-), and periods (.).

MYVPN

VpcId

string

Yes

The ID of the VPC where you want to create the enhanced VPN gateway.

vpc-bp1ub1yt9cvakoelj****

VSwitchId

string

No

The ID of the vSwitch to associate with the enhanced VPN gateway.

vsw-bp1j5miw2bae9s2vt****

VpnType

string

No

The type of the enhanced VPN gateway. Valid value:

  • Normal (default): standard type.

Normal

ClientToken

string

No

A client token used to ensure request idempotence.

You can generate this token from your client. Make sure that the token is unique for each request. The client token can contain only ASCII characters.

Note

If you do not specify this parameter, the system automatically uses the RequestId of the request as the ClientToken. Each request may have a different RequestId.

02fb3da4****

NetworkType

string

No

The network type of the VPN gateway. Valid value:

  • public (default): a public VPN gateway.

public

DisasterRecoveryVSwitchId

string

No

The ID of the second vSwitch to associate with the enhanced VPN gateway for high availability.

  • For zone-level disaster recovery, the two vSwitches must be in different availability zones within the same VPC.

  • In regions with only one availability zone, zone-level disaster recovery is not supported. To ensure high availability, specify two different vSwitches from that zone. You can also specify the same vSwitch for both the VSwitchId and DisasterRecoveryVSwitchId parameters.

vsw-p0wiz7obm0tbimu4r****

ResourceGroupId

string

No

The ID of the resource group to which you want to assign the enhanced VPN gateway.

  • You can call the ListResourceGroups operation to query resource group IDs.

  • If you do not specify this parameter, the enhanced VPN gateway is added to the Default Resource Group.

  • Associated IPsec connections are automatically added to the same resource group as the enhanced VPN gateway. You cannot directly change the resource group of an IPsec connection. If you change the resource group of the gateway, the resource group of its associated IPsec connections is also updated.

rg-acfmzs372yg****

GatewayType

string

Yes

The type of the enhanced VPN gateway. Valid value:

  • Enhanced.SiteToSite: an enhanced site-to-site VPN gateway that supports only the IPsec feature.

Enhanced.SiteToSite

Response elements

Element

Type

Description

Example

object

The response object.

VpnGatewayId

string

The ID of the enhanced VPN gateway instance.

vpn-uf68lxhgr7ftbqr3p****

RequestId

string

The request ID.

EB2C156A-41F8-49CC-A756-D55AFC8BFD69

Name

string

The name of the enhanced VPN gateway.

MYVPN

Examples

Success response

JSON format

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

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 InventoryNotEnough The inventory is not enough.
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.
400 OperationFailed.OpenCdtServiceFirst The operation is failed because of %s. The billing method requires CDT billing enabled. Enable CDT billing and try again.
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.