全部產品
Search
文件中心

NAT Gateway:DeleteNatGateway - 刪除指定的NAT Gateway

更新時間:Apr 27, 2026

調用DeleteNatGateway介面刪除指定的公網NAT Gateway。

介面說明

DeleteNatGateway 介面屬於非同步介面,即系統會先返回一個請求 ID,但該 NAT Gateway執行個體並未刪除完成,系統背景刪除任務仍在進行。您可以調用 DescribeNatGateways 查詢 NAT Gateway的狀態:

  • 當 NAT Gateway處於 Deleting 狀態時,表示 NAT Gateway正在刪除中,在該狀態下,您只能執行查詢操作,不能執行其他動作。

  • 當查詢不到該 NAT Gateway執行個體時,表示 NAT Gateway刪除完成。

說明

刪除 NAT Gateway操作不可恢複,請您謹慎操作。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

當前API暫無授權資訊透出。

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

NAT Gateway所在的地區 ID。

您可以通過調用 DescribeRegions 介面擷取地區 ID。

cn-hangzhou

NatGatewayId

string

要刪除的 NAT Gateway的執行個體 ID。

ngw-bp1uewa15k4iy5770****

Force

boolean

是否強制移除 NAT Gateway,取值:

  • true:強制移除。當取值為 true 時,說明如下:

    • 如果 NAT Gateway有 SNAT 規則,系統會自動幫您刪除 SNAT 規則。

    • 如果 NAT Gateway有 DNAT 規則,系統會自動幫您刪除 DNAT 規則。

    • 如果 NAT Gateway有綁定 EIP,系統會自動幫您解除綁定。

    • 如果 NAT Gateway有未刪除的 NAT 頻寬包,系統會自動幫您刪除 NAT 頻寬包。

  • false(預設值):不強制移除。當取值為 false 時,說明如下:

    • 如果 NAT Gateway有未刪除的 NAT 頻寬包,請先刪除 NAT 頻寬包。

    • 如果 NAT Gateway有 SNAT 規則,請先刪除 SNAT 規則。

    • 如果 NAT Gateway有 DNAT 規則,請先刪除 DNAT 規則。

    • 如果 NAT Gateway有綁定 EIP,請先解除綁定 EIP。

false

返回參數

名稱

類型

描述

樣本值

object

請求 ID。

RequestId

string

請求 ID。

0ED8D006-F706-4D23-88ED-E11ED28DCAC0

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 DependencyViolation.VpcEndpointService The specified resource of %s depends on %s, so the operation cannot be completed. NAT有依賴的終端節點服務,所以此操作不能進行
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. NAT有依賴的路由條目,所以此操作不能進行
400 DependencyViolation.BandwidthPackages There are BandwidthPackages on specified NatGateway not deleted.
400 DependencyViolation.EIPS There are Eips on specified NatGateway, please unbind it first. 指定的NAT Gateway已綁定了Elastic IP Address,請先將其從NAT Gateway解除綁定。
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. NatIp或Ipv4Prefix存在關聯的SnatEntry,刪除操作無法繼續,請刪除依賴的Snat後再重新刪除。
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. 要刪除的DNAT條目執行個體狀態不對
400 DependencyViolation.NatIp The specified resource of %s depends on %s, so the operation cannot be completed. 有依賴的NAT IP,所以此操作不能進行
400 IncorrectStatus.NatIp The status of %s [%s] is incorrect. NatIp目前狀態不正確。
400 DependencyViolation.NatIpCidr The specified resource of %s depends on %s, so the operation cannot be completed. NAT有依賴的NAT IP CIDR,所以此操作不能進行
400 IncorrectStatus.NatGateway The NatGateway instance is being deleted and needs to wait until the process is complete. NAT Gateway執行個體正在被刪除,無法重複刪除,需要等待刪除過程完成。
400 IncorrectStatus.RouterEntry The status of %s [%s] is incorrect. RouterEntry目前狀態不正確。
400 IncorrectStatus.VSwitch The specified vSwitch status is invalid. 虛擬交換器狀態異常。
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.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情