選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

DeleteCluster 搭配 AWS SDK 或 CLI 使用 - AWS SDK 程式碼範例

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

DeleteCluster 搭配 AWS SDK 或 CLI 使用

下列程式碼範例示範如何使用 DeleteCluster

CLI
AWS CLI

刪除空叢集

下列delete-cluster範例會刪除指定的空白叢集。

aws ecs delete-cluster --cluster MyCluster

輸出:

{ "cluster": { "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster", "status": "INACTIVE", "clusterName": "MyCluster", "registeredContainerInstancesCount": 0, "pendingTasksCount": 0, "runningTasksCount": 0, "activeServicesCount": 0 "statistics": [], "tags": [] } }

如需詳細資訊,請參閱《Amazon ECS 開發人員指南》中的刪除叢集

  • 如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteCluster

PowerShell
Tools for PowerShell

範例 1:此 cmdlet 會刪除指定的 ECS 叢集。您必須從此叢集取消註冊所有容器執行個體,才能刪除它。

Remove-ECSCluster -Cluster "LAB-ECS"

輸出:

Confirm Are you sure you want to perform this action? Performing the operation "Remove-ECSCluster (DeleteCluster)" on target "LAB-ECS". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y
  • 如需 API 詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考中的 DeleteCluster

Rust
SDK for Rust
注意

GitHub 上提供更多範例。尋找完整範例,並了解如何在 AWS 程式碼範例儲存庫中設定和執行。

async fn remove_cluster( client: &aws_sdk_ecs::Client, name: &str, ) -> Result<(), aws_sdk_ecs::Error> { let cluster_deleted = client.delete_cluster().cluster(name).send().await?; println!("cluster deleted: {:?}", cluster_deleted); Ok(()) }
  • 如需 API 詳細資訊,請參閱 AWS SDK for Rust API 參考中的 DeleteCluster

AWS CLI

刪除空叢集

下列delete-cluster範例會刪除指定的空白叢集。

aws ecs delete-cluster --cluster MyCluster

輸出:

{ "cluster": { "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster", "status": "INACTIVE", "clusterName": "MyCluster", "registeredContainerInstancesCount": 0, "pendingTasksCount": 0, "runningTasksCount": 0, "activeServicesCount": 0 "statistics": [], "tags": [] } }

如需詳細資訊,請參閱《Amazon ECS 開發人員指南》中的刪除叢集

  • 如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 DeleteCluster

下一個主題:

DeleteService

上一個主題:

CreateService
隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。