Deletes a specified Internet NAT gateway.
Operation description
DeleteNatGateway is an asynchronous operation. After you send a request, the system returns a request ID. However, the NAT gateway is not immediately deleted. The deletion task runs in the background. You can call DescribeNatGateways to query the status of the NAT gateway:
-
If the NAT gateway is in the Deleting state, the NAT gateway is being deleted. In this state, you can only perform query operations.
-
If the NAT gateway cannot be found, the NAT gateway is deleted.
Deleting a NAT gateway is irreversible. Proceed with caution.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:DeleteNatGateway |
delete |
*NatGateway
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the NAT gateway. You can call DescribeRegions to query the region ID. |
cn-hangzhou |
| NatGatewayId |
string |
Yes |
The instance ID of the NAT gateway that you want to delete. |
ngw-bp1uewa15k4iy5770**** |
| Force |
boolean |
No |
Specifies whether to forcefully delete the NAT gateway. Valid values:
|
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The request ID. |
||
| RequestId |
string |
The request ID. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
Examples
Success response
JSON format
{
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | DependencyViolation.VpcEndpointService | The specified resource of %s depends on %s, so the operation cannot be completed. | You cannot perform the operation because the NAT gateway is associated with an endpoint service. |
| 400 | DependencyViolation.FullNatEntry | The specified resource of %s depends on %s, so the operation cannot be completed. | |
| 400 | DependencyViolation.RouterEntry | The specified resource of %s depends on %s, so the operation cannot be completed. | You cannot perform the operation because the NAT gateway is associated with a route entry. |
| 400 | DependencyViolation.BandwidthPackages | There are BandwidthPackages on specified NatGateway not deleted. | |
| 400 | DependencyViolation.EIPS | There are Eips on specified NatGateway, please unbind it first. | An EIP is associated with the NAT gateway. Disassociate the EIP from the NAT gateway first. |
| 400 | Forbidden.PrePaidNatGateway | The specified NatGateway is PrePaid. | |
| 400 | InvalidOperation.DeletionProtection | The instance cannnot delete because of deletion protecion. | |
| 400 | DependencyViolation.SnatEntry | The specified resource of %s depends on %s, so the operation cannot be completed. | The SnatEntry associated with NatIp or Ipv4Prefix cannot be deleted. Delete the dependent Snat and delete it again. |
| 400 | IncorrectStatus.SnatEntry | The status of %s [%s] is incorrect. | |
| 400 | DependencyViolation.ForwardEntry | The specified resource of %s depends on %s, so the operation cannot be completed. | |
| 400 | IncorrectStatus.ForwardEntry | The status of %s [%s] is incorrect. | The DNAT entry to be deleted is in an invalid state. |
| 400 | DependencyViolation.NatIp | The specified resource of %s depends on %s, so the operation cannot be completed. | You cannot perform the operation because the NAT gateway is associated with a NAT IP address. |
| 400 | IncorrectStatus.NatIp | The status of %s [%s] is incorrect. | The status of NatIp is incorrect. |
| 400 | DependencyViolation.NatIpCidr | The specified resource of %s depends on %s, so the operation cannot be completed. | You cannot perform the operation because the NAT gateway is associated with a NAT CIDR block. |
| 400 | IncorrectStatus.NatGateway | The NatGateway instance is being deleted and needs to wait until the process is complete. | The NAT Gateway instance is being deleted and cannot be repeatedly deleted. You need to wait for the deletion process to complete. |
| 400 | IncorrectStatus.RouterEntry | The status of %s [%s] is incorrect. | The state of the RouterEntry is incorrect. |
| 400 | IncorrectStatus.VSwitch | The specified vSwitch status is invalid. | The virtual switch status is abnormal. |
| 404 | INSTANCE_NOT_EXISTS | Instance not exists. | |
| 404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | |
| 404 | InvalidNatGatewayId.NotFound | The specified NatGatewayId does not exist in our records. | |
| 404 | ResourceNotFound.NatGateway | The specified resource of %s is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.