Deletes a specified NAT Gateway.

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

Debug

Use OpenAPI Explorer to perform debug operations and generate SDK code examples.

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 to be deleted.

RegionId String Yes cn-hangzhou

The ID of the region to which the NAT Gateway belongs.

To query the region ID, call DescribeRegions.

Force Boolean No false

Optional. Indicates whether to force the deletion of 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"
}

Errors

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 NAT Gateway ID does not exist.
400 DependencyViolation.BandwidthPackages There are BandwidthPackages on specified NatGateway not deleted. The NAT Gateway is associated with one or more NAT bandwidth packages. Please delete the associated NAT bandwidth packages first.

For a list of error codes, visit the API Error Center.