本文說明如何刪除不再需要的代管執行個體群組 (MIG),停止支付所用資源的費用。
事前準備
-
如果尚未設定驗證,請先完成設定。
「驗證」是指驗證身分的程序,確認您有權存取 Trusted Cloud by S3NS 服務和 API。如要從本機開發環境執行程式碼或範例,請選取下列任一選項,向 Compute Engine 進行驗證:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Trusted Cloud console to access Trusted Cloud by S3NS services and APIs, you don't need to set up authentication.
gcloud
-
安裝 Google Cloud CLI,然後 使用同盟身分登入 gcloud CLI。 登入後,執行下列指令初始化 Google Cloud CLI:
gcloud init
- Set a default region and zone.
REST
如要在本機開發環境中使用本頁的 REST API 範例,請使用您提供給 gcloud CLI 的憑證。
安裝 Google Cloud CLI,然後 使用同盟身分登入 gcloud CLI。 登入後,執行下列指令初始化 Google Cloud CLI:
gcloud init
詳情請參閱 Trusted Cloud 驗證說明文件中的「Authenticate for using REST」。
刪除 MIG
刪除代管執行個體群組時,也會刪除群組中的所有 VM。如要保留任何 VM,請先捨棄 VM,將這些 VM 從群組中移除。然後刪除代管執行個體群組。
只有在定義 MIG 執行個體範本中的磁碟時,將磁碟的自動刪除屬性設為 true,MIG 中的磁碟才會遭到刪除。如果磁碟的自動刪除屬性設為 false,您可以在不再需要磁碟時手動清除。
當您使用Trusted Cloud console 或 gcloud CLI 刪除代管執行個體群組及其執行個體時,系統會自動刪除所有連結的自動配置器。不過,如果您使用 REST,您必須先使用
autoscalers.delete
方法或regionAutoscalers.delete
方法,另外發出刪除任何附加自動配置器的要求。如果您先刪除代管執行個體群組,還是可以使用 REST 刪除附加的自動調度資源。您也可以覆寫每個磁碟的自動刪除屬性,指定是否要在相關聯的執行個體遭刪除時刪除磁碟。
主控台
前往 Trusted Cloud 控制台的「Instance groups」(執行個體群組) 頁面。
從清單中選取一或多個要刪除的群組。
按一下「刪除」,刪除群組和代管執行個體群組中的所有 VM。
gcloud
使用
delete
指令。gcloud compute instance-groups managed delete INSTANCE_GROUP_NAME \ --zone ZONE
REST
呼叫可用區或區域 MIG 資源的
delete
方法。如果 MIG 附加了自動配置器,您必須先使用autoscalers.delete
方法或regionAutoscalers.delete
方法刪除自動配置器。DELETE https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instanceGroupManagers/INSTANCE_GROUP_NAME
如果該執行個體群組是地區代管執行個體群組,請將
zones/ZONE
替換成regions/REGION
。後續步驟
- 瞭解如何取得、列出及刪除執行個體範本
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[[["This guide explains how to delete a managed instance group (MIG) and its associated resources to avoid incurring unnecessary costs."],["Deleting a MIG will remove all virtual machines (VMs) within it, unless you choose to abandon specific VMs beforehand."],["Disks within the MIG will only be deleted automatically if their auto-delete property was set to true during the MIG's template configuration, otherwise manual deletion is necessary."],["If a MIG is associated with a load balancer's backend service, the backend service must be removed before deleting the MIG, and any autoscalers attached to the MIG must be deleted separately when using the REST API."],["The process can be done using the Google Cloud Console, gcloud CLI, or REST API, each with specific instructions and requirements."]]],[]] -