全部產品
Search
文件中心

NAT Gateway:DeleteNatGateway

更新時間:Aug 05, 2026

呼叫 DeleteNatGateway 介面刪除指定的公網 NAT 閘道器。

介面說明

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

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

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

說明

刪除 NAT 閘道器操作不可恢復,請您謹慎操作。

調試

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

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

vpc:DeleteNatGateway

delete

*NatGateway

acs:vpc:{#regionId}:{#accountId}:natgateway/{#natgatewayid}

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

NAT 閘道器所在的地域 ID。

您可以透過呼叫 DescribeRegions 介面取得地域 ID。

cn-hangzhou

NatGatewayId

string

要刪除的 NAT 閘道器執行個體 ID。

ngw-bp1uewa15k4iy5770****

Force

boolean

是否強制刪除 NAT 閘道器,取值:

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

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

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

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

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

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

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

    • 如果 NAT 閘道器有 SNAT 規則,請先刪除 SNAT 規則。

    • 如果 NAT 閘道器有 DNAT 規則,請先刪除 DNAT 規則。

    • 如果 NAT 閘道器有綁定 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 閘道器已綁定了彈性公網 IP,請先將其從 NAT 閘道器解除綁定。
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. 指定的 NatGateway 未處於穩態。
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.

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

變更歷史

更多資訊,參考變更詳情