

Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. [AWS](https://github.com/awsdocs/aws-doc-sdk-examples) 

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 를 사용한 Amazon ECS 예제 AWS CLI
<a name="cli_2_ecs_code_examples"></a>

다음 코드 예제에서는 AWS Command Line Interface Amazon ECS에서를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

**Topics**
+ [작업](#actions)

## 작업
<a name="actions"></a>

### `capacity-provider-update`
<a name="ecs_CapacityProviderUpdate_cli_2_topic"></a>

다음 코드 예시는 `capacity-provider-update`의 사용 방법을 보여줍니다.

**AWS CLI**  
**ECS 클러스터에서 용량 공급자 업데이트**  
다음 `update-capacity-provider` 예제는 ECS 클러스터에서 용량 공급자의 파라미터를 수정하는 방법을 보여줍니다.  

```
aws ecs update-capacity-provider \
    --name {{Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt}} \
    --auto-scaling-group-provider {{"managedScaling={status=DISABLED,targetCapacity=50,minimumScalingStepSize=2,maximumScalingStepSize=30,instanceWarmupPeriod=200},managedTerminationProtection=DISABLED,managedDraining=DISABLED"}}
```
출력:  

```
{
    "capacityProvider": {
        "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt",
        "name": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt",
        "status": "ACTIVE",
        "autoScalingGroupProvider": {
            "autoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:424941d1-b43f-4a17-adbb-08b6a6e397e1:autoScalingGroupName/Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-ECSAutoScalingGroup-f44jrQHS2nRB",
            "managedScaling": {
                "status": "ENABLED",
                "targetCapacity": 100,
                "minimumScalingStepSize": 1,
                "maximumScalingStepSize": 10000,
                "instanceWarmupPeriod": 300
            },
            "managedTerminationProtection": "DISABLED",
            "managedDraining": "ENABLED"
        },
        "updateStatus": "UPDATE_IN_PROGRESS",
        "tags": []
    }
}
```
용량 공급자에 대한 자세한 내용은 *Amazon ECS 개발자 안내서*의 [EC2 시작 유형에 대한 Amazon ECS 용량 공급자](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CapacityProviderUpdate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/capacity-provider-update.html)를 참조하세요.

### `create-capacity-provider`
<a name="ecs_CreateCapacityProvider_cli_2_topic"></a>

다음 코드 예시는 `create-capacity-provider`의 사용 방법을 보여줍니다.

**AWS CLI**  
**용량 공급자를 만들려면**  
다음 create-capacity-provider 예시에서는 MyASG라는 Auto Scaling 그룹을 사용하고 관리형 규모 조정 및 관리형 종료 보호가 활성화된 용량 공급자를 만듭니다. 이 구성은 Amazon ECS 클러스터 오토 스케일링에 사용됩니다.  

```
aws ecs create-capacity-provider \
    --name {{"MyCapacityProvider"}} \
    --auto-scaling-group-provider {{"autoScalingGroupArn=arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:57ffcb94-11f0-4d6d-bf60-3bac5EXAMPLE:autoScalingGroupName/MyASG,managedScaling={status=ENABLED,targetCapacity=100},managedTerminationProtection=ENABLED"}}
```
출력:  

```
{
    "capacityProvider": {
    "capacityProviderArn": "arn:aws:ecs:us-east-1:123456789012:capacity-provider/MyCapacityProvider",
    "name": "MyCapacityProvider",
    "status": "ACTIVE",
    "autoScalingGroupProvider": {
        "autoScalingGroupArn": "arn:aws:autoscaling:us-east-1:132456789012:autoScalingGroup:57ffcb94-11f0-4d6d-bf60-3bac5EXAMPLE:autoScalingGroupName/MyASG",
        "managedScaling": {
            "status": "ENABLED",
            "targetCapacity": 100,
            "minimumScalingStepSize": 1,
            "maximumScalingStepSize": 10000,
            "instanceWarmupPeriod": 300
        },
        "managedTerminationProtection": "ENABLED"
    },
    "tags": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 클러스터 오토 스케일링](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-auto-scaling.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateCapacityProvider](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/create-capacity-provider.html) 섹션을 참조하세요.

### `create-cluster`
<a name="ecs_CreateCluster_cli_2_topic"></a>

다음 코드 예시는 `create-cluster`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예 1: 새 클러스터를 생성하는 방법**  
다음 `create-cluster` 예제에서는 `MyCluster`라는 클러스터를 만들고 향상된 관찰성을 갖춘 CloudWatch Container Insights를 사용 설정합니다.  

```
aws ecs create-cluster \
    --cluster-name {{MyCluster}} \
    --settings {{name=containerInsights,value=enhanced}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enhanced"
            }
        ],
        "tags": []
    }
}
```
자세한 내용은 **Amazon ECS 개발자 안내서의 [클러스터 생성](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create_cluster.html)을 참조하세요.  
**예 2: 용량 공급자를 사용하여 새 클러스터를 생성하는 방법**  
다음 `create-cluster` 예시에서는 클러스터를 생성하고 기존 용량 공급자 2개를 클러스터에 연결합니다. `create-capacity-provider` 명령을 사용하여 용량 공급자를 생성합니다. 기본 용량 공급자 전략을 지정하는 것은 선택 사항이지만 권장됩니다. 이 예시에서는 이름이 `MyCluster`인 클러스터를 생성하고 여기에 `MyCapacityProvider1` 및 `MyCapacityProvider2` 용량 공급자를 연결합니다. 기본 용량 공급자 전략이 지정되어 태스크를 두 용량 공급자 모두에 균등하게 분산합니다.  

```
aws ecs create-cluster \
    --cluster-name {{MyCluster}} \
    --capacity-providers {{MyCapacityProvider1}} {{MyCapacityProvider2}} \
    --default-capacity-provider-strategy {{capacityProvider=MyCapacityProvider1,weight=1}} {{capacityProvider=MyCapacityProvider2,weight=1}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "PROVISIONING",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [
            "MyCapacityProvider1",
            "MyCapacityProvider2"
        ],
        "defaultCapacityProviderStrategy": [
            {
                "capacityProvider": "MyCapacityProvider1",
                "weight": 1,
                "base": 0
            },
            {
                "capacityProvider": "MyCapacityProvider2",
                "weight": 1,
                "base": 0
            }
        ],
        "attachments": [
           {
               "id": "0fb0c8f4-6edd-4de1-9b09-17e470ee1918",
               "type": "asp",
               "status": "PRECREATED",
               "details": [
                   {
                       "name": "capacityProviderName",
                       "value": "MyCapacityProvider1"
                   },
                   {
                       "name": "scalingPlanName",
                       "value": "ECSManagedAutoScalingPlan-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
                   }
                ]
            },
            {
                "id": "ae592060-2382-4663-9476-b015c685593c",
                "type": "asp",
                "status": "PRECREATED",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider2"
                    },
                    {
                        "name": "scalingPlanName",
                        "value": "ECSManagedAutoScalingPlan-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    }
                ]
            }
        ],
        "attachmentsStatus": "UPDATE_IN_PROGRESS"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
**예 3: 여러 태그가 포함된 새 클러스터를 생성하는 방법**  
다음 `create-cluster` 예시에서는 여러 태그가 있는 클러스터를 만듭니다. 간편 구문을 사용하여 태그를 추가하는 방법에 대한 자세한 내용은 *AWS CLI 사용 설명서*의 [AWS 명령줄 인터페이스에서 간편 구문 사용을](https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-shorthand.html) 참조하세요.  

```
aws ecs create-cluster \
    --cluster-name {{MyCluster}} \
    --tags {{key=key1,value=value1}} {{key=key2,value=value2}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "pendingTasksCount": 0,
        "runningTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [
            {
                "key": "key1",
                "value": "value1"
            },
            {
                "key": "key2",
                "value": "value2"
            }
        ]
     }
 }
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [클러스터 생성](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create_cluster.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/create-cluster.html)를 참조하세요.

### `create-service`
<a name="ecs_CreateService_cli_2_topic"></a>

다음 코드 예시는 `create-service`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예 1: Fargate 태스크를 사용하여 서비스를 생성하는 방법**  
다음 `create-service` 예시에서는 Fargate 태스크를 사용하여 서비스를 생성하는 방법을 보여줍니다.  

```
aws ecs create-service \
    --cluster {{MyCluster}} \
    --service-name {{MyService}} \
    --task-definition {{sample-fargate:1}} \
    --desired-count {{2}} \
    --launch-type {{FARGATE}} \
    --platform-version {{LATEST}} \
    --network-configuration '{{awsvpcConfiguration={subnets=[subnet-12344321],securityGroups=[sg-12344321],assignPublicIp=ENABLED}}}' \
    --tags {{key=key1,value=value1}} {{key=key2,value=value2}} {{key=key3,value=value3}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/MyCluster/MyService",
        "serviceName": "MyService",
          "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 0,
        "pendingCount": 0,
        "launchType": "FARGATE",
        "platformVersion": "LATEST",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:1",
        "deploymentConfiguration": {
            "maximumPercent": 200,
            "minimumHealthyPercent": 100
        },
        "deployments": [
            {
                "id": "ecs-svc/1234567890123456789",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:1",
                "desiredCount": 2,
                "pendingCount": 0,
                "runningCount": 0,
                "createdAt": 1557119253.821,
                "updatedAt": 1557119253.821,
                "launchType": "FARGATE",
                "platformVersion": "1.3.0",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                }
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [],
        "createdAt": 1557119253.821,
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "schedulingStrategy": "REPLICA",
        "tags": [
            {
                "key": "key1",
                "value": "value1"
            },
            {
                "key": "key2",
                "value": "value2"
            },
            {
                "key": "key3",
                "value": "value3"
            }
        ],
        "enableECSManagedTags": false,
        "propagateTags": "NONE"
    }
}
```
자세한 정보는 *Amazon ECS 개발자 안내서*의 [서비스 생성하기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html)를 참조하세요.  
**예 2: EC2 시작 유형을 사용하여 서비스를 생성하는 방법**  
다음 `create-service` 예시에서는 EC2 시작 유형을 사용하는 태스크로 `ecs-simple-service`라는 서비스를 호출하는 방법을 보여줍니다. 이 서비스는 `sleep360` 태스크 정의를 사용하며 태스크의 인스턴스화 1개를 유지 관리합니다.  

```
aws ecs create-service \
    --cluster {{MyCluster}} \
    --service-name {{ecs-simple-service}} \
    --task-definition {{sleep360:2}} \
    --desired-count {{1}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/MyCluster/ecs-simple-service",
        "serviceName": "ecs-simple-service",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 1,
        "runningCount": 0,
        "pendingCount": 0,
        "launchType": "EC2",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep360:2",
        "deploymentConfiguration": {
            "maximumPercent": 200,
            "minimumHealthyPercent": 100
        },
        "deployments": [
            {
                "id": "ecs-svc/1234567890123456789",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep360:2",
                "desiredCount": 1,
                "pendingCount": 0,
                "runningCount": 0,
                "createdAt": 1557206498.798,
                "updatedAt": 1557206498.798,
                "launchType": "EC2"
            }
        ],
        "events": [],
        "createdAt": 1557206498.798,
        "placementConstraints": [],
        "placementStrategy": [],
        "schedulingStrategy": "REPLICA",
        "enableECSManagedTags": false,
        "propagateTags": "NONE"
    }
}
```
자세한 정보는 *Amazon ECS 개발자 안내서*의 [서비스 생성하기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html)를 참조하세요.  
**예 3: 외부 배포 컨트롤러를 사용하는 서비스를 생성하는 방법**  
다음 `create-service` 예시에서는 외부 배포 컨트롤러를 사용하는 서비스를 생성합니다.  

```
aws ecs create-service \
    --cluster {{MyCluster}} \
    --service-name {{MyService}} \
    --deployment-controller {{type=EXTERNAL}} \
    --desired-count {{1}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/MyCluster/MyService",
        "serviceName": "MyService",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 1,
        "runningCount": 0,
        "pendingCount": 0,
        "launchType": "EC2",
        "deploymentConfiguration": {
            "maximumPercent": 200,
            "minimumHealthyPercent": 100
        },
        "taskSets": [],
        "deployments": [],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [],
        "createdAt": 1557128207.101,
        "placementConstraints": [],
        "placementStrategy": [],
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "EXTERNAL"
        },
        "enableECSManagedTags": false,
        "propagateTags": "NONE"
    }
}
```
자세한 정보는 *Amazon ECS 개발자 안내서*의 [서비스 생성하기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html)를 참조하세요.  
**예 4: 로드 밸런서 뒤에 새 서비스를 생성하는 방법**  
다음 `create-service` 예시에서는 로드 밸런서 뒤에 있는 서비스를 생성하는 방법을 보여줍니다. 컨테이너 인스턴스와 동일한 리전에 로드 밸런서가 구성되어 있어야 합니다. 이 예시에서는 `--cli-input-json` 옵션과 다음 콘텐츠가 포함된 `ecs-simple-service-elb.json`이라는 JSON 입력 파일을 사용합니다.  

```
aws ecs create-service \
    --cluster {{MyCluster}} \
    --service-name {{ecs-simple-service-elb}} \
    --cli-input-json {{file://ecs-simple-service-elb.json}}
```
`ecs-simple-service-elb.json`의 콘텐츠:  

```
 {
    "serviceName": "ecs-simple-service-elb",
    "taskDefinition": "ecs-demo",
    "loadBalancers": [
        {
            "loadBalancerName": "EC2Contai-EcsElast-123456789012",
            "containerName": "simple-demo",
            "containerPort": 80
        }
    ],
    "desiredCount": 10,
    "role": "ecsServiceRole"
}
```
출력:  

```
{
    "service": {
        "status": "ACTIVE",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/ecs-demo:1",
        "pendingCount": 0,
        "loadBalancers": [
            {
                "containerName": "ecs-demo",
                "containerPort": 80,
                "loadBalancerName": "EC2Contai-EcsElast-123456789012"
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/ecsServiceRole",
        "desiredCount": 10,
        "serviceName": "ecs-simple-service-elb",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/ecs-simple-service-elb",
        "deployments": [
            {
                "status": "PRIMARY",
                "pendingCount": 0,
                "createdAt": 1428100239.123,
                "desiredCount": 10,
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/ecs-demo:1",
                "updatedAt": 1428100239.123,
                "id": "ecs-svc/1234567890123456789",
                "runningCount": 0
            }
        ],
        "events": [],
        "runningCount": 0
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [로드 밸런싱을 사용하여 Amazon ECS 서비스 트래픽 분산](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html)을 참조하세요.  
**예시 5: 서비스 생성 시 Amazon EBS 볼륨 구성**  
다음 `create-service` 예시에서는 서비스에서 관리하는 각 작업에 대해 Amazon EBS 볼륨을 구성하는 방법을 보여줍니다. `AmazonECSInfrastructureRolePolicyForVolumes` 관리형 정책과 연결된 Amazon ECS 인프라 역할이 구성되어 있어야 합니다. `create-service` 요청에서와 동일한 볼륨 이름으로 작업 정의를 지정해야 합니다. 이 예시에서는 `--cli-input-json` 옵션과 다음 콘텐츠가 포함된 `ecs-simple-service-ebs.json`이라는 JSON 입력 파일을 사용합니다.  

```
aws ecs create-service \
    --cli-input-json {{file://ecs-simple-service-ebs.json}}
```
`ecs-simple-service-ebs.json`의 콘텐츠:  

```
{
    "cluster": "mycluster",
    "taskDefinition": "mytaskdef",
    "serviceName": "ecs-simple-service-ebs",
    "desiredCount": 2,
    "launchType": "FARGATE",
    "networkConfiguration":{
        "awsvpcConfiguration":{
            "assignPublicIp": "ENABLED",
            "securityGroups": ["sg-12344321"],
            "subnets":["subnet-12344321"]
        }
    },
    "volumeConfigurations": [
        {
            "name": "myEbsVolume",
            "managedEBSVolume": {
                "roleArn":"arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                "volumeType": "gp3",
                "sizeInGiB": 100,
                "iops": 3000,
                "throughput": 125,
                "filesystemType": "ext4"
            }
        }
   ]
}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/mycluster/ecs-simple-service-ebs",
        "serviceName": "ecs-simple-service-ebs",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/mycluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 0,
        "pendingCount": 0,
        "launchType": "EC2",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": false,
                "rollback": false
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100
        },
        "deployments": [
            {
                "id": "ecs-svc/7851020056849183687",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
                "desiredCount": 0,
                "pendingCount": 0,
                "runningCount": 0,
                "failedTasks": 0,
                "createdAt": "2025-01-21T11:32:38.034000-06:00",
                "updatedAt": "2025-01-21T11:32:38.034000-06:00",
                "launchType": "EC2",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "DISABLED"
                    }
                },
                "rolloutState": "IN_PROGRESS",
                "rolloutStateReason": "ECS deployment ecs-svc/7851020056849183687 in progress.",
                "volumeConfigurations": [
                    {
                        "name": "myEBSVolume",
                        "managedEBSVolume": {
                            "volumeType": "gp3",
                            "sizeInGiB": 100,
                            "iops": 3000,
                            "throughput": 125,
                            "roleArn": "arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                            "filesystemType": "ext4"
                        }
                    }
                ]
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [],
        "createdAt": "2025-01-21T11:32:38.034000-06:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "DISABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:user/AIDACKCEVSQ6C2EXAMPLE",
        "enableECSManagedTags": false,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "DISABLED"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 Amazon EBS 볼륨 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateService](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/create-service.html)를 참조하세요.

### `create-task-set`
<a name="ecs_CreateTaskSet_cli_2_topic"></a>

다음 코드 예시는 `create-task-set`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 세트를 만들려면**  
다음 `create-task-set` 예시에서는 외부 배포 컨트롤러를 사용하는 서비스에서 작업 세트를 만듭니다.  

```
aws ecs create-task-set \
    --cluster {{MyCluster}} \
    --service {{MyService}} \
    --task-definition {{MyTaskDefinition:2}} \
    --network-configuration {{"awsvpcConfiguration={subnets=[subnet-12344321],securityGroups=[sg-12344321]}"}}
```
출력:  

```
{
    "taskSet": {
        "id": "ecs-svc/1234567890123456789",
        "taskSetArn": "arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789",
        "status": "ACTIVE",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/MyTaskDefinition:2",
        "computedDesiredCount": 0,
        "pendingCount": 0,
        "runningCount": 0,
        "createdAt": 1557128360.711,
        "updatedAt": 1557128360.711,
        "launchType": "EC2",
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "DISABLED"
            }
        },
        "loadBalancers": [],
        "serviceRegistries": [],
        "scale": {
            "value": 0.0,
            "unit": "PERCENT"
        },
        "stabilityStatus": "STABILIZING",
        "stabilityStatusAt": 1557128360.711
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [CreateTaskSet](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/create-task-set.html) 섹션을 참조하세요.

### `delete-account-setting`
<a name="ecs_DeleteAccountSetting_cli_2_topic"></a>

다음 코드 예시는 `delete-account-setting`의 사용 방법을 보여줍니다.

**AWS CLI**  
**특정 IAM 사용자 또는 IAM 역할의 계정 설정을 삭제하려면**  
다음 `delete-account-setting` 예시에서는 특정 IAM 사용자 또는 IAM 역할에 대한 계정 설정을 삭제합니다.  

```
aws ecs delete-account-setting \
    --name {{serviceLongArnFormat}} \
    --principal-arn {{arn:aws:iam::123456789012:user/MyUser}}
```
출력:  

```
{
    "setting": {
        "name": "serviceLongArnFormat",
        "value": "enabled",
        "principalArn": "arn:aws:iam::123456789012:user/MyUser"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon 리소스 이름(ARN) 및 ID](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-resource-ids.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteAccountSetting](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-account-setting.html) 섹션을 참조하세요.

### `delete-attributes`
<a name="ecs_DeleteAttributes_cli_2_topic"></a>

다음 코드 예시는 `delete-attributes`의 사용 방법을 보여줍니다.

**AWS CLI**  
**Amazon ECS 리소스에서 하나 이상의 사용자 지정 속성을 삭제하려면**  
다음 `delete-attributes`는 컨테이너 인스턴스에서 이름이 `stack`인 속성을 삭제합니다.  

```
aws ecs delete-attributes \
    --attributes {{name=stack,targetId=arn:aws:ecs:us-west-2:130757420319:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34}}
```
출력:  

```
{
    "attributes": [
        {
            "name": "stack",
            "targetId": "arn:aws:ecs:us-west-2:130757420319:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34",
            "value": "production"
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-attributes.html) 섹션을 참조하세요.

### `delete-capacity-provider`
<a name="ecs_DeleteCapacityProvider_cli_2_topic"></a>

다음 코드 예시는 `delete-capacity-provider`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: Amazon 리소스 이름(ARN)을 사용하여 용량 공급자를 삭제하려면**  
다음 `delete-capacity-provider` 예시에서는 용량 공급자의 Amazon 리소스 이름(ARN)을 지정하여 용량 공급자를 삭제합니다. `describe-capacity-providers` 명령을 사용하여 용량 공급자 삭제 상태뿐만 아니라 ARN도 검색할 수 있습니다.  

```
aws ecs delete-capacity-provider \
    --capacity-provider {{arn:aws:ecs:us-west-2:123456789012:capacity-provider/ExampleCapacityProvider}}
```
출력:  

```
{
    "capacityProvider": {
        "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/ExampleCapacityProvider",
        "name": "ExampleCapacityProvider",
        "status": "ACTIVE",
        "autoScalingGroupProvider": {
            "autoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup",
            "managedScaling": {
                "status": "ENABLED",
                "targetCapacity": 100,
                "minimumScalingStepSize": 1,
                "maximumScalingStepSize": 10000
            },
            "managedTerminationProtection": "DISABLED"
        },
        "updateStatus": "DELETE_IN_PROGRESS",
        "tags": []
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
**예시 2: 이름을 사용하여 용량 공급자를 삭제하려면**  
다음 `delete-capacity-provider` 예시에서는 용량 공급자의 짧은 이름을 지정하여 용량 공급자를 삭제합니다. `describe-capacity-providers` 명령을 사용하여 용량 공급자 삭제 상태뿐만 아니라 짧은 이름도 검색할 수 있습니다.  

```
aws ecs delete-capacity-provider \
    --capacity-provider {{ExampleCapacityProvider}}
```
출력:  

```
{
    "capacityProvider": {
        "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/ExampleCapacityProvider",
        "name": "ExampleCapacityProvider",
        "status": "ACTIVE",
        "autoScalingGroupProvider": {
            "autoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup",
            "managedScaling": {
                "status": "ENABLED",
                "targetCapacity": 100,
                "minimumScalingStepSize": 1,
                "maximumScalingStepSize": 10000
            },
            "managedTerminationProtection": "DISABLED"
        },
        "updateStatus": "DELETE_IN_PROGRESS",
        "tags": []
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteCapacityProvider](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-capacity-provider.html) 섹션을 참조하세요.

### `delete-cluster`
<a name="ecs_DeleteCluster_cli_2_topic"></a>

다음 코드 예시는 `delete-cluster`의 사용 방법을 보여줍니다.

**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 개발자 안내서*의 [클러스터 삭제](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/delete_cluster.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-cluster.html)를 참조하세요.

### `delete-service`
<a name="ecs_DeleteService_cli_2_topic"></a>

다음 코드 예시는 `delete-service`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스 삭제**  
다음 `ecs delete-service` 예시에서는 클러스터에서 지정된 서비스를 삭제합니다. `--force` 파라미터를 포함하면 태스크가 없도록 축소되지 않은 서비스도 삭제할 수 있습니다.  

```
aws ecs delete-service --cluster {{MyCluster}} --service {{MyService1}} --force
```
자세한 정보는 *Amazon ECS 개발자 안내서*의 [서비스 삭제하기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/delete-service.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteService](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-service.html)를 참조하세요.

### `delete-task-definitions`
<a name="ecs_DeleteTaskDefinitions_cli_2_topic"></a>

다음 코드 예시는 `delete-task-definitions`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 정의를 삭제하려면**  
다음 `delete-task-definitions` 예시에서는 INACTIVE 작업 정의를 삭제합니다.  

```
aws ecs delete-task-definitions \
    --task-definition {{curltest:1}}
```
출력:  

```
{
"taskDefinitions": [
    {
        "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/curltest:1",
        "containerDefinitions": [
            {
                "name": "ctest",
                "image": "mreferre/eksutils",
                "cpu": 0,
                "portMappings": [],
                "essential": true,
                "entryPoint": [
                    "sh",
                    "-c"
                ],
                "command": [
                    "curl ${ECS_CONTAINER_METADATA_URI_V4}/task"
                ],
                "environment": [],
                "mountPoints": [],
                "volumesFrom": [],
                "logConfiguration": {
                    "logDriver": "awslogs",
                    "options": {
                        "awslogs-create-group": "true",
                        "awslogs-group": "/ecs/curltest",
                        "awslogs-region": "us-east-1",
                        "awslogs-stream-prefix": "ecs"
                    }
                }
            }
        ],
        "family": "curltest",
        "taskRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
        "executionRoleArn": "arn:aws:iam::123456789012:role/ecsTaskExecutionRole",
        "networkMode": "awsvpc",
        "revision": 1,
        "volumes": [],
        "status": "DELETE_IN_PROGRESS",
        "compatibilities": [
            "EC2",
            "FARGATE"
        ],
        "requiresCompatibilities": [
            "FARGATE"
        ],
        "cpu": "256",
        "memory": "512",
        "registeredAt": "2021-09-10T12:56:24.704000+00:00",
        "deregisteredAt": "2023-03-14T15:20:59.419000+00:00",
        "registeredBy": "arn:aws:sts::123456789012:assumed-role/Admin/jdoe"
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteTaskDefinitions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-task-definitions.html) 섹션을 참조하세요.

### `delete-task-set`
<a name="ecs_DeleteTaskSet_cli_2_topic"></a>

다음 코드 예시는 `delete-task-set`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 세트를 삭제하려면**  
다음 `delete-task-set` 예시에서는 작업 세트를 삭제하는 방법을 보여줍니다. 작업 세트가 0으로 규모 조정되지 않은 경우에도 `--force` 파라미터를 포함하여 삭제할 수 있습니다.  

```
aws ecs delete-task-set \
    --cluster {{MyCluster}} \
    --service {{MyService}} \
    --task-set {{arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789}} \
    --force
```
출력:  

```
{
    "taskSet": {
        "id": "ecs-svc/1234567890123456789",
        "taskSetArn": "arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789",
        "status": "DRAINING",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:2",
        "computedDesiredCount": 0,
        "pendingCount": 0,
        "runningCount": 0,
        "createdAt": 1557130260.276,
        "updatedAt": 1557130290.707,
        "launchType": "EC2",
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12345678"
                ],
                "securityGroups": [
                    "sg-12345678"
                ],
                "assignPublicIp": "DISABLED"
            }
        },
        "loadBalancers": [],
        "serviceRegistries": [],
        "scale": {
            "value": 0.0,
            "unit": "PERCENT"
        },
        "stabilityStatus": "STABILIZING",
        "stabilityStatusAt": 1557130290.707
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteTaskSet](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/delete-task-set.html) 섹션을 참조하세요.

### `deregister-container-instance`
<a name="ecs_DeregisterContainerInstance_cli_2_topic"></a>

다음 코드 예시는 `deregister-container-instance`의 사용 방법을 보여줍니다.

**AWS CLI**  
**클러스터에서 컨테이너 인스턴스 등록을 취소하려면**  
다음 `deregister-container-instance` 예시에서는 지정된 클러스터에서 컨테이너 인스턴스를 등록 취소합니다. 컨테이너 인스턴스에서 아직 실행 중인 작업이 있는 경우 등록을 취소하기 전에 해당 작업을 중지하거나 `--force` 옵션을 사용해야 합니다.  

```
aws ecs deregister-container-instance \
    --cluster {{arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster}} \
    --container-instance {{arn:aws:ecs:us-west-2:123456789012:container-instance/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE}} \
    --force
```
출력:  

```
{
    "containerInstance": {
        "remainingResources": [
            {
                "integerValue": 1024,
                "doubleValue": 0.0,
                "type": "INTEGER",
                "longValue": 0,
                "name": "CPU"
            },
            {
                "integerValue": 985,
                "doubleValue": 0.0,
                "type": "INTEGER",
                "longValue": 0,
                "name": "MEMORY"
            },
            {
                "type": "STRINGSET",
                "integerValue": 0,
                "name": "PORTS",
                "stringSetValue": [
                    "22",
                    "2376",
                    "2375",
                    "51678",
                    "51679"
                ],
                "longValue": 0,
                "doubleValue": 0.0
            },
            {
                "type": "STRINGSET",
                "integerValue": 0,
                "name": "PORTS_UDP",
                "stringSetValue": [],
                "longValue": 0,
                "doubleValue": 0.0
            }
        ],
        "agentConnected": true,
        "attributes": [
            {
                "name": "ecs.capability.secrets.asm.environment-variables"
            },
            {
                "name": "com.amazonaws.ecs.capability.logging-driver.syslog"
            },
            {
                "value": "ami-01a82c3fce2c3ba58",
                "name": "ecs.ami-id"
            },
            {
                "name": "ecs.capability.secrets.asm.bootstrap.log-driver"
            },
            {
                "name": "com.amazonaws.ecs.capability.logging-driver.none"
            },
            {
                "name": "ecs.capability.ecr-endpoint"
            },
            {
                "name": "com.amazonaws.ecs.capability.logging-driver.json-file"
            },
            {
                "value": "vpc-1234567890123467",
                "name": "ecs.vpc-id"
            },
            {
                "name": "ecs.capability.execution-role-awslogs"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
            },
            {
                "name": "ecs.capability.docker-plugin.local"
            },
            {
                "name": "ecs.capability.task-eni"
            },
            {
                "name": "ecs.capability.task-cpu-mem-limit"
            },
            {
                "name": "ecs.capability.secrets.ssm.bootstrap.log-driver"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.30"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.31"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.32"
            },
            {
                "name": "ecs.capability.execution-role-ecr-pull"
            },
            {
                "name": "ecs.capability.container-health-check"
            },
            {
                "value": "subnet-1234567890123467",
                "name": "ecs.subnet-id"
            },
            {
                "value": "us-west-2a",
                "name": "ecs.availability-zone"
            },
            {
                "value": "t2.micro",
                "name": "ecs.instance-type"
            },
            {
                "name": "com.amazonaws.ecs.capability.task-iam-role-network-host"
            },
            {
                "name": "ecs.capability.aws-appmesh"
            },
            {
                "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.24"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.26"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.27"
            },
            {
                "name": "com.amazonaws.ecs.capability.privileged-container"
            },
            {
                "name": "ecs.capability.container-ordering"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
            },
            {
                "value": "x86_64",
                "name": "ecs.cpu-architecture"
            },
            {
                "value": "93f43776-2018.10.0",
                "name": "ecs.capability.cni-plugin-version"
            },
            {
                "name": "ecs.capability.secrets.ssm.environment-variables"
            },
            {
                "name": "ecs.capability.pid-ipc-namespace-sharing"
            },
            {
                "name": "com.amazonaws.ecs.capability.ecr-auth"
            },
            {
                "value": "linux",
                "name": "ecs.os-type"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.20"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.22"
            },
            {
                "name": "ecs.capability.task-eia"
            },
            {
                "name": "ecs.capability.private-registry-authentication.secretsmanager"
            },
            {
                "name": "com.amazonaws.ecs.capability.task-iam-role"
            },
            {
                "name": "com.amazonaws.ecs.capability.docker-remote-api.1.23"
            }
        ],
        "pendingTasksCount": 0,
        "tags": [],
        "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
        "registeredResources": [
            {
                "integerValue": 1024,
                "doubleValue": 0.0,
                "type": "INTEGER",
                "longValue": 0,
                "name": "CPU"
            },
            {
                "integerValue": 985,
                "doubleValue": 0.0,
                "type": "INTEGER",
                "longValue": 0,
                "name": "MEMORY"
            },
            {
                "type": "STRINGSET",
                "integerValue": 0,
                "name": "PORTS",
                "stringSetValue": [
                    "22",
                    "2376",
                    "2375",
                    "51678",
                    "51679"
                ],
                "longValue": 0,
                "doubleValue": 0.0
            },
            {
                "type": "STRINGSET",
                "integerValue": 0,
                "name": "PORTS_UDP",
                "stringSetValue": [],
                "longValue": 0,
                "doubleValue": 0.0
            }
        ],
        "status": "INACTIVE",
        "registeredAt": 1557768075.681,
        "version": 4,
        "versionInfo": {
            "agentVersion": "1.27.0",
            "agentHash": "aabe65ee",
            "dockerVersion": "DockerVersion: 18.06.1-ce"
        },
        "attachments": [],
        "runningTasksCount": 0,
        "ec2InstanceId": "i-12345678901234678"
    }
}
```
자세한 내용은 *ECS 개발자 안내서*의 [Deregister a Container Instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deregister_container_instance.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeregisterContainerInstance](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/deregister-container-instance.html) 섹션을 참조하세요.

### `deregister-task-definition`
<a name="ecs_DeregisterTaskDefinition_cli_2_topic"></a>

다음 코드 예시는 `deregister-task-definition`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 정의를 등록 취소하려면**  
다음 `deregister-task-definition` 예시에서는 기본 리전에서 `curler` 작업 정의의 첫 번째 개정을 등록 취소합니다.  

```
aws ecs deregister-task-definition --task-definition {{curler:1}}
```
결과 출력에서 작업 정의 상태는 `INACTIVE`를 표시합니다.  

```
{
    "taskDefinition": {
        "status": "INACTIVE",
        "family": "curler",
        "volumes": [],
        "taskDefinitionArn": "arn:aws:ecs:us-west-2:123456789012:task-definition/curler:1",
        "containerDefinitions": [
            {
                "environment": [],
                "name": "curler",
                "mountPoints": [],
                "image": "curl:latest",
                "cpu": 100,
                "portMappings": [],
                "entryPoint": [],
                "memory": 256,
                "command": [
                    "curl -v http://example.com/"
                ],
                "essential": true,
                "volumesFrom": []
            }
        ],
        "revision": 1
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeregisterTaskDefinition](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/deregister-task-definition.html) 섹션을 참조하세요.

### `describe-capacity-providers`
<a name="ecs_DescribeCapacityProviders_cli_2_topic"></a>

다음 코드 예시는 `describe-capacity-providers`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 모든 용량 공급자를 설명하려면**  
다음 `describe-capacity-providers` 예시에서는 모든 용량 공급자에 대한 세부 정보를 검색합니다.  

```
aws ecs describe-capacity-providers
```
출력:  

```
{
    "capacityProviders": [
        {
            "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/MyCapacityProvider",
            "name": "MyCapacityProvider",
            "status": "ACTIVE",
            "autoScalingGroupProvider": {
                "autoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup",
                "managedScaling": {
                    "status": "ENABLED",
                    "targetCapacity": 100,
                    "minimumScalingStepSize": 1,
                    "maximumScalingStepSize": 1000
                },
                "managedTerminationProtection": "ENABLED"
            },
            "tags": []
        },
        {
            "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/FARGATE",
            "name": "FARGATE",
            "status": "ACTIVE",
            "tags": []
        },
        {
            "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/FARGATE_SPOT",
            "name": "FARGATE_SPOT",
            "status": "ACTIVE",
            "tags": []
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
**예시 2: 특정 용량 공급자를 설명하려면**  
다음 `describe-capacity-providers` 예시에서는 특정 용량 공급자에 대한 세부 정보를 검색합니다. `--include TAGS` 파라미터를 사용하면 용량 공급자와 연결된 태그가 출력에 추가됩니다.  

```
aws ecs describe-capacity-providers \
    --capacity-providers {{MyCapacityProvider}} \
    --include {{TAGS}}
```
출력:  

```
{
    "capacityProviders": [
        {
            "capacityProviderArn": "arn:aws:ecs:us-west-2:123456789012:capacity-provider/MyCapacityProvider",
            "name": "MyCapacityProvider",
            "status": "ACTIVE",
            "autoScalingGroupProvider": {
                "autoScalingGroupArn": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/MyAutoScalingGroup",
                "managedScaling": {
                    "status": "ENABLED",
                    "targetCapacity": 100,
                    "minimumScalingStepSize": 1,
                    "maximumScalingStepSize": 1000
                },
                "managedTerminationProtection": "ENABLED"
            },
            "tags": [
                {
                    "key": "environment",
                    "value": "production"
                }
            ]
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeCapacityProviders](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-capacity-providers.html) 섹션을 참조하세요.

### `describe-clusters`
<a name="ecs_DescribeClusters_cli_2_topic"></a>

다음 코드 예시는 `describe-clusters`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예 1: 클러스터를 설명하는 방법**  
다음 `describe-clusters` 예시에서는 지정된 클러스터에 대한 세부 정보를 검색합니다.  

```
aws ecs describe-clusters \
    --cluster {{default}}
```
출력:  

```
{
    "clusters": [
        {
            "status": "ACTIVE",
            "clusterName": "default",
            "registeredContainerInstancesCount": 0,
            "pendingTasksCount": 0,
            "runningTasksCount": 0,
            "activeServicesCount": 1,
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default"
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 클러스터](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_clusters.html)를 참조하세요.  
**예 2: 첨부 파일 옵션을 사용하여 클러스터를 설명하는 방법**  
다음 `describe-clusters` 예시에서는 ATTACHMENTS 옵션을 지정합니다. 지정된 클러스터에 대한 세부 정보와 클러스터에 연결된 리소스 목록을 첨부 파일 형식으로 검색합니다. 클러스터와 함께 용량 공급자를 사용하는 경우 AutoScaling 계획 또는 크기 조정 정책과 같은 리소스는 asp 또는 as\_policy ATCHEMENTS로 표시됩니다.  

```
aws ecs describe-clusters \
    --include {{ATTACHMENTS}} \
    --clusters {{sampleCluster}}
```
출력:  

```
{
    "clusters": [
        {
            "clusterArn": "arn:aws:ecs:af-south-1:123456789222:cluster/sampleCluster",
            "clusterName": "sampleCluster",
            "status": "ACTIVE",
            "registeredContainerInstancesCount": 0,
            "runningTasksCount": 0,
            "pendingTasksCount": 0,
            "activeServicesCount": 0,
            "statistics": [],
            "tags": [],
            "settings": [],
            "capacityProviders": [
                "sampleCapacityProvider"
            ],
            "defaultCapacityProviderStrategy": [],
            "attachments": [
                {
                    "id": "a1b2c3d4-5678-901b-cdef-EXAMPLE22222",
                    "type": "as_policy",
                    "status": "CREATED",
                    "details": [
                        {
                            "name": "capacityProviderName",
                            "value": "sampleCapacityProvider"
                        },
                        {
                            "name": "scalingPolicyName",
                            "value": "ECSManagedAutoScalingPolicy-3048e262-fe39-4eaf-826d-6f975d303188"
                        }
                    ]
                }
            ],
            "attachmentsStatus": "UPDATE_COMPLETE"
        }
    ],
    "failures": []
}
```
자세한 내용은 **Amazon ECS 개발자 안내서의 [Amazon ECS 클러스터](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_clusters.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeClusters](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-clusters.html)를 참조하세요.

### `describe-container-instances`
<a name="ecs_DescribeContainerInstances_cli_2_topic"></a>

다음 코드 예시는 `describe-container-instances`의 사용 방법을 보여줍니다.

**AWS CLI**  
**컨테이너 인스턴스를 설명하려면**  
다음 `describe-container-instances` 예시에서는 컨테이너 인스턴스 UUID를 식별자로 사용하여 `update` 클러스터의 컨테이너 인스턴스에 대한 세부 정보를 검색합니다.  

```
aws ecs describe-container-instances \
    --cluster {{update}} \
    --container-instances {{a1b2c3d4-5678-90ab-cdef-11111EXAMPLE}}
```
출력:  

```
{
    "failures": [],
    "containerInstances": [
        {
            "status": "ACTIVE",
            "registeredResources": [
                {
                    "integerValue": 2048,
                    "longValue": 0,
                    "type": "INTEGER",
                    "name": "CPU",
                    "doubleValue": 0.0
                },
                {
                    "integerValue": 3955,
                    "longValue": 0,
                    "type": "INTEGER",
                    "name": "MEMORY",
                    "doubleValue": 0.0
                },
                {
                    "name": "PORTS",
                    "longValue": 0,
                    "doubleValue": 0.0,
                    "stringSetValue": [
                        "22",
                        "2376",
                        "2375",
                        "51678"
                    ],
                    "type": "STRINGSET",
                    "integerValue": 0
                }
            ],
            "ec2InstanceId": "i-A1B2C3D4",
            "agentConnected": true,
            "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
            "pendingTasksCount": 0,
            "remainingResources": [
                {
                    "integerValue": 2048,
                    "longValue": 0,
                    "type": "INTEGER",
                    "name": "CPU",
                    "doubleValue": 0.0
                },
                {
                    "integerValue": 3955,
                    "longValue": 0,
                    "type": "INTEGER",
                    "name": "MEMORY",
                    "doubleValue": 0.0
                },
                {
                    "name": "PORTS",
                    "longValue": 0,
                    "doubleValue": 0.0,
                    "stringSetValue": [
                        "22",
                        "2376",
                        "2375",
                        "51678"
                    ],
                    "type": "STRINGSET",
                    "integerValue": 0
                }
            ],
            "runningTasksCount": 0,
            "versionInfo": {
                "agentVersion": "1.0.0",
                "agentHash": "4023248",
                "dockerVersion": "DockerVersion: 1.5.0"
            }
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 컨테이너 인스턴스](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeContainerInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-container-instances.html) 섹션을 참조하세요.

### `describe-service-deployments`
<a name="ecs_DescribeServiceDeployments_cli_2_topic"></a>

다음 코드 예시는 `describe-service-deployments`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스 배포 세부 정보를 설명하려면**  
다음 `describe-service-deployments` 예제에서는 `arn:aws:ecs:us-east-1:123456789012:service-deployment/example-cluster/example-service/ejGvqq2ilnbKT9qj0vLJe` ARN을 사용한 서비스 배포에 대한 서비스 배포 세부 정보를 반환합니다.  

```
aws ecs describe-service-deployments \
    --service-deployment-arn {{arn:aws:ecs:us-east-1:123456789012:service-deployment/example-cluster/example-service/ejGvqq2ilnbKT9qj0vLJe}}
```
출력:  

```
{
    "serviceDeployments": [
        {
            "serviceDeploymentArn": "arn:aws:ecs:us-east-1:123456789012:service-deployment/example-cluster/example-service/ejGvqq2ilnbKT9qj0vLJe",
            "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/example-cluster/example-service",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster",
            "createdAt": "2024-10-31T08:03:30.917000-04:00",
            "startedAt": "2024-10-31T08:03:32.510000-04:00",
            "finishedAt": "2024-10-31T08:05:04.527000-04:00",
            "updatedAt": "2024-10-31T08:05:04.527000-04:00",
            "sourceServiceRevisions": [],
            "targetServiceRevision": {
                "arn": "arn:aws:ecs:us-east-1:123456789012:service-revision/example-cluster/example-service/1485800978477494678",
                "requestedTaskCount": 1,
                "runningTaskCount": 1,
                "pendingTaskCount": 0
            },
            "status": "SUCCESSFUL",
            "deploymentConfiguration": {
                "deploymentCircuitBreaker": {
                    "enable": true,
                    "rollback": true
                },
                "maximumPercent": 200,
                "minimumHealthyPercent": 100,
                "alarms": {
                    "alarmNames": [],
                    "rollback": false,
                    "enable": false
                }
            },
            "deploymentCircuitBreaker": {
                "status": "MONITORING_COMPLETE",
                "failureCount": 0,
                "threshold": 3
            },
            "alarms": {
                "status": "DISABLED"
            }
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 서비스 배포를 사용하여 서비스 기록 보기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-deployment.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeServiceDeployments](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-service-deployments.html) 섹션을 참조하세요.

### `describe-service-revisions`
<a name="ecs_DescribeServiceRevisions_cli_2_topic"></a>

다음 코드 예시는 `describe-service-revisions`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스 개정 세부 정보를 설명하려면**  
다음 `describe-service-revisions` 예제에서는 `arn:aws:ecs:us-east-1:123456789012:service-revision/example-cluster/example-service/1485800978477494678` ARN을 사용하여 서비스 개정에 대한 서비스 개정 세부 정보를 반환합니다.  

```
aws ecs describe-service-revisions \
    --service-revision-arns {{arn:aws:ecs:us-east-1:123456789012:service-revision/example-cluster/example-service/1485800978477494678}}
```
출력:  

```
{
    "serviceRevisions": [
        {
            "serviceRevisionArn": "arn:aws:ecs:us-east-1:123456789012:service-revision/example-cluster/example-service/1485800978477494678",
            "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/example-cluster/example-service",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster",
            "taskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/webserver:5",
            "capacityProviderStrategy": [
                {
                    "capacityProvider": "FARGATE",
                    "weight": 1,
                    "base": 0
                }
            ],
            "platformVersion": "1.4.0",
            "platformFamily": "Linux",
            "networkConfiguration": {
                "awsvpcConfiguration": {
                    "subnets": [
                        "subnet-0d0eab1bb38d5ca64",
                        "subnet-0db5010045995c2d5"
                    ],
                    "securityGroups": [
                        "sg-02556bf85a191f59a"
                    ],
                    "assignPublicIp": "ENABLED"
                }
            },
            "containerImages": [
                {
                    "containerName": "aws-otel-collector",
                    "imageDigest": "sha256:7a1b3560655071bcacd66902c20ebe9a69470d5691fe3bd36baace7c2f3c4640",
                    "image": "public.ecr.aws/aws-observability/aws-otel-collector:v0.32.0"
                },
                {
                    "containerName": "web",
                    "imageDigest": "sha256:28402db69fec7c17e179ea87882667f1e054391138f77ffaf0c3eb388efc3ffb",
                    "image": "nginx"
                }
            ],
            "guardDutyEnabled": false,
            "serviceConnectConfiguration": {
                "enabled": false
            },
            "createdAt": "2024-10-31T08:03:29.302000-04:00"
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 서비스 개정](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-revision.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeServiceRevisions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-service-revisions.html) 섹션을 참조하세요.

### `describe-services`
<a name="ecs_DescribeServices_cli_2_topic"></a>

다음 코드 예시는 `describe-services`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스를 설명하려면**  
다음 `describe-services` 예시에서는 기본 클러스터의 `my-http-service` 서비스에 대한 세부 정보를 검색합니다.  

```
aws ecs describe-services --services {{my-http-service}}
```
출력:  

```
{
    "services": [
        {
            "status": "ACTIVE",
            "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/amazon-ecs-sample:1",
            "pendingCount": 0,
            "loadBalancers": [],
            "desiredCount": 10,
            "createdAt": 1466801808.595,
            "serviceName": "my-http-service",
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default",
            "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/my-http-service",
            "deployments": [
                {
                    "status": "PRIMARY",
                    "pendingCount": 0,
                    "createdAt": 1466801808.595,
                    "desiredCount": 10,
                    "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/amazon-ecs-sample:1",
                    "updatedAt": 1428326312.703,
                    "id": "ecs-svc/1234567890123456789",
                    "runningCount": 10
                }
            ],
            "events": [
                {
                    "message": "(service my-http-service) has reached a steady state.",
                    "id": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
                    "createdAt": 1466801812.435
                }
            ],
            "runningCount": 10
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [서비스](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeServices](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-services.html)를 참조하세요.

### `describe-task-definition`
<a name="ecs_DescribeTaskDefinition_cli_2_topic"></a>

다음 코드 예시는 `describe-task-definition`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 정의를 설명하려면**  
다음 `describe-task-definition` 예시에서는 작업 정의의 세부 정보를 검색합니다.  

```
aws ecs describe-task-definition \
    --task-definition {{hello_world:8}}
```
출력:  

```
{
    "taskDefinition": {
        "taskDefinitionArn": "arn:aws:ecs:us-east-1:012345678910:task-definition/hello_world:8",
        "containerDefinitions": [
            {
                "cpu": 10,
                "environment": [],
                "essential": true,
                "image": "wordpress",
                "links": [
                    "mysql"
                ] ,
                "memory": 500,
                "mountPoints": [],
                "name": "wordpress",
                "portMappings": [
                    {
                        "containerPort": 80,
                        "hostPort": 80
                    }
                ],
                "volumesFrom": []
            },
            {
                "cpu": 10,
                "environment": [
                    {
                        "name": "MYSQL_ROOT_PASSWORD",
                        "value": "password"
                    }
                ],
                "essential": true,
                "image": "mysql",
                "memory": 500,
                "mountPoints": [],
                "name": "mysql",
                "portMappings": [],
                "volumesFrom": []
            }
        ],
    "family": "hello_world",
    "revision": 8,
    "volumes": [],
    "status": "ACTIVE",
    "placementConstraints": [],
    "compatibilities": [
        "EXTERNAL",
        "EC2"
    ],
    "registeredAt": "2024-06-21T11:15:12.669000-05:00",
    "registeredBy": "arn:aws:sts::012345678910:assumed-role/demo-role/jane-doe"
    },
    "tags": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeTaskDefinition](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-task-definition.html) 섹션을 참조하세요.

### `describe-task-sets`
<a name="ecs_DescribeTaskSets_cli_2_topic"></a>

다음 코드 예시는 `describe-task-sets`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 세트를 설명하려면**  
다음 `describe-task-sets` 예시에서는 외부 배포자를 사용하는 서비스에서 설정된 작업을 설명합니다.  

```
aws ecs describe-task-sets \
    --cluster {{MyCluster}} \
    --service {{MyService}} \
    --task-sets {{arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789}}
```
출력:  

```
{
    "taskSets": [
        {
            "id": "ecs-svc/1234567890123456789",
            "taskSetArn": "arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789",
            "status": "ACTIVE",
            "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:2",
            "computedDesiredCount": 0,
            "pendingCount": 0,
            "runningCount": 0,
            "createdAt": 1557207715.195,
            "updatedAt": 1557207740.014,
            "launchType": "EC2",
            "networkConfiguration": {
                "awsvpcConfiguration": {
                    "subnets": [
                        "subnet-12344321"
                    ],
                    "securityGroups": [
                        "sg-1234431"
                    ],
                    "assignPublicIp": "DISABLED"
                }
            },
            "loadBalancers": [],
            "serviceRegistries": [],
            "scale": {
                "value": 0.0,
                "unit": "PERCENT"
            },
            "stabilityStatus": "STEADY_STATE",
            "stabilityStatusAt": 1557207740.014
        }
    ],
    "failures": []
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeTaskSets](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-task-sets.html) 섹션을 참조하세요.

### `describe-tasks`
<a name="ecs_DescribeTasks_cli_2_topic"></a>

다음 코드 예시는 `describe-tasks`의 사용 방법을 보여 줍니다.

**AWS CLI**  
**예제 1: 단일 태스크를 설명하는 방법**  
다음 `describe-tasks` 예시에서는 클러스터의 태스크 세부 정보를 검색합니다. 태스크의 ID 또는 전체 ARN을 사용하여 태스크를 지정할 수 있습니다. 이 예시에서는 태스크의 전체 ARN을 사용합니다.  

```
aws ecs describe-tasks \
    --cluster {{MyCluster}} \
    --tasks {{arn:aws:ecs:us-east-1:123456789012:task/MyCluster/4d590253bb114126b7afa7b58EXAMPLE}}
```
출력:  

```
{
    "tasks": [
        {
            "attachments": [],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-east-1b",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
            "connectivity": "CONNECTED",
            "connectivityAt": "2021-08-11T12:21:26.681000-04:00",
            "containerInstanceArn": "arn:aws:ecs:us-east-1:123456789012:container-instance/test/025c7e2c5e054a6790a29fc1fEXAMPLE",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-east-1:123456789012:container/MyCluster/4d590253bb114126b7afa7b58eea9221/a992d1cc-ea46-474a-b6e8-24688EXAMPLE",
                    "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/4d590253bb114126b7afa7b58EXAMPLE",
                    "name": "simple-app",
                    "image": "httpd:2.4",
                    "runtimeId": "91251eed27db90006ad67b1a08187290869f216557717dd5c39b37c94EXAMPLE",
                    "lastStatus": "RUNNING",
                    "networkBindings": [
                        {
                            "bindIP": "0.0.0.0",
                            "containerPort": 80,
                            "hostPort": 80,
                            "protocol": "tcp"
                        }
                    ],
                    "networkInterfaces": [],
                    "healthStatus": "UNKNOWN",
                    "cpu": "10",
                    "memory": "300"
                }
            ],
            "cpu": "10",
            "createdAt": "2021-08-11T12:21:26.681000-04:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "service:testupdate",
            "healthStatus": "UNKNOWN",
            "lastStatus": "RUNNING",
            "launchType": "EC2",
            "memory": "300",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "simple-app"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
            "pullStartedAt": "2021-08-11T12:21:28.234000-04:00",
            "pullStoppedAt": "2021-08-11T12:21:33.793000-04:00",
            "startedAt": "2021-08-11T12:21:34.945000-04:00",
            "startedBy": "ecs-svc/968695068243EXAMPLE",
            "tags": [],
            "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/4d590253bb114126b7afa7b58eea9221",
            "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/console-sample-app-static2:1",
            "version": 2
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
**예제 2: 여러 태스크를 설명하는 방법**  
다음 `describe-tasks` 예시에서는 클러스터에 있는 여러 태스크의 세부 정보를 검색합니다. 태스크의 ID 또는 전체 ARN을 사용하여 태스크를 지정할 수 있습니다. 이 예시에서는 태스크의 전체 ID를 사용합니다.  

```
aws ecs describe-tasks \
    --cluster {{MyCluster}} \
    --tasks {{"74de0355a10a4f979ac495c14EXAMPLE"}} {{"d789e94343414c25b9f6bd59eEXAMPLE"}}
```
출력:  

```
{
    "tasks": [
        {
            "attachments": [
                {
                    "id": "d9e7735a-16aa-4128-bc7a-b2d51EXAMPLE",
                    "type": "ElasticNetworkInterface",
                    "status": "ATTACHED",
                    "details": [
                        {
                            "name": "subnetId",
                            "value": "subnet-0d0eab1bb3EXAMPLE"
                        },
                        {
                            "name": "networkInterfaceId",
                            "value": "eni-0fa40520aeEXAMPLE"
                        },
                        {
                            "name": "macAddress",
                            "value": "0e:89:76:28:07:b3"
                        },
                        {
                            "name": "privateDnsName",
                            "value": "ip-10-0-1-184.ec2.internal"
                        },
                        {
                            "name": "privateIPv4Address",
                            "value": "10.0.1.184"
                        }
                    ]
                }
            ],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-east-1b",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
            "connectivity": "CONNECTED",
            "connectivityAt": "2021-12-20T12:13:37.875000-05:00",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-east-1:123456789012:container/MyCluster/74de0355a10a4f979ac495c14EXAMPLE/aad3ba00-83b3-4dac-84d4-11f8cEXAMPLE",
                    "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/74de0355a10a4f979ac495c14EXAMPLE",
                    "name": "web",
                    "image": "nginx",
                    "runtimeId": "74de0355a10a4f979ac495c14EXAMPLE-265927825",
                    "lastStatus": "RUNNING",
                    "networkBindings": [],
                    "networkInterfaces": [
                        {
                            "attachmentId": "d9e7735a-16aa-4128-bc7a-b2d51EXAMPLE",
                            "privateIpv4Address": "10.0.1.184"
                        }
                    ],
                    "healthStatus": "UNKNOWN",
                    "cpu": "99",
                    "memory": "100"
                }
            ],
            "cpu": "256",
            "createdAt": "2021-12-20T12:13:20.226000-05:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "service:tdsevicetag",
            "healthStatus": "UNKNOWN",
            "lastStatus": "RUNNING",
            "launchType": "FARGATE",
            "memory": "512",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "web"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
            "platformVersion": "1.4.0",
            "platformFamily": "Linux",
            "pullStartedAt": "2021-12-20T12:13:42.665000-05:00",
            "pullStoppedAt": "2021-12-20T12:13:46.543000-05:00",
            "startedAt": "2021-12-20T12:13:48.086000-05:00",
            "startedBy": "ecs-svc/988401040018EXAMPLE",
            "tags": [],
            "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/74de0355a10a4f979ac495c14EXAMPLE",
            "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/webserver:2",
            "version": 3,
            "ephemeralStorage": {
            "sizeInGiB": 20
            }
        },
        {
            "attachments": [
                {
                    "id": "214eb5a9-45cd-4bf8-87bc-57fefEXAMPLE",
                    "type": "ElasticNetworkInterface",
                    "status": "ATTACHED",
                    "details": [
                        {
                            "name": "subnetId",
                            "value": "subnet-0d0eab1bb3EXAMPLE"
                        },
                        {
                            "name": "networkInterfaceId",
                            "value": "eni-064c7766daEXAMPLE"
                        },
                        {
                            "name": "macAddress",
                            "value": "0e:76:83:01:17:a9"
                        },
                        {
                            "name": "privateDnsName",
                            "value": "ip-10-0-1-41.ec2.internal"
                        },
                        {
                            "name": "privateIPv4Address",
                            "value": "10.0.1.41"
                        }
                    ]
                }
            ],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-east-1b",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
            "connectivity": "CONNECTED",
            "connectivityAt": "2021-12-20T12:13:35.243000-05:00",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-east-1:123456789012:container/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE/9afef792-609b-43a5-bb6a-3efdbEXAMPLE",
                    "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE",
                    "name": "web",
                    "image": "nginx",
                    "runtimeId": "d789e94343414c25b9f6bd59eEXAMPLE-265927825",
                    "lastStatus": "RUNNING",
                    "networkBindings": [],
                    "networkInterfaces": [
                        {
                            "attachmentId": "214eb5a9-45cd-4bf8-87bc-57fefEXAMPLE",
                            "privateIpv4Address": "10.0.1.41"
                        }
                    ],
                    "healthStatus": "UNKNOWN",
                    "cpu": "99",
                    "memory": "100"
                }
            ],
            "cpu": "256",
            "createdAt": "2021-12-20T12:13:20.226000-05:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "service:tdsevicetag",
            "healthStatus": "UNKNOWN",
            "lastStatus": "RUNNING",
            "launchType": "FARGATE",
            "memory": "512",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "web"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
            "platformVersion": "1.4.0",
            "platformFamily": "Linux",
            "pullStartedAt": "2021-12-20T12:13:44.611000-05:00",
            "pullStoppedAt": "2021-12-20T12:13:48.251000-05:00",
            "startedAt": "2021-12-20T12:13:49.326000-05:00",
            "startedBy": "ecs-svc/988401040018EXAMPLE",
            "tags": [],
            "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE",
            "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/webserver:2",
            "version": 3,
            "ephemeralStorage": {
                "sizeInGiB": 20
            }
        }
    ],
    "failures": []
}
```
자세한 내용은 **Amazon ECS 개발자 안내서의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 **AWS CLI 명령 참조의 [DescribeTasks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/describe-tasks.html)를 참조하세요.

### `execute-command`
<a name="ecs_ExecuteCommand_cli_2_topic"></a>

다음 코드 예시는 `execute-command`의 사용 방법을 보여줍니다.

**AWS CLI**  
**대화형 /bin/sh 명령을 실행하려면**  
다음 `execute-command` 예시에서는 MyContainer라는 컨테이너에 대해 대화형 /bin/sh 명령을 실행하여 ID가 `arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE`인 작업에 대해 실행합니다.  

```
aws ecs execute-command \
    --cluster {{MyCluster}} \
    --task {{arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE}} \
    --container {{MyContainer}} \
    --interactive \
    --command {{"/bin/sh"}}
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 *Amazon ECS 개발자 안내서*의 [디버깅에 Amazon ECS Exec 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ExecuteCommand](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/execute-command.html) 섹션을 참조하세요.

### `get-task-protection`
<a name="ecs_GetTaskProtection_cli_2_topic"></a>

다음 코드 예시는 `get-task-protection`의 사용 방법을 보여줍니다.

**AWS CLI**  
**ECS 서비스에서 작업의 보호 상태 검색**  
다음 `get-task-protection`에서는 Amazon ECS 서비스에 속하는 ECS 작업의 보호 상태를 제공합니다.  

```
aws ecs get-task-protection \
    --cluster {{ECS-project-update-cluster}} \
    --tasks {{c43ed3b1331041f289316f958adb6a24}}
```
출력:  

```
{
    "protectedTasks": [
        {
            "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/c43ed3b1331041f289316f958adb6a24",
            "protectionEnabled": false
        }
    ],
    "failures": []
}
```
작업 보호에 대한 자세한 내용은 *Amazon ECS 개발자 안내서*의 [스케일 인 이벤트로 인해 Amazon ECS 작업이 종료되지 않도록 보호](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-scale-in-protection.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [GetTaskProtection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/get-task-protection.html)을 참조하세요.

### `list-account-settings`
<a name="ecs_ListAccountSettings_cli_2_topic"></a>

다음 코드 예시는 `list-account-settings`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 계정의 계정 설정을 보려면**  
다음 `list-account-settings` 예시에서는 계정에 대한 유효 계정 설정을 표시합니다.  

```
aws ecs list-account-settings --effective-settings
```
출력:  

```
{
    "settings": [
        {
            "name": "containerInstanceLongArnFormat",
            "value": "enabled",
            "principalArn": "arn:aws:iam::123456789012:root"
        },
        {
            "name": "serviceLongArnFormat",
            "value": "enabled",
            "principalArn": "arn:aws:iam::123456789012:root"
        },
        {
            "name": "taskLongArnFormat",
            "value": "enabled",
            "principalArn": "arn:aws:iam::123456789012:root"
        }
    ]
}
```
**예시 2: 특정 IAM 사용자 또는 IAM 역할에 대한 계정 설정을 보려면**  
다음 `list-account-settings` 예시에서는 지정된 IAM 사용자 또는 IAM 역할에 대한 계정 설정을 표시합니다.  

```
aws ecs list-account-settings --principal-arn {{arn:aws:iam::123456789012:user/MyUser}}
```
출력:  

```
{
    "settings": [
        {
            "name": "serviceLongArnFormat",
            "value": "enabled",
            "principalArn": "arn:aws:iam::123456789012:user/MyUser"
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon 리소스 이름(ARN) 및 ID](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-resource-ids.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListAccountSettings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-account-settings.html) 섹션을 참조하세요.

### `list-attributes`
<a name="ecs_ListAttributes_cli_2_topic"></a>

다음 코드 예시는 `list-attributes`의 사용 방법을 보여줍니다.

**AWS CLI**  
**특정 속성을 포함하는 컨테이너 인스턴스를 나열하려면**  
다음 예시에서는 기본 클러스터에 `stack=production` 속성이 있는 컨테이너 인스턴스의 속성을 나열합니다.  

```
aws ecs list-attributes \
    --target-type {{container-instance}} \
    --attribute-name {{stack}} \
    --attribute-value {{production}} \
    --cluster {{default}}
```
출력:  

```
{
    "attributes": [
        {
            "name": "stack",
            "targetId": "arn:aws:ecs:us-west-2:130757420319:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34",
            "value": "production"
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 컨테이너 에이전트 구성](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-config.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-attributes.html) 섹션을 참조하세요.

### `list-clusters`
<a name="ecs_ListClusters_cli_2_topic"></a>

다음 코드 예시는 `list-clusters`의 사용 방법을 보여줍니다.

**AWS CLI**  
**사용 가능한 클러스터를 나열하는 방법**  
다음 `list-clusters` 예시에서는 사용 가능한 클러스터를 모두 나열합니다.  

```
aws ecs list-clusters
```
출력:  

```
{
    "clusterArns": [
        "arn:aws:ecs:us-west-2:123456789012:cluster/MyECSCluster1",
        "arn:aws:ecs:us-west-2:123456789012:cluster/AnotherECSCluster"
    ]
}
```
자세한 내용은 **Amazon ECS 개발자 안내서의 [Amazon ECS 클러스터](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_clusters.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListClusters](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-clusters.html)를 참조하세요.

### `list-container-instances`
<a name="ecs_ListContainerInstances_cli_2_topic"></a>

다음 코드 예시는 `list-container-instances`의 사용 방법을 보여줍니다.

**AWS CLI**  
**클러스터의 컨테이너 인스턴스를 나열하려면**  
다음 `list-container-instances` 예시에서는 클러스터에서 사용 가능한 모든 컨테이너 인스턴스를 나열합니다.  

```
aws ecs list-container-instances --cluster {{MyCluster}}
```
출력:  

```
{
    "containerInstanceArns": [
        "arn:aws:ecs:us-west-2:123456789012:container-instance/MyCluster/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
        "arn:aws:ecs:us-west-2:123456789012:container-instance/MyCluster/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE"
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 컨테이너 인스턴스](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListContainerInstances](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-container-instances.html) 섹션을 참조하세요.

### `list-service-deployments`
<a name="ecs_ListServiceDeployments_cli_2_topic"></a>

다음 코드 예시는 `list-service-deployments`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스 배포를 나열하려면**  
다음 `list-service-deployments` 예제에서는 `example-service`라는 서비스에 대한 서비스 배포를 검색합니다.  

```
aws ecs list-service-deployments \
    --service {{arn:aws:ecs:us-east-1:123456789012:service/example-cluster/example-service}}
```
출력:  

```
{
    "serviceDeployments": [
        {
            "serviceDeploymentArn": "arn:aws:ecs:us-east-1:123456789012:service-deployment/example-cluster/example-service/ejGvqq2ilnbKT9qj0vLJe",
            "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/example-cluster/example-service",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/example-cluster",
            "startedAt": "2024-10-31T08:03:32.510000-04:00",
            "createdAt": "2024-10-31T08:03:30.917000-04:00",
            "finishedAt": "2024-10-31T08:05:04.527000-04:00",
            "targetServiceRevisionArn": "arn:aws:ecs:us-east-1:123456789012:service-revision/example-cluster/example-service/1485800978477494678",
            "status": "SUCCESSFUL"
        }
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 서비스 배포를 사용하여 서비스 기록 보기](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-deployment.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListServiceDeployments](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-service-deployments.html)를 참조하세요.

### `list-services-by-namespace`
<a name="ecs_ListServicesByNamespace_cli_2_topic"></a>

다음 코드 예시는 `list-services-by-namespace`의 사용 방법을 보여줍니다.

**AWS CLI**  
**네임스페이스에 있는 서비스를 나열하려면**  
다음 `list-services-by-namespace` 예시에서는 기본 리전에서 지정된 네임스페이스에 대해 구성된 모든 서비스를 나열합니다.  

```
aws ecs list-services-by-namespace \
    --namespace {{service-connect}}
```
출력:  

```
{
    "serviceArns": [
        "arn:aws:ecs:us-west-2:123456789012:service/MyCluster/MyService",
        "arn:aws:ecs:us-west-2:123456789012:service/tutorial/service-connect-nginx-service"
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Service Connect](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListServicesByNamespace](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-services-by-namespace.html) 섹션을 참조하세요.

### `list-services`
<a name="ecs_ListServices_cli_2_topic"></a>

다음 코드 예시는 `list-services`의 사용 방법을 보여줍니다.

**AWS CLI**  
**클러스터의 서비스를 나열하는 방법**  
다음 `list-services` 예시에서는 클러스터에서 실행되는 서비스를 나열하는 방법을 보여줍니다.  

```
aws ecs list-services --cluster {{MyCluster}}
```
출력:  

```
 {
     "serviceArns": [
         "arn:aws:ecs:us-west-2:123456789012:service/MyCluster/MyService"
     ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [서비스](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListServices](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-services.html)를 참조하세요.

### `list-tags-for-resource`
<a name="ecs_ListTagsForResource_cli_2_topic"></a>

다음 코드 예시는 `list-tags-for-resource`의 사용 방법을 보여줍니다.

**AWS CLI**  
**리소스의 태그를 나열하려면**  
다음 `list-tags-for-resource` 예시에서는 특정 클러스터의 태그를 나열합니다.  

```
aws ecs list-tags-for-resource \
    --resource-arn {{arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster}}
```
출력:  

```
{
    "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value2"
        },
        {
            "key": "key3",
            "value": "value3"
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-tags-for-resource.html) 섹션을 참조하세요.

### `list-task-definition-families`
<a name="ecs_ListTaskDefinitionFamilies_cli_2_topic"></a>

다음 코드 예시는 `list-task-definition-families`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 등록된 작업 정의 패밀리를 나열하려면**  
다음 `list-task-definition-families` 예시에서는 등록된 모든 작업 정의 패밀리를 나열합니다.  

```
aws ecs list-task-definition-families
```
출력:  

```
{
    "families": [
        "node-js-app",
        "web-timer",
        "hpcc",
        "hpcc-c4-8xlarge"
    ]
}
```
**예시 2: 등록된 작업 정의 패밀리를 필터링하려면**  
다음 `list-task-definition-families` 예시에서는 'hpcc'로 시작하는 작업 정의 개정을 나열합니다.  

```
aws ecs list-task-definition-families --family-prefix {{hpcc}}
```
출력:  

```
{
    "families": [
        "hpcc",
        "hpcc-c4-8xlarge"
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [작업 정의 파라미터](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#family) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListTaskDefinitionFamilies](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-task-definition-families.html) 섹션을 참조하세요.

### `list-task-definitions`
<a name="ecs_ListTaskDefinitions_cli_2_topic"></a>

다음 코드 예시는 `list-task-definitions`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 등록된 작업 정의를 나열하려면**  
다음 `list-task-definitions` 예시에서는 등록된 모든 작업 정의를 나열합니다.  

```
aws ecs list-task-definitions
```
출력:  

```
{
    "taskDefinitionArns": [
        "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep300:2",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep360:1",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:3",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:4",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:5",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:6"
    ]
}
```
**예시 2: 패밀리에 등록된 작업 정의를 나열하려면**  
다음 list-task-definitions 예시에서는 지정된 패밀리의 작업 정의 개정을 나열합니다.  

```
aws ecs list-task-definitions --family-prefix {{wordpress}}
```
출력:  

```
{
    "taskDefinitionArns": [
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:3",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:4",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:5",
        "arn:aws:ecs:us-west-2:123456789012:task-definition/wordpress:6"
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [ListTaskDefinitions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-task-definitions.html) 섹션을 참조하세요.

### `list-tasks`
<a name="ecs_ListTasks_cli_2_topic"></a>

다음 코드 예시는 `list-tasks`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예 1: 클러스터의 태스크를 나열하는 방법**  
다음 `list-tasks` 예시에서는 클러스터의 모든 태스크를 나열합니다.  

```
aws ecs list-tasks --cluster {{default}}
```
출력:  

```
{
    "taskArns": [
        "arn:aws:ecs:us-west-2:123456789012:task/a1b2c3d4-5678-90ab-cdef-11111EXAMPLE",
        "arn:aws:ecs:us-west-2:123456789012:task/a1b2c3d4-5678-90ab-cdef-22222EXAMPLE"
    ]
}
```
**예 2: 특정 컨테이너 인스턴스의 태스크를 나열하는 방법**  
다음 `list-tasks` 예시에서는 컨테이너 인스턴스 UUID를 필터로 사용하여 컨테이너 인스턴스의 태스크를 나열합니다.  

```
aws ecs list-tasks --cluster {{default}} --container-instance {{a1b2c3d4-5678-90ab-cdef-33333EXAMPLE}}
```
출력:  

```
{
    "taskArns": [
        "arn:aws:ecs:us-west-2:123456789012:task/a1b2c3d4-5678-90ab-cdef-44444EXAMPLE"
    ]
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 태스크 정의](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html)를 참조하세요.  
+  API 세부 정보는 **AWS CLI 명령 참조의 [ListTasks](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/list-tasks.html)를 참조하세요.

### `put-account-setting-default`
<a name="ecs_PutAccountSettingDefault_cli_2_topic"></a>

다음 코드 예시는 `put-account-setting-default`의 사용 방법을 보여줍니다.

**AWS CLI**  
**기본 계정 설정을 수정하려면**  
다음 `put-account-setting-default` 예시에서는 계정의 모든 IAM 사용자 또는 역할에 대한 기본 계정 설정을 수정합니다. 이러한 변경 사항은 IAM 사용자 또는 역할이 이러한 설정을 명시적으로 재정의하지 않는 한 전체 AWS 계정에 적용됩니다.  

```
aws ecs put-account-setting-default --name {{serviceLongArnFormat}} --value {{enabled}}
```
출력:  

```
{
    "setting": {
        "name": "serviceLongArnFormat",
        "value": "enabled",
        "principalArn": "arn:aws:iam::123456789012:root"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon 리소스 이름(ARN) 및 ID](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-resource-ids.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutAccountSettingDefault](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/put-account-setting-default.html) 섹션을 참조하세요.

### `put-account-setting`
<a name="ecs_PutAccountSetting_cli_2_topic"></a>

다음 코드 예시는 `put-account-setting`의 사용 방법을 보여줍니다.

**AWS CLI**  
**IAM 사용자 계정의 계정 설정을 수정하려면**  
다음 `put-account-setting` 예제에서는 IAM 사용자 계정의 `enhanced`에 대한 `containerInsights` 계정 설정을 구성합니다. 이렇게 하면 향상된 관찰성을 갖춘 Container Insights가 켜집니다.  

```
aws ecs put-account-setting \
    --name {{containerInsights}} \
    --value {{enhanced}}
```
출력:  

```
{
    "setting": {
        "name": "containerInsights",
        "value": "enhanced",
        "principalArn": "arn:aws:iam::123456789012:user/johndoe",
        "type": "user"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [계정 설정 수정](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-modifying-longer-id-settings.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutAccountSetting](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/put-account-setting.html) 섹션을 참조하세요.

### `put-account-settings`
<a name="ecs_PutAccountSettings_cli_2_topic"></a>

다음 코드 예시는 `put-account-settings`의 사용 방법을 보여줍니다.

**AWS CLI**  
**IAM 사용자 또는 IAM 역할의 계정 설정을 수정하려면**  
다음 `put-account-setting` 예시에서는 지정된 IAM 사용자 또는 IAM 역할에 대한 계정 설정을 수정합니다.  

```
aws ecs put-account-setting \
    --name {{serviceLongArnFormat}} \
    --value {{enabled}} \
    --principal-arn {{arn:aws:iam::123456789012:user/MyUser}}
```
출력:  

```
{
    "setting": {
        "name": "serviceLongArnFormat",
        "value": "enabled",
        "principalArn": "arn:aws:iam::123456789012:user/MyUser"
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutAccountSettings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/put-account-settings.html) 섹션을 참조하세요.

### `put-attributes`
<a name="ecs_PutAttributes_cli_2_topic"></a>

다음 코드 예시는 `put-attributes`의 사용 방법을 보여줍니다.

**AWS CLI**  
**속성을 만들고 Amazon ECS 리소스와 연결하려면**  
다음 `put-attributes`는 컨테이너 인스턴스에 스택 및 값 생산이라는 이름의 속성을 적용합니다.  

```
aws ecs put-attributes \
    --attributes {{name=stack,value=production,targetId=arn:aws:ecs:us-west-2:130757420319:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34}}
```
출력:  

```
{
    "attributes": [
        {
            "name": "stack",
            "targetId": "arn:aws:ecs:us-west-2:130757420319:container-instance/1c3be8ed-df30-47b4-8f1e-6e68ebd01f34",
            "value": "production"
        }
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutAttributes](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/put-attributes.html) 섹션을 참조하세요.

### `put-cluster-capacity-providers`
<a name="ecs_PutClusterCapacityProviders_cli_2_topic"></a>

다음 코드 예시는 `put-cluster-capacity-providers`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 클러스터에 기존 용량 공급자를 추가하려면**  
다음 `put-cluster-capacity-providers` 예시에서는 클러스터에 기존 용량 공급자를 추가합니다. `create-capacity-provider` 명령을 사용하여 용량 공급자를 생성합니다. `describe-clusters` 명령은 클러스터와 관련된 현재 용량 공급자 및 기본 용량 공급자 전략을 설명하는 데 사용됩니다. 클러스터에 새 용량 공급자를 추가할 때는 클러스터와 연결하려는 새 용량 공급자 외에 기존의 모든 용량 공급자를 지정해야 합니다. 또한 클러스터와 연결할 기본 용량 공급자 전략을 지정해야 합니다. 이 예시에서는 `MyCluster` 클러스터에 연결된 `MyCapacityProvider1` 용량 공급자가 있으며, `MyCapacityProvider2` 용량 공급자를 추가하고 기본 용량 제공업체 전략에 포함하여 작업이 두 용량 공급자에 균등하게 분산되도록 합니다.  

```
aws ecs put-cluster-capacity-providers \
    --cluster {{MyCluster}} \
    --capacity-providers {{MyCapacityProvider1}} {{MyCapacityProvider2}} \
    --default-capacity-provider-strategy {{capacityProvider=MyCapacityProvider1,weight=1}} {{capacityProvider=MyCapacityProvider2,weight=1}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "runningTasksCount": 0,
        "pendingTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [
            "MyCapacityProvider1",
            "MyCapacityProvider2"
        ],
        "defaultCapacityProviderStrategy": [
            {
                "capacityProvider": "MyCapacityProvider1",
                "weight": 1,
                "base": 0
            },
            {
                "capacityProvider": "MyCapacityProvider2",
                "weight": 1,
                "base": 0
            }
        ],
        "attachments": [
           {
                "id": "0fb0c8f4-6edd-4de1-9b09-17e470ee1918",
                "type": "as_policy",
                "status": "ACTIVE",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider1"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
                    }
                ]
            },
            {
                "id": "ae592060-2382-4663-9476-b015c685593c",
                "type": "as_policy",
                "status": "ACTIVE",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider2"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    }
                ]
            }
        ],
        "attachmentsStatus": "UPDATE_IN_PROGRESS"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
**예시 2: 클러스터에서 용량 공급자를 제거하려면**  
다음 `put-cluster-capacity-providers` 예시에서는 클러스터에서 용량 공급자를 제거합니다. `describe-clusters` 명령은 클러스터와 연결된 현재 용량 공급자를 설명하는 데 사용됩니다. 클러스터에서 용량 공급자를 제거할 때는 클러스터와의 연결 상태를 유지할 용량 공급자와 클러스터와 연결할 기본 용량 공급자 전략을 지정해야 합니다. 이 예시에서는 클러스터에 `MyCapacityProvider1` 및 `MyCapacityProvider2` 용량 공급자가 연결되어 있고 `MyCapacityProvider2` 용량 공급자를 제거해야 하므로 업데이트된 기본 용량 공급자 전략과 함께 명령에 `MyCapacityProvider1`만 지정합니다.  

```
aws ecs put-cluster-capacity-providers \
    --cluster {{MyCluster}} \
    --capacity-providers {{MyCapacityProvider1}} \
    --default-capacity-provider-strategy {{capacityProvider=MyCapacityProvider1,weight=1,base=0}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "runningTasksCount": 0,
        "pendingTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [
            "MyCapacityProvider1"
        ],
        "defaultCapacityProviderStrategy": [
            "capacityProvider": "MyCapacityProvider1",
            "weight": 1,
            "base": 0
        ],
        "attachments": [
           {
                "id": "0fb0c8f4-6edd-4de1-9b09-17e470ee1918",
                "type": "as_policy",
                "status": "ACTIVE",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider1"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
                    }
                ]
            },
            {
                "id": "ae592060-2382-4663-9476-b015c685593c",
                "type": "as_policy",
                "status": "DELETING",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider2"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    }
                ]
            }
        ],
        "attachmentsStatus": "UPDATE_IN_PROGRESS"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
**예시 3: 클러스터에서 모든 용량 공급자 제거**  
다음 `put-cluster-capacity-providers` 예시에서는 클러스터에서 기존 용량 공급자를 모두 제거합니다.  

```
aws ecs put-cluster-capacity-providers \
    --cluster {{MyCluster}} \
    --capacity-providers {{[]}} \
    --default-capacity-provider-strategy {{[]}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster",
        "clusterName": "MyCluster",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "runningTasksCount": 0,
        "pendingTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enabled"
            }
        ],
        "capacityProviders": [],
        "defaultCapacityProviderStrategy": [],
        "attachments": [
           {
                "id": "0fb0c8f4-6edd-4de1-9b09-17e470ee1918",
                "type": "as_policy",
                "status": "DELETING",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider1"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"
                    }
                ]
            },
            {
                "id": "ae592060-2382-4663-9476-b015c685593c",
                "type": "as_policy",
                "status": "DELETING",
                "details": [
                    {
                        "name": "capacityProviderName",
                        "value": "MyCapacityProvider2"
                    },
                    {
                        "name": "scalingPolicyName",
                        "value": "ECSManagedAutoScalingPolicy-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"
                    }
                ]
            }
        ],
        "attachmentsStatus": "UPDATE_IN_PROGRESS"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Cluster capacity providers](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html)(클러스터 쿼리 언어)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutClusterCapacityProviders](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/put-cluster-capacity-providers.html) 섹션을 참조하세요.

### `register-task-definition`
<a name="ecs_RegisterTaskDefinition_cli_2_topic"></a>

다음 코드 예시는 `register-task-definition`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: JSON 파일에 작업 정의를 등록하려면**  
다음 `register-task-definition` 예시에서는 지정된 패밀리에 작업 정의를 등록합니다. 컨테이너 정의는 지정된 파일 위치에 JSON 형식으로 저장됩니다.  

```
aws ecs register-task-definition \
    --cli-input-json {{file://<path_to_json_file>/sleep360.json}}
```
`sleep360.json`의 콘텐츠:  

```
{
    "containerDefinitions": [
        {
            "name": "sleep",
            "image": "busybox",
            "cpu": 10,
            "command": [
                "sleep",
                "360"
            ],
            "memory": 10,
            "essential": true
        }
    ],
    "family": "sleep360"
}
```
출력:  

```
{
    "taskDefinition": {
        "status": "ACTIVE",
        "family": "sleep360",
        "placementConstraints": [],
        "compatibilities": [
                "EXTERNAL",
                "EC2"
        ],
        "volumes": [],
        "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/sleep360:1",
        "containerDefinitions": [
            {
                "environment": [],
                "name": "sleep",
                "mountPoints": [],
                "image": "busybox",
                "cpu": 10,
                "portMappings": [],
                "command": [
                    "sleep",
                    "360"
                ],
        "memory": 10,
        "essential": true,
        "volumesFrom": []
        }
    ],
        "revision": 1
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [작업 정의 예시](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/example_task_definitions.html) 섹션을 참조하세요.  
**예시 2: JSON 문자열 파라미터로 작업 정의 등록**  
다음 `register-task-definition` 예시에서는 이스케이프된 큰따옴표로 묶인 JSON 문자열 파라미터로 제공된 컨테이너 정의를 사용하여 작업 정의를 등록합니다.  

```
aws ecs register-task-definition \
    --family {{sleep360}} \
    --container-definitions "[{\"name\":\"sleep\",\"image\":\"busybox\",\"cpu\":10,\"command\":[\"sleep\",\"360\"],\"memory\":10,\"essential\":true}]"
```
출력은 이전 예시와 동일합니다.  
자세한 내용은 *Amazon ECS 개발자 안내서*의 [작업 정의 생성](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-task-definition.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [RegisterTaskDefinition](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/register-task-definition.html) 섹션을 참조하세요.

### `run-task`
<a name="ecs_RunTask_cli_2_topic"></a>

다음 코드 예시는 `run-task`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 기본 클러스터에서 작업 실행**  
다음 `run-task` 예시에서는 기본 클러스터에서 작업을 실행하고 클라이언트 토큰을 사용합니다.  

```
aws ecs run-task \
    --cluster {{default}} \
    --task-definition {{sleep360:1}} \
    --client-token {{550e8400-e29b-41d4-a716-446655440000}}
```
출력:  

```
{
    "tasks": [
        {
            "attachments": [],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-east-1b",
            "capacityProviderName": "example-capacity-provider",
            "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/default",
            "containerInstanceArn": "arn:aws:ecs:us-east-1:123456789012:container-instance/default/bc4d2ec611d04bb7bb97e83ceEXAMPLE",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-east-1:123456789012:container/default/d6f51cc5bbc94a47969c92035e9f66f8/75853d2d-711e-458a-8362-0f0aEXAMPLE",
                    "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/default/d6f51cc5bbc94a47969c9203EXAMPLE",
                    "name": "sleep",
                    "image": "busybox",
                    "lastStatus": "PENDING",
                    "networkInterfaces": [],
                    "cpu": "10",
                    "memory": "10"
                }
            ],
            "cpu": "10",
            "createdAt": "2023-11-21T16:59:34.403000-05:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "family:sleep360",
            "lastStatus": "PENDING",
            "launchType": "EC2",
            "memory": "10",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "sleep"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
            "tags": [],
            "taskArn": "arn:aws:ecs:us-east-1:123456789012:task/default/d6f51cc5bbc94a47969c9203EXAMPLE",
            "taskDefinitionArn": "arn:aws:ecs:us-east-1:123456789012:task-definition/sleep360:1",
            "version": 1
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [애플리케이션을 독립 실행형 작업으로 실행](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/standalone-task-create.html)을 참조하세요.  
**예시 2: 독립 실행형 작업에 대한 Amazon EBS 볼륨 구성**  
다음 `run-task` 예시에서는 기본 클러스터의 Fargate 작업에 대해 암호화된 Amazon EBS 볼륨을 구성합니다. `AmazonECSInfrastructureRolePolicyForVolumes` 관리형 정책과 연결된 Amazon ECS 인프라 역할이 구성되어 있어야 합니다. `run-task` 요청에서와 동일한 볼륨 이름으로 작업 정의를 지정해야 합니다. 이 예시에서는 `--cli-input-json` 옵션과 `ebs.json`이라는 JSON 입력 파일을 사용합니다.  

```
aws ecs run-task \
    --cli-input-json {{file://ebs.json}}
```
`ebs.json`의 콘텐츠:  

```
{
   "cluster": "default",
   "taskDefinition": "mytaskdef",
   "launchType": "FARGATE",
   "networkConfiguration":{
        "awsvpcConfiguration":{
            "assignPublicIp": "ENABLED",
            "securityGroups": ["sg-12344321"],
            "subnets":["subnet-12344321"]
        }
    },
   "volumeConfigurations": [
        {
            "name": "myEBSVolume",
            "managedEBSVolume": {
                "volumeType": "gp3",
                "sizeInGiB": 100,
                "roleArn":"arn:aws:iam::1111222333:role/ecsInfrastructureRole",
                "encrypted": true,
                "kmsKeyId": "arn:aws:kms:region:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
            }
        }
    ]
}
```
출력:  

```
{
    "tasks": [
        {
            "attachments": [
                {
                    "id": "ce868693-15ca-4083-91ac-f782f64000c9",
                    "type": "ElasticNetworkInterface",
                    "status": "PRECREATED",
                    "details": [
                        {
                        "name": "subnetId",
                        "value": "subnet-070982705451dad82"
                        }
                    ]
                },
                {
                    "id": "a17ed863-786c-4372-b5b3-b23e53f37877",
                    "type": "AmazonElasticBlockStorage",
                    "status": "CREATED",
                    "details": [
                        {
                            "name": "roleArn",
                            "value": "arn:aws:iam::123456789012:role/ecsInfrastructureRole"
                        },
                        {
                            "name": "volumeName",
                            "value": "myEBSVolume"
                        },
                        {
                            "name": "deleteOnTermination",
                            "value": "true"
                        }
                    ]
                }
            ],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                }
            ],
            "availabilityZone": "us-west-2b",
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-west-2:123456789012:container/default/7f1fbd3629434cc4b82d72d2f09b67c9/e21962a2-f328-4699-98a3-5161ac2c186a",
                    "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/7f1fbd3629434cc4b82d72d2f09b67c9",
                    "name": "container-using-ebs",
                    "image": "amazonlinux:2",
                    "lastStatus": "PENDING",
                    "networkInterfaces": [],
                    "cpu": "0"
                }
            ],
            "cpu": "1024",
            "createdAt": "2025-01-23T10:29:46.650000-06:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "family:mytaskdef",
            "lastStatus": "PROVISIONING",
            "launchType": "FARGATE",
            "memory": "3072",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "container-using-ebs"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
            "platformVersion": "1.4.0",
            "platformFamily": "Linux",
            "tags": [],
            "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/7f1fbd3629434cc4b82d72d2f09b67c9",
            "taskDefinitionArn": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:4",
            "version": 1,
            "ephemeralStorage": {
                "sizeInGiB": 20
            },
            "fargateEphemeralStorage": {
                "sizeInGiB": 20
            }
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 Amazon EBS 볼륨 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [RunTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/run-task.html) 섹션을 참조하세요.

### `start-task`
<a name="ecs_StartTask_cli_2_topic"></a>

다음 코드 예시는 `start-task`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예시 1: 새 작업 시작**  
다음 `start-task` 예시에서는 기본 클러스터의 지정된 컨테이너 인스턴스에서 `sleep360` 작업 정의의 최신 버전을 사용하여 작업을 시작합니다.  

```
aws ecs start-task \
    --task-definition {{sleep360}} \
    --container-instances {{765936fadbdd46b5991a4bd70c2a43d4}}
```
출력:  

```
{
    "tasks": [
        {
            "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/666fdccc2e2d4b6894dd422f4eeee8f8",
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default",
            "taskDefinitionArn": "arn:aws:ecs:us-west-2:123456789012:task-definition/sleep360:3",
            "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/default/765936fadbdd46b5991a4bd70c2a43d4",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "sleep"
                    }
                ]
            },
            "lastStatus": "PENDING",
            "desiredStatus": "RUNNING",
            "cpu": "128",
            "memory": "128",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-west-2:123456789012:container/75f11ed4-8a3d-4f26-a33b-ad1db9e02d41",
                    "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/666fdccc2e2d4b6894dd422f4eeee8f8",
                    "name": "sleep",
                    "lastStatus": "PENDING",
                    "networkInterfaces": [],
                    "cpu": "10",
                    "memory": "10"
                }
            ],
            "version": 1,
            "createdAt": 1563421494.186,
            "group": "family:sleep360",
            "launchType": "EC2",
            "attachments": [],
            "tags": []
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 컨테이너 예약](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduling_tasks.html)을 참조하세요.  
**예시 2: 작업 시작 시 Amazon EBS 볼륨 구성**  
다음 `start-task` 예시에서는 지정된 컨테이너 인스턴스의 작업에 대해 암호화된 Amazon EBS 볼륨을 구성합니다. `AmazonECSInfrastructureRolePolicyForVolumes` 관리형 정책과 연결된 Amazon ECS 인프라 역할이 구성되어 있어야 합니다. `start-task` 요청에서와 동일한 볼륨 이름으로 작업 정의를 지정해야 합니다. 이 예시에서는 `--cli-input-json` 옵션과 다음 콘텐츠가 포함된 `ebs.json`이라는 JSON 입력 파일을 사용합니다.  

```
aws ecs start-task \
    --cli-input-json {{file://ebs.json}} \
    --container-instances {{765936fadbdd46b5991a4bd70c2a43d4}}
```
`ebs.json`의 콘텐츠:  

```
{
   "cluster": "default",
   "taskDefinition": "mytaskdef",
   "networkConfiguration":{
        "awsvpcConfiguration":{
            "assignPublicIp": "ENABLED",
            "securityGroups": ["sg-12344321"],
            "subnets":["subnet-12344321"]
        }
    },
   "volumeConfigurations": [
        {
            "name": "myEBSVolume",
            "managedEBSVolume": {
                "volumeType": "gp3",
                "sizeInGiB": 100,
                "roleArn":"arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                "encrypted": true,
                "kmsKeyId": "arn:aws:kms:region:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab"
            }
        }
    ]
}
```
출력:  

```
{
    "tasks": [
        {
            "attachments": [
                {
                    "id": "aea29489-9dcd-49f1-8164-4d91566e1113",
                    "type": "ElasticNetworkInterface",
                    "status": "PRECREATED",
                    "details": [
                        {
                            "name": "subnetId",
                            "value": "subnet-12344321"
                        }
                    ]
                },
                {
                    "id": "f29e1222-9a1e-410f-b499-a12a7cd6d42e",
                    "type": "AmazonElasticBlockStorage",
                    "status": "CREATED",
                    "details": [
                        {
                            "name": "roleArn",
                            "value": "arn:aws:iam::123456789012:role/ecsInfrastructureRole"
                        },
                        {
                            "name": "volumeName",
                            "value": "myEBSVolume"
                        },
                        {
                            "name": "deleteOnTermination",
                            "value": "true"
                        }
                    ]
                }
            ],
            "attributes": [
                {
                    "name": "ecs.cpu-architecture",
                    "value": "arm64"
                }
            ],
            "availabilityZone": "us-west-2c",
            "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/default",
            "containerInstanceArn": "arn:aws:ecs:us-west-2:123456789012:container-instance/default/765936fadbdd46b5991a4bd70c2a43d4",
            "containers": [
                {
                    "containerArn": "arn:aws:ecs:us-west-2:123456789012:container/default/bb122ace3ed84add92c00a351a03c69e/a4a9ed10-51c7-4567-9653-50e71b94f867",
                    "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/bb122ace3ed84add92c00a351a03c69e",
                    "name": "container-using-ebs",
                    "image": "amazonlinux:2",
                    "lastStatus": "PENDING",
                    "networkInterfaces": [],
                    "cpu": "0"
                }
            ],
            "cpu": "1024",
            "createdAt": "2025-01-23T14:51:05.191000-06:00",
            "desiredStatus": "RUNNING",
            "enableExecuteCommand": false,
            "group": "family:mytaskdef",
            "lastStatus": "PROVISIONING",
            "launchType": "EC2",
            "memory": "3072",
            "overrides": {
                "containerOverrides": [
                    {
                        "name": "container-using-ebs"
                    }
                ],
                "inferenceAcceleratorOverrides": []
            },
             "tags": [],
            "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/default/bb122ace3ed84add92c00a351a03c69e",
            "taskDefinitionArn": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:4",
            "version": 1
        }
    ],
    "failures": []
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 Amazon EBS 볼륨 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [StartTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/start-task.html) 섹션을 참조하세요.

### `stop-task`
<a name="ecs_StopTask_cli_2_topic"></a>

다음 코드 예시는 `stop-task`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업을 중지하려면**  
다음 `stop-task`는 지정된 작업이 기본 클러스터에서 실행되지 않도록 중지합니다.  

```
aws ecs stop-task \
    --task {{666fdccc2e2d4b6894dd422f4eeee8f8}}
```
출력:  

```
{
    "task": {
        "taskArn": "arn:aws:ecs:us-west-2:130757420319:task/default/666fdccc2e2d4b6894dd422f4eeee8f8",
        "clusterArn": "arn:aws:ecs:us-west-2:130757420319:cluster/default",
        "taskDefinitionArn": "arn:aws:ecs:us-west-2:130757420319:task-definition/sleep360:3",
        "containerInstanceArn": "arn:aws:ecs:us-west-2:130757420319:container-instance/default/765936fadbdd46b5991a4bd70c2a43d4",
        "overrides": {
            "containerOverrides": []
        },
        "lastStatus": "STOPPED",
        "desiredStatus": "STOPPED",
        "cpu": "128",
        "memory": "128",
        "containers": [],
        "version": 2,
        "stoppedReason": "Taskfailedtostart",
        "stopCode": "TaskFailedToStart",
        "connectivity": "CONNECTED",
        "connectivityAt": 1563421494.186,
        "pullStartedAt": 1563421494.252,
        "pullStoppedAt": 1563421496.252,
        "executionStoppedAt": 1563421497,
        "createdAt": 1563421494.186,
        "stoppingAt": 1563421497.252,
        "stoppedAt": 1563421497.252,
        "group": "family:sleep360",
        "launchType": "EC2",
        "attachments": [],
        "tags": []
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [StopTask](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/stop-task.html) 섹션을 참조하세요.

### `tag-resource`
<a name="ecs_TagResource_cli_2_topic"></a>

다음 코드 예시는 `tag-resource`의 사용 방법을 보여줍니다.

**AWS CLI**  
**리소스에 태그를 지정하려면**  
다음 `tag-resource` 예시에서는 지정된 리소스에 단일 태그를 추가합니다.  

```
aws ecs tag-resource \
    --resource-arn {{arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster}}
    --tags {{key=key1,value=value1}}
```
이 명령은 출력을 생성하지 않습니다.  
**리소스에 여러 태그를 추가하려면**  
다음 `tag-resource` 예시에서는 지정된 리소스에 여러 태그를 추가합니다.  

```
aws ecs tag-resource \
--resource-arn {{arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster}} \
--tags {{key=key1,value=value1}} {{key=key2,value=value2}} {{key=key3,value=value3}}
```
이 명령은 출력을 생성하지 않습니다.  
+  API 세부 정보는 **AWS CLI 명령 참조의 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/tag-resource.html)를 참조하세요.

### `untag-resource`
<a name="ecs_UntagResource_cli_2_topic"></a>

다음 코드 예시에서는 `untag-resource`의 사용 방법을 보여줍니다.

**AWS CLI**  
**리소스에서 태그를 제거하려면**  
다음 `untag-resource` 예시에서는 지정된 리소스에서 나열된 태그를 제거합니다.  

```
aws ecs untag-resource \
    --resource-arn {{arn:aws:ecs:us-west-2:123456789012:cluster/MyCluster}} \
    --tag-keys {{key1,key2}}
```
이 명령은 출력을 생성하지 않습니다.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/untag-resource.html)를 참조하세요.

### `update-cluster-settings`
<a name="ecs_UpdateClusterSettings_cli_2_topic"></a>

다음 코드 예시는 `update-cluster-settings`의 사용 방법을 보여줍니다.

**AWS CLI**  
**클러스터의 설정을 수정하려면**  
다음 `update-cluster-settings` 예제에서는 `MyCluster`라는 클러스터를 만들고 향상된 관찰성을 갖춘 CloudWatch Container Insights를 사용 설정합니다.  

```
aws ecs update-cluster-settings \
    --cluster {{MyCluster}} \
    --settings {{name=containerInsights,value=enhanced}}
```
출력:  

```
{
    "cluster": {
        "clusterArn": "arn:aws:ecs:us-esat-1:123456789012:cluster/MyCluster",
        "clusterName": "default",
        "status": "ACTIVE",
        "registeredContainerInstancesCount": 0,
        "runningTasksCount": 0,
        "pendingTasksCount": 0,
        "activeServicesCount": 0,
        "statistics": [],
        "tags": [],
        "settings": [
            {
                "name": "containerInsights",
                "value": "enhanced"
            }
        ]
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [계정 설정 수정](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-modifying-longer-id-settings.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateClusterSettings](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-cluster-settings.html) 섹션을 참조하세요.

### `update-cluster`
<a name="ecs_UpdateCluster_cli_2_topic"></a>

다음 코드 예시는 `update-cluster`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예제 1: containerInsights 활성화하는 ECS 클러스터 업데이트**  
다음 `update-cluster`에서는 이미 생성된 클러스터에서 containerInsights 값을 `enabled`로 업데이트합니다. 기본적으로는 비활성화되어 있습니다.  

```
aws ecs update-cluster \
    --cluster {{ECS-project-update-cluster}} \
    --settings {{name=containerInsights,value=enabled}}
```
출력:  

```
"cluster": {
    "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/ECS-project-update-cluster",
    "clusterName": "ECS-project-update-cluster",
    "status": "ACTIVE",
    "registeredContainerInstancesCount": 0,
    "runningTasksCount": 0,
    "pendingTasksCount": 0,
    "activeServicesCount": 0,
    "statistics": [],
    "tags": [],
    "settings": [
        {
            "name": "containerInsights",
            "value": "enabled"
        }
    ],
    "capacityProviders": [
        "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
    ],
    "defaultCapacityProviderStrategy": [
        {
            "capacityProvider": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt",
            "weight": 1,
            "base": 0
        }
    ],
    "attachments": [
        {
            "id": "069d002b-7634-42e4-b1d4-544f4c8f6380",
            "type": "as_policy",
            "status": "CREATED",
            "details": [
                {
                    "name": "capacityProviderName",
                    "value": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
                },
                {
                    "name": "scalingPolicyName",
                    "value": "ECSManagedAutoScalingPolicy-152363a6-8c65-484c-b721-42c3e070ae93"
                }
            ]
        },
        {
            "id": "08b5b6ca-45e9-4209-a65d-e962a27c490a",
            "type": "managed_draining",
            "status": "CREATED",
            "details": [
                {
                    "name": "capacityProviderName",
                    "value": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
                },
                {
                    "name": "autoScalingLifecycleHookName",
                    "value": "ecs-managed-draining-termination-hook"
                }
            ]
        },
        {
            "id": "45d0b36f-8cff-46b6-9380-1288744802ab",
            "type": "sc",
            "status": "ATTACHED",
            "details": []
        }
    ],
    "attachmentsStatus": "UPDATE_COMPLETE",
    "serviceConnectDefaults": {
        "namespace": "arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-igwrsylmy3kwvcdx"
    }
}
```
**예제 2: ECS 클러스터를 업데이트하여 기본 Service Connect 네임스페이스 설정**  
다음 `update-cluster`에서는 기본 Service Connect 네임스페이스를 설정하여 ECS 클러스터를 업데이트합니다.  

```
aws ecs update-cluster \
    --cluster {{ECS-project-update-cluster}} \
    --service-connect-defaults {{namespace=test}}
```
출력:  

```
 {
     "cluster": {
         "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/ECS-project-update-cluster",
         "clusterName": "ECS-project-update-cluster",
         "status": "ACTIVE",
         "registeredContainerInstancesCount": 0,
         "runningTasksCount": 0,
         "pendingTasksCount": 0,
         "activeServicesCount": 0,
         "statistics": [],
         "tags": [],
         "settings": [
             {
                 "name": "containerInsights",
                 "value": "enabled"
             }
         ],
         "capacityProviders": [
             "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
         ],
         "defaultCapacityProviderStrategy": [
             {
                 "capacityProvider": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt",
                 "weight": 1,
                 "base": 0
             }
         ],
         "attachments": [
             {
                 "id": "069d002b-7634-42e4-b1d4-544f4c8f6380",
                 "type": "as_policy",
                 "status": "CREATED",
                 "details": [
                     {
                         "name": "capacityProviderName",
                         "value": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
                     },
                     {
                         "name": "scalingPolicyName",
                         "value": "ECSManagedAutoScalingPolicy-152363a6-8c65-484c-b721-42c3e070ae93"
                     }
                 ]
             },
             {
                 "id": "08b5b6ca-45e9-4209-a65d-e962a27c490a",
                 "type": "managed_draining",
                 "status": "CREATED",
                 "details": [
                     {
                         "name": "capacityProviderName",
                         "value": "Infra-ECS-Cluster-ECS-project-update-cluster-d6bb6d5b-EC2CapacityProvider-3fIpdkLywwFt"
                     },
                     {
                         "name": "autoScalingLifecycleHookName",
                         "value": "ecs-managed-draining-termination-hook"
                     }
                 ]
             },
             {
                 "id": "45d0b36f-8cff-46b6-9380-1288744802ab",
                 "type": "sc",
                 "status": "DELETED",
                 "details": []
             },
             {
                 "id": "3e6890c3-609c-4832-91de-d6ca891b3ef1",
                 "type": "sc",
                 "status": "ATTACHED",
                 "details": []
             },
             {
                 "id": "961b8ec1-c2f1-4070-8495-e669b7668e90",
                 "type": "sc",
                 "status": "DELETED",
                 "details": []
             }
         ],
         "attachmentsStatus": "UPDATE_COMPLETE",
         "serviceConnectDefaults": {
             "namespace": "arn:aws:servicediscovery:us-west-2:123456789012:namespace/ns-dtjmxqpfi46ht7dr"
         }
     }
}
```
Service Connect에 대한 자세한 내용은 *Amazon ECS 개발자 안내서*의 [Service Connect를 사용하여 Amazon ECS 서비스를 짧은 이름으로 연결](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-connect.html)을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-cluster.html)를 참조하세요.

### `update-container-agent`
<a name="ecs_UpdateContainerAgent_cli_2_topic"></a>

다음 코드 예시는 `update-container-agent`의 사용 방법을 보여줍니다.

**AWS CLI**  
**Amazon ECS 컨테이너 인스턴스에서 컨테이너 에이전트를 업데이트하려면**  
다음 `update-container-agent` 예시에서는 기본 클러스터의 지정된 컨테이너 인스턴스에서 컨테이너 에이전트를 업데이트합니다.  

```
aws ecs update-container-agent --cluster {{default}} --container-instance {{a1b2c3d4-5678-90ab-cdef-11111EXAMPLE}}
```
출력:  

```
{
    "containerInstance": {
        "status": "ACTIVE",
...
        "agentUpdateStatus": "PENDING",
        "versionInfo": {
            "agentVersion": "1.0.0",
            "agentHash": "4023248",
            "dockerVersion": "DockerVersion: 1.5.0"
        }
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS 컨테이너 에이전트 업데이트](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-agent-update.html) 섹션을 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateContainerAgent](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-container-agent.html) 섹션을 참조하세요.

### `update-container-instances-state`
<a name="ecs_UpdateContainerInstancesState_cli_2_topic"></a>

다음 코드 예시는 `update-container-instances-state`의 사용 방법을 보여줍니다.

**AWS CLI**  
**컨테이너 인스턴스의 상태를 업데이트하려면**  
다음 `update-container-instances-state`는 지정된 컨테이너 인스턴스의 상태를 `DRAINING`으로 업데이트하여 해당 인스턴스가 등록되어 있는 클러스터에서 제거합니다.  

```
aws ecs update-container-instances-state \
    --container-instances {{765936fadbdd46b5991a4bd70c2a43d4}} \
    --status {{DRAINING}}
```
출력:  

```
{
    "containerInstances": [
        {
            "containerInstanceArn": "arn:aws:ecs:us-west-2:130757420319:container-instance/default/765936fadbdd46b5991a4bd70c2a43d4",
            "ec2InstanceId": "i-013d87ffbb4d513bf",
            "version": 4390,
            "versionInfo": {
                "agentVersion": "1.29.0",
                "agentHash": "a190a73f",
                "dockerVersion": "DockerVersion:18.06.1-ce"
            },
            "remainingResources": [
                {
                    "name": "CPU",
                    "type": "INTEGER",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 1536
                },
                {
                    "name": "MEMORY",
                    "type": "INTEGER",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 2681
                },
                {
                    "name": "PORTS",
                    "type": "STRINGSET",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 0,
                    "stringSetValue": [
                        "22",
                        "2376",
                        "2375",
                        "51678",
                        "51679"
                    ]
                },
                {
                    "name": "PORTS_UDP",
                    "type": "STRINGSET",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 0,
                    "stringSetValue": []
                }
            ],
            "registeredResources": [
                {
                    "name": "CPU",
                    "type": "INTEGER",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 2048
                },
                {
                    "name": "MEMORY",
                    "type": "INTEGER",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 3705
                },
                {
                    "name": "PORTS",
                    "type": "STRINGSET",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 0,
                    "stringSetValue": [
                        "22",
                        "2376",
                        "2375",
                        "51678",
                        "51679"
                    ]
                },
                {
                    "name": "PORTS_UDP",
                    "type": "STRINGSET",
                    "doubleValue": 0,
                    "longValue": 0,
                    "integerValue": 0,
                    "stringSetValue": []
                }
            ],
            "status": "DRAINING",
            "agentConnected": true,
            "runningTasksCount": 2,
            "pendingTasksCount": 0,
            "attributes": [
                {
                    "name": "ecs.capability.secrets.asm.environment-variables"
                },
                {
                    "name": "ecs.capability.branch-cni-plugin-version",
                    "value": "e0703516-"
                },
                {
                    "name": "ecs.ami-id",
                    "value": "ami-00e0090ac21971297"
                },
                {
                    "name": "ecs.capability.secrets.asm.bootstrap.log-driver"
                },
                {
                    "name": "com.amazonaws.ecs.capability.logging-driver.none"
                },
                {
                    "name": "ecs.capability.ecr-endpoint"
                },
                {
                    "name": "ecs.capability.docker-plugin.local"
                },
                {
                    "name": "ecs.capability.task-cpu-mem-limit"
                },
                {
                    "name": "ecs.capability.secrets.ssm.bootstrap.log-driver"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.30"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.31"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.32"
                },
                {
                    "name": "ecs.availability-zone",
                    "value": "us-west-2c"
                },
                {
                    "name": "ecs.capability.aws-appmesh"
                },
                {
                    "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.24"
                },
                {
                    "name": "ecs.capability.task-eni-trunking"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.26"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.27"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.28"
                },
                {
                    "name": "com.amazonaws.ecs.capability.privileged-container"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.29"
                },
                {
                    "name": "ecs.cpu-architecture",
                    "value": "x86_64"
                },
                {
                    "name": "com.amazonaws.ecs.capability.ecr-auth"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.20"
                },
                {
                    "name": "ecs.os-type",
                    "value": "linux"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.21"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.22"
                },
                {
                    "name": "ecs.capability.task-eia"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.23"
                },
                {
                    "name": "ecs.capability.private-registry-authentication.secretsmanager"
                },
                {
                    "name": "com.amazonaws.ecs.capability.logging-driver.syslog"
                },
                {
                    "name": "com.amazonaws.ecs.capability.logging-driver.json-file"
                },
                {
                    "name": "ecs.capability.execution-role-awslogs"
                },
                {
                    "name": "ecs.vpc-id",
                    "value": "vpc-1234"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.17"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18"
                },
                {
                    "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
                },
                {
                    "name": "ecs.capability.task-eni"
                },
                {
                    "name": "ecs.capability.execution-role-ecr-pull"
                },
                {
                    "name": "ecs.capability.container-health-check"
                },
                {
                    "name": "ecs.subnet-id",
                    "value": "subnet-1234"
                },
                {
                    "name": "ecs.instance-type",
                    "value": "c5.large"
                },
                {
                    "name": "com.amazonaws.ecs.capability.task-iam-role-network-host"
                },
                {
                    "name": "ecs.capability.container-ordering"
                },
                {
                    "name": "ecs.capability.cni-plugin-version",
                    "value": "91ccefc8-2019.06.0"
                },
                {
                    "name": "ecs.capability.pid-ipc-namespace-sharing"
                },
                {
                    "name": "ecs.capability.secrets.ssm.environment-variables"
                },
                {
                    "name": "com.amazonaws.ecs.capability.task-iam-role"
                }
            ],
            "registeredAt": 1560788724.507,
            "attachments": [],
            "tags": []
        }
    ],
    "failures": []
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateContainerInstancesState](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-container-instances-state.html) 섹션을 참조하세요.

### `update-service-primary-task-set`
<a name="ecs_UpdateServicePrimaryTaskSet_cli_2_topic"></a>

다음 코드 예시는 `update-service-primary-task-set`의 사용 방법을 보여줍니다.

**AWS CLI**  
**서비스의 기본 작업 세트를 업데이트하려면**  
다음 `update-service-primary-task-set` 예시에서는 지정된 서비스에 대한 기본 작업 세트를 업데이트합니다.  

```
aws ecs update-service-primary-task-set \
    --cluster {{MyCluster}} \
    --service {{MyService}} \
    --primary-task-set {{arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789}}
```
출력:  

```
{
    "taskSet": {
        "id": "ecs-svc/1234567890123456789",
        "taskSetArn": "arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789",
        "status": "PRIMARY",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:2",
        "computedDesiredCount": 1,
        "pendingCount": 0,
        "runningCount": 0,
        "createdAt": 1557128360.711,
        "updatedAt": 1557129412.653,
        "launchType": "EC2",
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344312"
                ],
                "assignPublicIp": "DISABLED"
            }
        },
        "loadBalancers": [],
        "serviceRegistries": [],
        "scale": {
            "value": 50.0,
            "unit": "PERCENT"
        },
        "stabilityStatus": "STABILIZING",
        "stabilityStatusAt": 1557129279.914
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateServicePrimaryTaskSet](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service-primary-task-set.html) 섹션을 참조하세요.

### `update-service`
<a name="ecs_UpdateService_cli_2_topic"></a>

다음 코드 예시는 `update-service`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예 1: 서비스에 사용되는 태스크 정의를 변경하는 방법**  
다음 `update-service` 예시에서는 `amazon-ecs-sample` 태스크 정의를 사용하도록 `my-http-service` 서비스를 업데이트합니다.  

```
aws ecs update-service \
    --cluster {{test}} \
    --service {{my-http-service}} \
    --task-definition {{amazon-ecs-sample}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/test/my-http-service",
        "serviceName": "my-http-service",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/test",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 2,
        "pendingCount": 0,
        "launchType": "FARGATE",
        "platformVersion": "1.4.0",
        "platformFamily": "Linux",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/amazon-ecs-sample:2",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": true,
                "rollback": true
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100,
            "alarms": {
                "alarmNames": [],
                "rollback": false,
                "enable": false
            }
        },
        "deployments": [
            {
                "id": "ecs-svc/7419115625193919142",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/amazon-ecs-sample:2",
                "desiredCount": 0,
                "pendingCount": 0,
                "runningCount": 0,
                "failedTasks": 0,
                "createdAt": "2025-02-21T13:26:02.734000-06:00",
                "updatedAt": "2025-02-21T13:26:02.734000-06:00",
                "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "IN_PROGRESS",
                "rolloutStateReason": "ECS deployment ecs-svc/7419115625193919142 in progress."
            },
            {
                "id": "ecs-svc/1709597507655421668",
                "status": "ACTIVE",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/old-amazon-ecs-sample:4",
                "desiredCount": 2,
                "pendingCount": 0,
                "runningCount": 2,
                "failedTasks": 0,
                "createdAt": "2025-01-24T11:13:07.621000-06:00",
                "updatedAt": "2025-02-02T16:11:30.838000-06:00",
                "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                             "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "COMPLETED",
                "rolloutStateReason": "ECS deployment ecs-svc/1709597507655421668 completed."
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [
            {
                "id": "e40b4d1c-80d9-4834-aaf3-6a268e530e17",
                "createdAt": "2025-02-21T10:31:26.037000-06:00",
                "message": "(my-http-service) has reached a steady state."
            },
            {
                "id": "6ac069ad-fc8b-4e49-a35d-b5574a964c8e",
                "createdAt": "2025-02-21T04:31:22.703000-06:00",
                "message": "(my-http-service) has reached a steady state."
            },
            {
                "id": "265f7d37-dfd1-4880-a846-ec486f341919",
                "createdAt": "2025-02-20T22:31:22.514000-06:00",
                "message": "(my-http-service) has reached a steady state."
            }
        ],
        "createdAt": "2024-10-30T17:12:43.218000-05:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321",
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:role/AIDACKCEVSQ6C2EXAMPLE",
        "enableECSManagedTags": true,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "DISABLED"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [콘솔을 사용하여 Amazon ECS 서비스 업데이트](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html)를 참조하세요.  
**예 2: 서비스의 태스크 수를 변경하는 방법**  
다음 `update-service` 예시에서는 `my-http-service` 서비스의 원하는 작업 수를 2로 업데이트합니다.  

```
aws ecs update-service \
    --cluster {{MyCluster}} \
    --service {{my-http-service}} \
    --desired-count {{2}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/MyCluster/my-http-service",
        "serviceName": "my-http-service",
        "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 1,
        "pendingCount": 0,
        "capacityProviderStrategy": [
            {
                "capacityProvider": "FARGATE",
                "weight": 1,
                "base": 0
            }
        ],
        "platformVersion": "LATEST",
        "platformFamily": "Linux",
        "taskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": true,
                "rollback": true
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100,
            "alarms": {
                "alarmNames": [],
                "rollback": false,
                "enable": false
            }
        },
        "deployments": [
            {
                "id": "ecs-svc/1976744184940610707",
                "status": "PRIMARY",
                "taskkDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
                "desiredCount": 1,
                "pendingCount": 0,
                "runningCount": 1,
                "failedTasks": 0,
                "createdAt": "2024-12-03T16:24:25.225000-05:00",
                "updatedAt": "2024-12-03T16:25:15.837000-05:00",
                "capacityProviderStrategy": [
                    {
                        "capacityProvider": "FARGATE",
                        "weight": 1,
                        "base": 0
                    }
                ],
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-0d0eab1bb38d5ca64",
                            "subnet-0db5010045995c2d5"
                        ],
                        "securityGroups": [
                            "sg-02556bf85a191f59a"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "COMPLETED",
                "rolloutStateReason": "ECS deployment ecs-svc/1976744184940610707 completed."
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [
            {
                "id": "f27350b9-4b2a-4e2e-b72e-a4b68380de45",
                "createdAt": "2024-12-30T13:24:07.345000-05:00",
                "message": "(service my-http-service) has reached a steady state."
            },
            {
                "id": "e764ec63-f53f-45e3-9af2-d99f922d2957",
                "createdAt": "2024-12-30T12:32:21.600000-05:00",
                "message": "(service my-http-service) has reached a steady state."
            },
            {
                "id": "28444756-c2fa-47f8-bd60-93a8e05f3991",
                "createdAt": "2024-12-08T19:26:10.367000-05:00",
                "message": "(service my-http-service) has reached a steady state."
            }
        ],
        "createdAt": "2024-12-03T16:24:25.225000-05:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-0d0eab1bb38d5ca64",
                    "subnet-0db5010045995c2d5"
                ],
                "securityGroups": [
                    "sg-02556bf85a191f59a"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:role/Admin",
        "enableECSManagedTags": true,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "ENABLED"
    }
}
```
자세한 내용을 알아보려면 *Amazon ECS 개발자 안내서*의 [콘솔을 사용하여 Amazon ECS 서비스 업데이트](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html) 섹션을 참조하시기 바랍니다.  
**예시 3: 서비스 업데이트 시 연결하도록 Amazon EBS 볼륨 구성**  
다음 `update-service` 예시에서는 Amazon EBS 볼륨을 사용하도록 `my-http-service` 서비스를 업데이트합니다. `AmazonECSInfrastructureRolePolicyForVolumes` 관리형 정책과 연결된 Amazon ECS 인프라 역할이 구성되어 있어야 합니다. 또한 `update-service` 요청에서와 동일한 볼륨 이름을 사용하고 `configuredAtLaunch`를 `true`로 설정하여 작업 정의를 지정해야 합니다. 이 예시에서는 `--cli-input-json` 옵션과 `ebs.json`이라는 JSON 입력 파일을 사용합니다.  

```
aws ecs update-service \
    --cli-input-json {{file://ebs.json}}
```
`ebs.json`의 콘텐츠:  

```
{
   "cluster": "mycluster",
   "taskDefinition": "mytaskdef",
   "service": "my-http-service",
   "desiredCount": 2,
   "volumeConfigurations": [
        {
            "name": "myEbsVolume",
            "managedEBSVolume": {
                "roleArn":"arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                "volumeType": "gp3",
                "sizeInGiB": 100,
                "iops": 3000,
                "throughput": 125,
                "filesystemType": "ext4"
            }
        }
   ]
}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/mycluster/my-http-service",
        "serviceName": "my-http-service",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/mycluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 2,
        "pendingCount": 0,
        "launchType": "FARGATE",
        "platformVersion": "LATEST",
        "platformFamily": "Linux",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:1",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": true,
                "rollback": true
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100,
            "alarms": {
                "alarmNames": [],
                "rollback": false,
                "enable": false
            }
        },
        "deployments": [
            {
                "id": "ecs-svc/2420458347226626275",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:1",
                "desiredCount": 0,
                "pendingCount": 0,
                "runningCount": 0,
                "failedTasks": 0,
                "createdAt": "2025-02-21T15:07:20.519000-06:00",
                "updatedAt": "2025-02-21T15:07:20.519000-06:00",
                "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321",
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "IN_PROGRESS",
                "rolloutStateReason": "ECS deployment ecs-svc/2420458347226626275 in progress.",
                "volumeConfigurations": [
                    {
                        "name": "ebs-volume",
                        "managedEBSVolume": {
                            "volumeType": "gp3",
                            "sizeInGiB": 100,
                            "iops": 3000,
                            "throughput": 125,
                            "roleArn": "arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                            "filesystemType": "ext4"
                        }
                    }
                ]
            },
            {
                "id": "ecs-svc/5191625155316533644",
                "status": "ACTIVE",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:2",
                "desiredCount": 2,
                "pendingCount": 0,
                "runningCount": 2,
                "failedTasks": 0,
                "createdAt": "2025-02-21T14:54:48.862000-06:00",
                "updatedAt": "2025-02-21T14:57:22.502000-06:00",
                "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "COMPLETED",
                "rolloutStateReason": "ECS deployment ecs-svc/5191625155316533644 completed."
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [
            {
                "id": "b5823113-c2c5-458e-9649-8c2ed38f23a5",
                "createdAt": "2025-02-21T14:57:22.508000-06:00",
                "message": "(service my-http-service) has reached a steady state."
            },
            {
                "id": "b05a48e8-da35-4074-80aa-37ceb3167357",
                "createdAt": "2025-02-21T14:57:22.507000-06:00",
                "message": "(service my-http-service) (deployment ecs-svc/5191625155316533644) deployment completed."
            },
            {
                "id": "a10cd55d-4ba6-4cea-a655-5a5d32ada8a0",
                "createdAt": "2025-02-21T14:55:32.833000-06:00",
                "message": "(service my-http-service) has started 1 tasks: (task fb9c8df512684aec92f3c57dc3f22361)."
            },
        ],
        "createdAt": "2025-02-21T14:54:48.862000-06:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:role/AIDACKCEVSQ6C2EXAMPLE",
        "enableECSManagedTags": true,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "ENABLED"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 Amazon EBS 볼륨 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html)을 참조하세요.  
**예시 4: Amazon EBS 볼륨을 더 이상 사용하지 않도록 서비스 업데이트**  
다음 `update-service` 예시에서는 Amazon EBS 볼륨을 더 이상 사용하지 않도록 `my-http-service` 서비스를 업데이트합니다. `configuredAtLaunch`를 `false`로 설정하여 작업 정의 개정을 지정해야 합니다.  

```
aws ecs update-service \
    --cluster {{mycluster}} \
    --task-definition {{mytaskdef}} \
    --service {{my-http-service}} \
    --desired-count {{2}} \
    --volume-configurations {{"[]"}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-west-2:123456789012:service/mycluster/my-http-service",
        "serviceName": "my-http-service",
        "clusterArn": "arn:aws:ecs:us-west-2:123456789012:cluster/mycluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 2,
        "pendingCount": 0,
        "launchType": "FARGATE",
        "platformVersion": "LATEST",
        "platformFamily": "Linux",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": true,
                "rollback": true
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100,
            "alarms": {
                "alarmNames": [],
                "rollback": false,
                "enable": false
            }
        },
        "deployments": [
            {
                "id": "ecs-svc/7522791612543716777",
                "status": "PRIMARY",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/mytaskdef:3",
                "desiredCount": 0,
                "pendingCount": 0,
                "runningCount": 0,
                "failedTasks": 0,
                "createdAt": "2025-02-21T15:25:38.598000-06:00",
                "updatedAt": "2025-02-21T15:25:38.598000-06:00",
                    "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "IN_PROGRESS",
                "rolloutStateReason": "ECS deployment ecs-svc/7522791612543716777 in progress."
            },
            {
                "id": "ecs-svc/2420458347226626275",
                "status": "ACTIVE",
                "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/myoldtaskdef:1",
                "desiredCount": 2,
                "pendingCount": 0,
                "runningCount": 2,
                "failedTasks": 0,
                "createdAt": "2025-02-21T15:07:20.519000-06:00",
                "updatedAt": "2025-02-21T15:10:59.955000-06:00",
                "launchType": "FARGATE",
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-12344321"
                        ],
                        "securityGroups": [
                            "sg-12344321"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "COMPLETED",
                "rolloutStateReason": "ECS deployment ecs-svc/2420458347226626275 completed.",
                "volumeConfigurations": [
                    {
                        "name": "ebs-volume",
                        "managedEBSVolume": {
                            "volumeType": "gp3",
                            "sizeInGiB": 100,
                            "iops": 3000,
                            "throughput": 125,
                            "roleArn": "arn:aws:iam::123456789012:role/ecsInfrastructureRole",
                            "filesystemType": "ext4"
                        }
                    }
                ]
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [
            {
                "id": "4f2c3ca1-7800-4048-ba57-bba210ada2ad",
                "createdAt": "2025-02-21T15:10:59.959000-06:00",
                "message": "(service my-http-service) has reached a steady state."
            },
            {
                "id": "4b36a593-2d40-4ed6-8be8-b9b699eb6198",
                "createdAt": "2025-02-21T15:10:59.958000-06:00",
                "message": "(service my-http-service) (deployment ecs-svc/2420458347226626275) deployment completed."
            },
            {
                "id": "88380089-14e2-4ef0-8dbb-a33991683371",
                "createdAt": "2025-02-21T15:09:39.055000-06:00",
                "message": "(service my-http-service) has stopped 1 running tasks: (task fb9c8df512684aec92f3c57dc3f22361)."
            },
            {
                "id": "97d84243-d52f-4255-89bb-9311391c61f6",
                "createdAt": "2025-02-21T15:08:57.653000-06:00",
                "message": "(service my-http-service) has stopped 1 running tasks: (task 33eff090ad2c40539daa837e6503a9bc)."
            },
            {
                "id": "672ece6c-e2d0-4021-b5da-eefb14001687",
                "createdAt": "2025-02-21T15:08:15.631000-06:00",
                "message": "(service my-http-service) has started 1 tasks: (task 996c02a66ff24f3190a4a8e0c841740f)."
            },
            {
                "id": "a3cf9bea-9be6-4175-ac28-4c68360986eb",
                "createdAt": "2025-02-21T15:07:36.931000-06:00",
                "message": "(service my-http-service) has started 1 tasks: (task d5d23c39f89e46cf9a647b9cc6572feb)."
            },
            {
                "id": "b5823113-c2c5-458e-9649-8c2ed38f23a5",
                "createdAt": "2025-02-21T14:57:22.508000-06:00",
                "message": "(service my-http-service) has reached a steady state."
            },
            {
                "id": "b05a48e8-da35-4074-80aa-37ceb3167357",
                "createdAt": "2025-02-21T14:57:22.507000-06:00",
                "message": "(service my-http-service) (deployment ecs-svc/5191625155316533644) deployment completed."
            },
            {
                "id": "a10cd55d-4ba6-4cea-a655-5a5d32ada8a0",
                "createdAt": "2025-02-21T14:55:32.833000-06:00",
                "message": "(service my-http-service) has started 1 tasks: (task fb9c8df512684aec92f3c57dc3f22361)."
            },
            {
                "id": "42da91fa-e26d-42ef-88c3-bb5965c56b2f",
                "createdAt": "2025-02-21T14:55:02.703000-06:00",
                "message": "(service my-http-service) has started 1 tasks: (task 33eff090ad2c40539daa837e6503a9bc)."
            }
        ],
        "createdAt": "2025-02-21T14:54:48.862000-06:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:role/AIDACKCEVSQ6C2EXAMPLE",
        "enableECSManagedTags": true,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "ENABLED"
    }
}
```
자세한 내용은 *Amazon ECS 개발자 안내서*의 [Amazon ECS에서 Amazon EBS 볼륨 사용](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ebs-volumes.html)을 참조하세요.  
**예시 5: 서비스에 대한 가용 영역 리밸런싱 켜기**  
다음 `update-service` 예제에서는 `my-http-service` 서비스에 대해 가용 영역 리밸런싱을 켭니다.  

```
aws ecs update-service \
    --cluster {{MyCluster}} \
    --service {{my-http-service}} \
    --availability-zone-rebalancing {{ENABLED}}
```
출력:  

```
{
    "service": {
        "serviceArn": "arn:aws:ecs:us-east-1:123456789012:service/MyCluster/my-http-service",
        "serviceName": "my-http-service",
        "clusterArn": "arn:aws:ecs:us-east-1:123456789012:cluster/MyCluster",
        "loadBalancers": [],
        "serviceRegistries": [],
        "status": "ACTIVE",
        "desiredCount": 2,
        "runningCount": 1,
        "pendingCount": 0,
        "capacityProviderStrategy": [
            {
                "capacityProvider": "FARGATE",
                "weight": 1,
                "base": 0
            }
        ],
        "platformVersion": "LATEST",
        "platformFamily": "Linux",
        "taskDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
        "deploymentConfiguration": {
            "deploymentCircuitBreaker": {
                "enable": true,
                "rollback": true
            },
            "maximumPercent": 200,
            "minimumHealthyPercent": 100,
            "alarms": {
                "alarmNames": [],
                "rollback": false,
                "enable": false
            }
        },
        "deployments": [
            {
                "id": "ecs-svc/1976744184940610707",
                "status": "PRIMARY",
                "taskkDefinition": "arn:aws:ecs:us-east-1:123456789012:task-definition/MyTaskDefinition",
                "desiredCount": 1,
                "pendingCount": 0,
                "runningCount": 1,
                "failedTasks": 0,
                "createdAt": "2024-12-03T16:24:25.225000-05:00",
                "updatedAt": "2024-12-03T16:25:15.837000-05:00",
                "capacityProviderStrategy": [
                    {
                        "capacityProvider": "FARGATE",
                        "weight": 1,
                        "base": 0
                    }
                ],
                "platformVersion": "1.4.0",
                "platformFamily": "Linux",
                "networkConfiguration": {
                    "awsvpcConfiguration": {
                        "subnets": [
                            "subnet-0d0eab1bb38d5ca64",
                            "subnet-0db5010045995c2d5"
                        ],
                        "securityGroups": [
                            "sg-02556bf85a191f59a"
                        ],
                        "assignPublicIp": "ENABLED"
                    }
                },
                "rolloutState": "COMPLETED",
                "rolloutStateReason": "ECS deployment ecs-svc/1976744184940610707 completed."
            }
        ],
        "roleArn": "arn:aws:iam::123456789012:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS",
        "events": [],
        "createdAt": "2024-12-03T16:24:25.225000-05:00",
        "placementConstraints": [],
        "placementStrategy": [],
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-0d0eab1bb38d5ca64",
                    "subnet-0db5010045995c2d5"
                ],
                "securityGroups": [
                    "sg-02556bf85a191f59a"
                ],
                "assignPublicIp": "ENABLED"
            }
        },
        "healthCheckGracePeriodSeconds": 0,
        "schedulingStrategy": "REPLICA",
        "deploymentController": {
            "type": "ECS"
        },
        "createdBy": "arn:aws:iam::123456789012:role/Admin",
        "enableECSManagedTags": true,
        "propagateTags": "NONE",
        "enableExecuteCommand": false,
        "availabilityZoneRebalancing": "ENABLED"
    }
}
```
자세한 내용을 알아보려면 *Amazon ECS 개발자 안내서*의 [콘솔을 사용하여 Amazon ECS 서비스 업데이트](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service-console-v2.html) 섹션을 참조하시기 바랍니다.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateService](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-service.html)를 참조하세요.

### `update-task-protection`
<a name="ecs_UpdateTaskProtection_cli_2_topic"></a>

다음 코드 예시는 `update-task-protection`의 사용 방법을 보여줍니다.

**AWS CLI**  
**예제 1: ECS 작업에 대한 작업 보호 활성화**  
다음 `update-task-protection`에서는 배포 또는 서비스 AutoScaling에서 스케일 인 중에 ECS 작업이 종료되지 않도록 보호합니다. 작업 보호를 위한 사용자 지정 만료 기간을 1분에서 최대 2,880분(48시간)까지 지정할 수 있습니다. 만료 기간을 지정하지 않으면 작업 보호 기본 시간 활성화는 2시간입니다.  

```
aws ecs update-task-protection \
    --cluster {{ECS-project-update-cluster}} \
    --tasks {{c43ed3b1331041f289316f958adb6a24}} \
    --protection-enabled \
    --expires-in-minutes {{300}}
```
출력:  

```
{
"protectedTasks": [
    {
        "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/c43ed3b1331041f289316f958adb6a24",
        "protectionEnabled": true,
        "expirationDate": "2024-09-14T19:53:36.687000-05:00"
    }
],
"failures": []
}
```
**예제 2: ECS 작업에 대한 작업 보호 비활성화**  
다음 `update-task-protection`에서는 배포 또는 서비스 AutoScaling에서 스케일 인으로부터 보호되는 작업을 비활성화합니다.  

```
aws ecs update-task-protection \
    --cluster {{ECS-project-update-cluster}} \
    --tasks {{c43ed3b1331041f289316f958adb6a24}} \
    --no-protection-enabled
```
출력:  

```
{
    "protectedTasks": [
        {
            "taskArn": "arn:aws:ecs:us-west-2:123456789012:task/c43ed3b1331041f289316f958adb6a24",
            "protectionEnabled": false
        }
    ],
    "failures": []
}
```
작업 보호에 대한 자세한 내용은 *Amazon ECS 개발자 안내서*의 [스케일 인 이벤트로 인해 Amazon ECS 작업이 종료되지 않도록 보호](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-scale-in-protection.html)를 참조하세요.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateTaskProtection](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-task-protection.html)을 참조하세요.

### `update-task-set`
<a name="ecs_UpdateTaskSet_cli_2_topic"></a>

다음 코드 예시는 `update-task-set`의 사용 방법을 보여줍니다.

**AWS CLI**  
**작업 세트를 업데이트하려면**  
다음 `update-task-set` 예시에서는 작업 세트를 업데이트하여 규모를 조정합니다.  

```
aws ecs update-task-set \
    --cluster {{MyCluster}} \
    --service {{MyService}} \
    --task-set {{arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789}} \
    --scale {{value=50,unit=PERCENT}}
```
출력:  

```
{
    "taskSet": {
        "id": "ecs-svc/1234567890123456789",
        "taskSetArn": "arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789",
        "status": "ACTIVE",
        "taskDefinition": "arn:aws:ecs:us-west-2:123456789012:task-definition/sample-fargate:2",
        "computedDesiredCount": 0,
        "pendingCount": 0,
        "runningCount": 0,
        "createdAt": 1557128360.711,
        "updatedAt": 1557129279.914,
        "launchType": "EC2",
        "networkConfiguration": {
            "awsvpcConfiguration": {
                "subnets": [
                    "subnet-12344321"
                ],
                "securityGroups": [
                    "sg-12344321"
                ],
                "assignPublicIp": "DISABLED"
            }
        },
        "loadBalancers": [],
        "serviceRegistries": [],
        "scale": {
            "value": 50.0,
            "unit": "PERCENT"
        },
        "stabilityStatus": "STABILIZING",
        "stabilityStatusAt": 1557129279.914
    }
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [UpdateTaskSet](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ecs/update-task-set.html) 섹션을 참조하세요.