Deletes a specified Internet NAT gateway or a Virtual Private Cloud (VPC) NAT gateway.
Usage notes
- DeleteNatGateway is an asynchronous operation. After you make a request, the ID of the request is
returned but the NAT gateway is not deleted. The system deletes the NAT gateway in
the background. You can call the DescribeNatGateways to query the status of a NAT gateway.
- If a NAT gateway is in the Deleting state, the NAT gateway is being deleted. In this case, you can query the NAT gateway but you cannot perform other operations.
-
If the NAY gateway cannot be found, the NAT gateway is deleted.
After you delete a NAT gateway, you cannot restore the NAT gateway. Proceed with caution.
- You cannot repeatedly call the DeleteNatGateway operation to delete a NAT gateway within the specified period of time.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeleteNatGateway |
The operation that you want to perform. Set the value to DeleteNatGateway. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region where the NAT gateway is deployed. You can call the DescribeRegions operation to query the most recent region list. |
NatGatewayId | String | Yes | ngw-bp1uewa15k4iy5770**** |
The ID of the NAT gateway that you want to delete. |
Force | Boolean | No | false |
Specifies whether to forcefully delete the NAT gateway. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=DeleteNatGateway
&RegionId=cn-hangzhou
&NatGatewayId=ngw-bp1uewa15k4iy5770****
&Force=false
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<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.BandwidthPackages | There are BandwidthPackages on specified NatGateway not deleted. | The error message returned because one or more NAT bandwidth plans are associated with the NAT gateway. Disassociate all NAT bandwidth plans from the NAT gateway and try again. |
400 | IncorrectStatus.NatIp | The status of %s [%s] is incorrect. | The error message returned because the status of the NAT IP address is invalid. |
404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | The error message returned because the specified region ID does not exist. |
404 | InvalidNatGatewayId.NotFound | The specified NatGatewayId does not exist in our records. | The error message returned because the specified NAT gateway ID does not exist. Check whether the value of the NatGatewayId parameter is valid. |
For a list of error codes, visit the API Error Center.