AWS SDK 또는 CLI와 함께 DeleteCluster 사용 - AWS SDK 코드 예제

AWS SDK 예제 GitHub 리포지토리에 더 많은 AWS문서 SDK 예제가 있습니다.

AWS SDK 또는 CLI와 함께 DeleteCluster 사용

다음 코드 예시는 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 V4

예제 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 참조(V4)DeleteCluster를 참조하세요.

Tools for PowerShell V5

예제 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 참조(V5)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를 참조하십시오.