Deletes a specified VPN gateway.

Note You cannot delete a VPN gateway that is associated with an IPsec-VPN connection.

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 DeleteVpnGateway

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

RegionId String Yes cn-hangzhou

The ID of the region where the VPN gateway is created.

You can call the DescribeRegions operation to query the most recent region list.

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

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.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId may be different for each API request.
VpnGatewayId String Yes vpn-bp1q8bgx4xnkm2ogj****

The ID of the VPN gateway.

Response parameters

Parameter Type Example Description
RequestId String >0ED8D006-F706-4D23-88ED-E11ED28DCAC0

The ID of the request.

Examples

Sample requests

https://vpc.aliyuncs.com/?Action=DeleteVpnGateway
&RegionId=cn-hangzhou
&VpnGatewayId=vpn-bp1q8bgx4xnkm2ogj****
&<Common request parameters>

Sample success responses

XML format

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

<?xml version="1.0" encoding="UTF-8"?>
<DeleteNatGatewayResponse>
    <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</DeleteNatGatewayResponse>

JSON format

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

{
  "RequestId" : "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

Error codes

HttpCode Error code Error message Description
400 DependencyViolation.VpnConnection There are vpn connections on specified customer gateway not deleted. The error message returned because VPN connections to the specified customer gateway are not deleted.
400 DependencyViolation.SslVpnServer There is SSL VPN server on specified vpn gateway not deleted. The error message returned because SSL-VPN connections to the specified customer gateway are not deleted.
400 VpnGateway.Configuring The specified service is configuring. The error message returned because the operation is not allowed when the specified service is being configured. Try again later.
400 VpnGateway.Configuring The specified VPN gateway is being configured. The error message returned because the VPN gateway is being configured.
400 DependencyViolation.GreTunnel There is Gre tunnel on specified vpn gateway not deleted. The error message returned because GRE tunnels are not deleted on the VPN gateway.
403 Forbidden.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. Acquire 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. Acquire the required permissions and try again.
403 ForbiddenRelease Forbidden to release a prepaid instance within validity period The error message returned because you cannot release a subscription VPN gateway within the subscription duration.
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, see Service error codes.