

• AWS Systems Manager CloudWatch 대시보드는 2026년 4월 30일 이후에는 더 이상 사용할 수 없습니다. 고객은 Amazon CloudWatch 콘솔을 계속 사용하여 현재와 마찬가지로 Amazon CloudWatch 대시보드를 보고, 생성하고, 관리할 수 있습니다. 자세한 내용은 [Amazon CloudWatch 대시보드 설명서](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Dashboards.html)를 참조하세요.

# 관리형 노드에서 명령 실행
<a name="running-commands"></a>

이 섹션에는 AWS Systems Manager 콘솔에서 관리형 노드로 명령을 전송하는 방법에 대한 정보가 포함되어 있습니다. 이 단원에는 명령을 취소하는 방법에 대한 정보도 나와 있습니다.

노드가 var 디렉터리에 대한 `noexec` 탑재 옵션으로 구성된 경우 Run Command는 명령을 성공적으로 실행할 수 없습니다.

**중요**  
Run Command를 사용해 명령을 보낼 때 암호, 구성 데이터 또는 기타 보안 암호와 같이 민감한 정보는 일반 텍스트 형식으로 포함하지 않습니다. 계정의 모든 Systems Manager API 활동은 AWS CloudTrail 로그를 위해 S3 버킷에 기록됩니다. 즉, 해당 S3 버킷에 대한 액세스 권한이 있는 사용자는 그러한 보안 암호의 일반 텍스트 값을 볼 수 있습니다. 따라서 `SecureString` 파라미터를 생성하고 사용하여 Systems Manager 작업에 사용하는 민감한 데이터를 암호화하는 것이 좋습니다.  
자세한 내용은 [IAM 정책을 사용하여 Parameter Store 파라미터에 대한 액세스 제한](sysman-paramstore-access.md) 섹션을 참조하세요.

**실행 이력 유지**  
각 명령의 기록은 최대 30일 동안 사용할 수 있습니다. 또한 모든 로그 파일의 사본을 Amazon Simple Storage Service에 저장하거나 모든 API 직접 호출의 감사 추적을 AWS CloudTrail에서 보유할 수 있습니다.

**관련 정보**  
다른 도구를 사용하여 명령을 전송하는 방법에 대한 자세한 내용은 아래 주제를 참조하세요.
+ [연습: Run Command에서 AWS Tools for Windows PowerShell 사용](walkthrough-powershell.md) 또는 [AWS Tools for PowerShell Cmdlet Reference의 AWS Systems Manager 섹션](https://docs.aws.amazon.com/powershell/latest/reference/items/AWS_Systems_Manager_cmdlets.html)에 있는 예제
+ [연습: Run Command에서 AWS CLI 사용](walkthrough-cli.md) 또는 [SSM CLI Reference](https://docs.aws.amazon.com/cli/latest/reference/ssm/)의 예제

**Topics**
+ [

# 콘솔에서 명령 실행
](running-commands-console.md)
+ [

# 특정 문서 버전을 사용하여 명령 실행
](run-command-version.md)
+ [

# 대규모로 명령 실행
](send-commands-multiple.md)
+ [

# 명령 취소
](cancel-run-command.md)

# 콘솔에서 명령 실행
<a name="running-commands-console"></a>

AWS Management Console에서 AWS Systems Manager의 도구인 Run Command를 사용하여 로그인하지 않고도 관리형 노드를 구성할 수 있습니다. 이 주제에는 Run Command를 사용하여 관리형 노드에서 [SSM Agent를 업데이트](run-command-tutorial-update-software.md#rc-console-agentexample)하는 방법을 보여주는 예가 포함되어 있습니다.

**시작하기 전 준비 사항**  
Run Command를 사용하여 명령을 보내기 전에 관리형 노드에서 모든 Systems Manager [설정 요구 사항](systems-manager-setting-up-nodes.md)을 충족하는지 확인합니다.

**Run Command를 사용하여 명령을 전송하려면**

1. AWS Systems Manager 콘솔([https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/))을 엽니다.

1. 탐색 창에서 **Run Command**를 선택합니다.

1. **Run command**(Run 명령)를 선택합니다.

1. **Command 문서(Command document)** 목록에서 Systems Manager 문서를 선택합니다.

1. **명령 파라미터** 섹션에서 필요한 파라미터의 값을 지정합니다.

1. **Targets**(대상) 섹션에서, 태그를 지정하거나, 수동으로 인스턴스나 엣지 디바이스를 선택하거나, 리소스 그룹을 지정하여 이 작업을 실행할 관리형 노드를 식별합니다.
**작은 정보**  
예상한 관리형 노드가 목록에 없으면 [관리형 노드 가용성 문제 해결](fleet-manager-troubleshooting-managed-nodes.md)에서 문제 해결 팁을 참조하세요.

1. **Other parameters**(다른 파라미터):
   + **Comment**(설명)에 명령에 대한 정보를 입력합니다.
   + **제한 시간(초)**에서 전체 명령 실행이 실패할 때까지 시스템이 기다리는 시간을 초 단위로 지정합니다.

1. **Rate control**(속도 제어)에서
   + **Concurrency**(동시성)에서 명령을 동시에 실행할 관리형 노드의 백분율 또는 개수를 지정합니다.
**참고**  
관리형 노드에 적용할 태그를 지정하거나, AWS 리소스 그룹을 지정하여 대상을 선택하였지만 대상으로 지정할 관리형 노드 수를 잘 모를 경우에는 백분율을 지정하여 동시에 문서를 실행할 수 있는 대상 수를 제한합니다.
   + **Error threshold**(오류 임계값)에서, 명령이 노드의 개수 또는 백분율에서 실패한 후 다른 관리형 노드에서 해당 명령의 실행을 중지할 시간을 지정합니다. 예를 들어 세 오류를 지정하면 네 번째 오류를 받았을 때 Systems Manager가 명령 전송을 중지합니다. 여전히 명령을 처리 중인 관리형 노드도 오류를 전송할 수 있습니다.

1. (선택 사항) 모니터링을 위해 명령에 적용할 CloudWatch 경보를 선택합니다. CloudWatch 경보를 명령에 연결하려면 명령을 실행하는 IAM 보안 주체에 `iam:createServiceLinkedRole` 작업에 대한 권한이 있어야 합니다. CloudWatch 경보에 대한 자세한 내용은 [Amazon CloudWatch 경보 사용](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html)을 참조하세요. 경보가 활성화되면 보류 중인 명령 호출이 실행되지 않습니다.

1. (선택 사항) **Output options**(출력 옵션)에서 명령 출력을 파일에 저장하려면 **Write command output to an S3 bucket**(S3 버킷에 명령 출력 쓰기) 상자를 선택합니다. 상자에 버킷 및 접두사(폴더) 이름을 입력합니다.
**참고**  
데이터를 S3 버킷에 쓰는 기능을 부여하는 S3 권한은 이 작업을 수행하는 IAM 사용자의 권한이 아니라 인스턴스에 할당된 인스턴스 프로파일(EC2 인스턴스용) 또는 IAM 서비스 역할(하이브리드 정품 인증 시스템)의 권한입니다. 자세한 내용은 [Systems Manager에 필요한 인스턴스 권한 구성](setup-instance-permissions.md)이나 [하이브리드 환경을 위한 IAM 서비스 역할 생성](hybrid-multicloud-service-role.md)을 참조하세요. 또한 지정된 S3 버킷이 다른 AWS 계정에 있는 경우 관리형 노드와 연결된 인스턴스 프로파일 또는 IAM 서비스 역할은 해당 버킷에 쓸 수 있는 권한이 있어야 합니다.

1. **SNS notifications**(SNS 알림) 섹션에서, 명령 실행 상태에 대한 알림이 전송되도록 하려면 **Enable SNS notifications**(SNS 알림 활성화) 확인란을 선택합니다.

   Run Command에 대한 Amazon SNS 알림 구성에 대한 자세한 내용은 [Amazon SNS 알림을 사용하여 Systems Manager 상태 변경 모니터링](monitoring-sns-notifications.md) 섹션을 참조하세요.

1. **Run**(실행)을 선택합니다.

명령을 취소하는 방법에 대한 자세한 내용은 [명령 취소](cancel-run-command.md) 섹션을 참조하세요.

## 명령 실행
<a name="run-command-rerun"></a>

Systems Manager에는 Systems Manager 콘솔의 **Run Command** 페이지에서 명령을 다시 실행하는 2가지 옵션이 있습니다.
+ **Rerun(다시 실행)**: 이 버튼을 사용하면 명령을 변경하지 않고 동일한 명령을 실행할 수 있습니다.
+ **새로 복사(Copy to new)**: 이 버튼은 한 명령의 설정을 새 명령으로 복사하고 실행하기 전에 해당 설정을 편집할 수 있는 옵션을 제공합니다.

**명령을 다시 실행하려면**

1. AWS Systems Manager 콘솔([https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/))을 엽니다.

1. 탐색 창에서 **Run Command**를 선택합니다.

1. 다시 실행할 명령을 선택합니다. 명령 세부 정보 페이지에서 명령을 실행한 직후 명령을 다시 실행할 수 있습니다. 또는 **명령 기록(Command history)** 탭에서 이전에 실행한 명령을 선택할 수 있습니다.

1. **Rerun(다시 실행)**을 선택하여 동일한 명령을 변경 없이 실행하거나, 명령을 실행하기 전에 **새로 복사**를 선택하여 명령 설정을 편집합니다.

# 특정 문서 버전을 사용하여 명령 실행
<a name="run-command-version"></a>

문서 버전 파라미터를 사용하여 명령 실행 시 사용할 AWS Systems Manager 문서 버전을 지정할 수 있습니다. 이 파라미터에는 다음 옵션 중 하나를 지정할 수 있습니다.
+ \$1DEFAULT
+ \$1LATEST
+ 버전 번호

문서 버전 파라미터를 실행하여 명령을 실행하려면 다음 절차를 사용합니다.

------
#### [ Linux ]

**로컬 Linux 시스템에서 AWS CLI를 사용하여 명령을 실행하려면**

1. 아직 하지 않은 경우 AWS Command Line Interface(AWS CLI)을 설치하고 구성합니다.

   자세한 내용은 [최신 버전의 AWS CLI 설치 또는 업데이트](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)를 참조하세요.

1. 사용할 수 있는 모든 문서 나열

   이 명령을 실행하면 AWS Identity and Access Management(IAM) 권한에 따라 계정에 사용할 수 있는 문서를 모두 나열합니다.

   ```
   aws ssm list-documents
   ```

1. 다음 명령을 실행하여 문서의 여러 버전을 확인합니다. *document name*을 사용자의 정보로 바꿉니다.

   ```
   aws ssm list-document-versions \
       --name "document name"
   ```

1. 다음 명령을 실행하여 SSM 문서 버전을 사용하는 명령을 실행합니다. 각 *example resource placeholder*를 사용자의 정보로 바꿉니다.

   ```
   aws ssm send-command \
       --document-name "AWS-RunShellScript" \
       --parameters commands="echo Hello" \
       --instance-ids instance-ID \
       --document-version '$LATEST'
   ```

------
#### [ Windows ]

**로컬 Windows 시스템에서 AWS CLI를 사용하여 명령을 실행하려면**

1. 아직 하지 않은 경우 AWS Command Line Interface(AWS CLI)을 설치하고 구성합니다.

   자세한 내용은 [최신 버전의 AWS CLI 설치 또는 업데이트](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)를 참조하세요.

1. 사용할 수 있는 모든 문서 나열

   이 명령을 실행하면 AWS Identity and Access Management(IAM) 권한에 따라 계정에 사용할 수 있는 문서를 모두 나열합니다.

   ```
   aws ssm list-documents
   ```

1. 다음 명령을 실행하여 문서의 여러 버전을 확인합니다. *document name*을 사용자의 정보로 바꿉니다.

   ```
   aws ssm list-document-versions ^
       --name "document name"
   ```

1. 다음 명령을 실행하여 SSM 문서 버전을 사용하는 명령을 실행합니다. 각 *example resource placeholder*를 사용자의 정보로 바꿉니다.

   ```
   aws ssm send-command ^
       --document-name "AWS-RunShellScript" ^
       --parameters commands="echo Hello" ^
       --instance-ids instance-ID ^
       --document-version "$LATEST"
   ```

------
#### [ PowerShell ]

**Tools for PowerShell을 사용하여 명령을 실행하려면**

1. 아직 설치하지 않은 경우 AWS Tools for PowerShell(Tools for Windows PowerShell)을 설치하고 구성합니다.

   자세한 내용은 [AWS Tools for PowerShell 설치](https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html)를 참조하세요.

1. 사용할 수 있는 모든 문서 나열

   이 명령을 실행하면 AWS Identity and Access Management(IAM) 권한에 따라 계정에 사용할 수 있는 문서를 모두 나열합니다.

   ```
   Get-SSMDocumentList
   ```

1. 다음 명령을 실행하여 문서의 여러 버전을 확인합니다. *document name*을 사용자의 정보로 바꿉니다.

   ```
   Get-SSMDocumentVersionList `
       -Name "document name"
   ```

1. 다음 명령을 실행하여 SSM 문서 버전을 사용하는 명령을 실행합니다. 각 *example resource placeholder*를 사용자의 정보로 바꿉니다.

   ```
   Send-SSMCommand `
       -DocumentName "AWS-RunShellScript" `
       -Parameter @{commands = "echo helloWorld"} `
       -InstanceIds "instance-ID" `
       -DocumentVersion $LATEST
   ```

------

# 대규모로 명령 실행
<a name="send-commands-multiple"></a>

AWS Systems Manager의 도구인 Run Command에서는 `targets`를 사용하여 관리형 노드의 플릿에 대해 명령을 실행할 수 있습니다. `targets` 파라미터는 관리형 노드에 대해 지정한 태그를 바탕으로 `Key,Value` 조합을 허용합니다. 명령을 실행하면 시스템에서 지정된 태그와 일치하는 모든 관리형 노드를 찾아 이러한 인스턴스에 대해 명령 실행을 시도합니다. 관리형 인스턴스의 태그 지정에 대한 자세한 내용은 **AWS 리소스 태그 지정 사용 설명서의 [AWS 리소스 태그 지정](https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-editor.html)을 참조하세요. 관리형 IoT 디바이스 태그 지정에 대한 자세한 내용은 *AWS IoT Greengrass Version 2개발자 안내서*의 [AWS IoT Greengrass Version 2 리소스 태그하기](https://docs.aws.amazon.com/greengrass/v2/developerguide/tag-resources.html) 섹션을 참조하세요.

다음 섹션에 설명된 대로 `targets` 파라미터를 사용하여 특정 관리형 노드 ID 목록을 대상으로 지정할 수도 있습니다.

수백 또는 수천 개의 관리형 노드에 걸쳐 명령 실행을 제어할 수 있도록 Run Command에는 하나의 요청을 동시에 처리할 수 있는 노드의 수와 명령이 취소되기 전에 명령에서 발생시킬 수 있는 오류의 수를 제한하기 위한 파라미터가 포함되어 있습니다.

**Topics**
+ [

## 다중 관리형 노드 대상 지정
](#send-commands-targeting)
+ [

## 비율 제어 사용
](#send-commands-rate)

## 다중 관리형 노드 대상 지정
<a name="send-commands-targeting"></a>

태그, AWS 리소스 그룹 이름, 또는 관리형 노드 ID를 지정하여 명령 및 대상 관리 노드를 실행할 수 있습니다.

다음 예시에서는 AWS Command Line Interface(AWS CLI)에서 Run Command를 사용할 경우의 명령 형식을 보여줍니다. *example resource placeholder*를 사용자의 정보로 바꿉니다. 이번 단원의 샘플 명령은 `[...]`를 사용해 잘립니다.

**예제 1: 태그를 대상으로 지정**

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:tag-name,Values=tag-value \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:tag-name,Values=tag-value ^
    [...]
```

------

**예제 2: AWS 리소스 그룹을 대상으로 지정**

명령 한 번마다 지정할 수 있는 리소스 그룹 이름은 최대 1개입니다. 리소스 그룹을 생성할 때는 그룹화 기준에서 `AWS::SSM:ManagedInstance`와 `AWS::EC2::Instance`를 리소스 유형으로 추가하는 것이 좋습니다.

**참고**  
리소스 그룹을 대상으로 지정하는 명령을 전송하려면 먼저 해당 그룹에 속한 리소스를 나열하거나 볼 수 있는 AWS Identity and Access Management(IAM) 권한을 부여해야 합니다. 자세한 내용은 *AWS Resource Groups 사용 설명서*의 [권한 설정](https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-prereqs.html#gettingstarted-prereqs-permissions)을 참조하세요.

------
#### [ Linux & macOS ]

```
aws ssm send-command \    
    --document-name document-name \
    --targets Key=resource-groups:Name,Values=resource-group-name \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^    
    --document-name document-name ^
    --targets Key=resource-groups:Name,Values=resource-group-name ^
    [...]
```

------

**예제 3: 리소스 유형별로 AWS 리소스 그룹 태그 지정**

명령 한 번마다 지정할 수 있는 리소스 그룹 유형은 최대 5개입니다. 리소스 그룹을 생성할 때는 그룹화 기준에서 `AWS::SSM:ManagedInstance`와 `AWS::EC2::Instance`를 리소스 유형으로 추가하는 것이 좋습니다.

**참고**  
리소스 그룹을 대상으로 지정하는 명령을 전송하려면 먼저 해당 그룹에 속한 리소스를 나열하거나 볼 수 있는 IAM 권한을 부여해야 합니다. 자세한 내용은 *AWS Resource Groups 사용 설명서*의 [권한 설정](https://docs.aws.amazon.com/ARG/latest/userguide/gettingstarted-prereqs.html#gettingstarted-prereqs-permissions)을 참조하세요.

------
#### [ Linux & macOS ]

```
aws ssm send-command \    
    --document-name document-name \
    --targets Key=resource-groups:ResourceTypeFilters,Values=resource-type-1,resource-type-2 \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^    
    --document-name document-name ^
    --targets Key=resource-groups:ResourceTypeFilters,Values=resource-type-1,resource-type-2 ^
    [...]
```

------

**예제 4: 인스턴스 ID를 대상으로 지정**

다음 예에서는 `instanceids` 키와 `targets` 파라미터를 사용하여 관리형 노드를 대상으로 지정하는 방법을 보여줍니다. 각 디바이스에 mi-*ID\$1number*가 지정되어 있기 때문에 이 키를 사용하여 관리형 AWS IoT Greengrass 코어 디바이스를 대상으로 지정할 수 있습니다. AWS Systems Manager의 도구인 Fleet Manager에서 디바이스 ID를 볼 수 있습니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=instanceids,Values=instance-ID-1,instance-ID-2,instance-ID-3 \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=instanceids,Values=instance-ID-1,instance-ID-2,instance-ID-3 ^
    [...]
```

------

`Environment`라는 `Key`와 `Development`, `Test`, `Pre-production` 및 `Production`의 `Values`를 사용하여 다양한 환경에 대해 관리형 노드에 태그를 지정한 경우에는 다음 구문과 함께 `targets` 파라미터를 사용해 이러한 환경 중 *하나*의 모든 관리형 노드로 명령을 보낼 수 있습니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Environment,Values=Development \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Environment,Values=Development ^
    [...]
```

------

`Values` 목록에 추가하여 다른 환경의 추가 관리형 노드를 대상으로 지정할 수 있습니다. 쉼표를 사용하여 항목을 구분합니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Environment,Values=Development,Test,Pre-production \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Environment,Values=Development,Test,Pre-production ^
    [...]
```

------

**번형**: `Key` 기준을 여러 개 사용하여 대상 세분화

`Key` 조건을 여러 개 포함시켜 명령의 대상 수를 세분화할 수 있습니다. `Key` 조건을 두 개 이상 포함시키면 시스템에서 *모든* 조건을 충족하는 관리형 노드를 대상으로 지정합니다. 다음 명령은 재무 부서에 대해 태그가 지정되고 *또한* 데이터베이스 서버 역할에 대해 태그가 지정된 모든 관리형 노드를 대상으로 지정합니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Department,Values=Finance Key=tag:ServerRole,Values=Database \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Department,Values=Finance Key=tag:ServerRole,Values=Database ^
    [...]
```

------

**번형**: 여러 `Key` 및 `Value` 기준 사용

앞의 예제를 확장해 `Values` 조건에 항목을 추가로 포함시켜 여러 부서 및 여러 서버 역할을 대상으로 지정할 수 있습니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database ^
    [...]
```

------

**번형**: 여러 `Values` 기준을 사용하여 태그가 지정된 관리형 노드를 대상으로 지정

`Department`라는 `Key`와 `Sales`, `Finance`의 `Values`를 사용하여 다양한 환경에 대해 관리형 노드에 태그를 지정한 경우에는 다음 구문과 함께 `targets` 파라미터를 사용해 이러한 환경의 모든 노드로 명령을 보낼 수 있습니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Department,Values=Sales,Finance \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Department,Values=Sales,Finance ^
    [...]
```

------

최대 5개의 키와 각 키에 대해 5개의 값을 지정할 수 있습니다.

태그 키(태그 이름) 또는 태그 값에 공백이 포함된 경우 다음 예와 같이 태그 키 또는 값을 인용 부호로 묶습니다.

**예**: `Value` 태그의 공백

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:OS,Values="Windows Server 2016" \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:OS,Values="Windows Server 2016" ^
    [...]
```

------

**예**: `tag` 키 및 `Value`의 공백

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key="tag:Operating System",Values="Windows Server 2016" \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key="tag:Operating System",Values="Windows Server 2016" ^
    [...]
```

------

**예**: `Values` 목록에서 한 항목의 공백

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --targets Key=tag:Department,Values="Sales","Finance","Systems Mgmt" ^
    [...]
```

------

## 비율 제어 사용
<a name="send-commands-rate"></a>

*동시성 제어*와 *오류 제어*를 사용하여 그룹의 관리형 노드로 명령이 전송되는 비율을 제어할 수 있습니다.

**Topics**
+ [

### 동시성 제어 사용
](#send-commands-velocity)
+ [

### 오류 제어 사용
](#send-commands-maxerrors)

### 동시성 제어 사용
<a name="send-commands-velocity"></a>

`max-concurrency` 파라미터(**Run a command**(명령 실행) 페이지의 **Concurrency**(동시성) 옵션))로 명령을 동시에 실행하는 관리형 노드의 수를 제어할 수 있습니다. 관리형 노드의 절대 개수(예: **10**)를 지정하거나 대상 집합의 비율(예: **10%**)을 지정할 수 있습니다. 대기 중인 시스템은 단일 노드에 명령을 전송하고 시스템이 초기 호출을 승인할 때까지 기다렸다가 명령을 2개 더 많은 노드에 보냅니다. 시스템은 시스템이 `max-concurrency` 값을 충족할 때까지 기하급수적으로 더 많은 노드에 명령을 보냅니다. `max-concurrency`의 기본값은 50입니다. 다음 예는 `max-concurrency` 파라미터에 대한 값을 지정하는 방법을 보여줍니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --max-concurrency 10 \
    --targets Key=tag:Environment,Values=Development \
    [...]
```

```
aws ssm send-command \
    --document-name document-name \
    --max-concurrency 10% \
    --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --max-concurrency 10 ^
    --targets Key=tag:Environment,Values=Development ^
    [...]
```

```
aws ssm send-command ^
    --document-name document-name ^
    --max-concurrency 10% ^
    --targets Key=tag:Department,Values=Finance,Marketing Key=tag:ServerRole,Values=WebServer,Database ^
    [...]
```

------

### 오류 제어 사용
<a name="send-commands-maxerrors"></a>

`max-errors` 파라미터(**명령 실행** 페이지의 **오류 임계값(Error threshold)** 필드)로 오류 제한을 설정하여 수백 또는 수천 개의 관리형 노드에 대한 명령 실행을 제어할 수도 있습니다. 이 파라미터는 시스템이 추가 관리형 노드로의 명령 전송을 중지하기까지 허용되는 오류 횟수를 지정합니다. 오류의 절대 개수(예: **10**)를 지정하거나 대상 집합의 비율(예: **10%**)을 지정할 수 있습니다. 예를 들어 **3**을 지정하면 네 번째 오류를 받았을 때 명령 전송이 중지됩니다. **0**을 지정하면 첫 번째 오류 결과가 반환된 후 추가 관리형 노드로의 명령 전송이 중지됩니다. 50개의관리형 노드로 명령을 보내고 `max-errors`을 **10%**로 설정하면 여섯 번째 오류를 받았을 때 추가 노드로의 명령 전송이 중지됩니다.

`max-errors`에 도달할 때 이미 명령을 실행 중인 호출은 완료될 수 있지만, 이런 호출 중 일부는 실패할 수도 있습니다. 실패한 호출 수가 `max-errors`보다 많지 않도록 해야 할 경우에는 호출이 한 번에 한 개를 초과하지 않도록 `max-concurrency`를 **1**로 설정하십시오. max-errors의 기본값은 0입니다. 다음 예는 `max-errors` 파라미터에 대한 값을 지정하는 방법을 보여줍니다.

------
#### [ Linux & macOS ]

```
aws ssm send-command \
    --document-name document-name \
    --max-errors 10 \
    --targets Key=tag:Database,Values=Development \
    [...]
```

```
aws ssm send-command \
    --document-name document-name \
    --max-errors 10% \
    --targets Key=tag:Environment,Values=Development \
    [...]
```

```
aws ssm send-command \
    --document-name document-name \
    --max-concurrency 1 \
    --max-errors 1 \
    --targets Key=tag:Environment,Values=Production \
    [...]
```

------
#### [ Windows ]

```
aws ssm send-command ^
    --document-name document-name ^
    --max-errors 10 ^
    --targets Key=tag:Database,Values=Development ^
    [...]
```

```
aws ssm send-command ^
    --document-name document-name ^
    --max-errors 10% ^
    --targets Key=tag:Environment,Values=Development ^
    [...]
```

```
aws ssm send-command ^
    --document-name document-name ^
    --max-concurrency 1 ^
    --max-errors 1 ^
    --targets Key=tag:Environment,Values=Production ^
    [...]
```

------

# 명령 취소
<a name="cancel-run-command"></a>

서비스에 명령이 보류 중 또는 실행 중 상태로 표시되는 경우 명령을 취소할 수 있습니다. 그러나 명령이 그러한 상태 중 하나인 경우에도 명령이 취소되고 기본 프로세스가 중지되는 것을 보장할 수 없습니다.

**콘솔을 사용하여 명령을 취소하려면**

1. AWS Systems Manager 콘솔([https://console.aws.amazon.com/systems-manager/](https://console.aws.amazon.com/systems-manager/))을 엽니다.

1. 탐색 창에서 **Run Command**를 선택합니다.

1. 취소하고 싶은 명령 호출을 선택합니다.

1. **명령 취소**를 선택합니다.

**AWS CLI를 사용하여 명령을 취소하려면**  
다음 명령을 실행합니다. 각 *example resource placeholder*를 사용자의 정보로 바꿉니다.

------
#### [ Linux & macOS ]

```
aws ssm cancel-command \
    --command-id "command-ID" \
    --instance-ids "instance-ID"
```

------
#### [ Windows ]

```
aws ssm cancel-command ^
    --command-id "command-ID" ^
    --instance-ids "instance-ID"
```

------

취소된 명령의 상태에 대한 자세한 내용은 [명령 상태 이해](monitor-commands.md) 섹션을 참조하세요.