DeleteNatGateway

Updated at:

Deletes an Internet NAT gateway.

Operation description

Description

  • DeleteNatGateway is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. Call DescribeNatGateways to query the task status:

    • If the NAT gateway is in the Deleting state, the gateway is being deleted. You can query the NAT gateway but cannot perform other operations.

    • If the NAT gateway is no longer returned, the deletion is complete.

      Deleted NAT gateways cannot be restored. Proceed with caution.

  • You cannot call DeleteNatGateway repeatedly for the same NAT gateway within a short period of time.

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 region ID of the NAT gateway.

Call DescribeRegions to query available regions.

cn-hangzhou

NatGatewayId

string

Yes

The ID of the NAT gateway to delete.

ngw-bp1uewa15k4iy5770****

Force

boolean

No

Specifies whether to force-delete the NAT gateway. Valid values:

  • true: The system automatically deletes SNAT entries, DNAT entries, disassociates EIPs, and disassociates NAT bandwidth plans before deleting the gateway.

  • false (default): You must manually disassociate NAT bandwidth plans, delete SNAT and DNAT entries, and disassociate EIPs before deleting the gateway.

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.