Deletes a NAT Gateway.

Note If the NAT Gateway is associated with a shared bandwidth package, you must delete the shared bandwidth package first.

Debug

By using API Explorer, you can easily debug APIs, automatically generate SDK code examples, and quickly search for APIs.

Request parameters

Parameter Type Required? Example value Description
Action String Yes DeleteNatGateway

The name of this action. Value:

DeleteNatGateway

NatGatewayId String Yes ngw-bp1uewa15k4iy5770ya89

The ID of the NAT Gateway.

RegionId String Yes cn-hangzhou

The region to which the NAT Gateway belongs.

To query the region ID, call DescribeRegions.

Force Boolean No false

Indicates whether to forcibly delete the NAT Gateway.

Response parameters

Parameter Type Example value Description
RequestId String 4EC47282-1B74-4534-BD0E-403F3EE64CAF The ID of the request.

Examples

Request example


https://vpc.aliyuncs.com/?Action=DeleteNatGateway
&NatGatewayId=ngw-bp1uewa15k4iy5770ya89
&RegionId=cn-hangzhou
&<CommonParameters>
Response example
  • XML format

    <DeleteNatGatewayResponse>
      <RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
    </DeleteNatGatewayResponse>
    
  • JSON format

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

Error codes

HTTP status code Error code Error message Description
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records. The specified region ID does not exist.
404 InvalidNatGatewayId.NotFound The specified NatGatewayId does not exist in our records. The specified NatGatewayId does not exist.
400 DependencyViolation.BandwidthPackages There are BandwidthPackages on specified NatGateway not deleted. The NAT Gateway is associated with one or more shared bandwidth packages. Delete all shared bandwidth packages first.

See common error codes