

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

# Run Command 명령을 사용하여 Parameter Store에서 파라미터 작업
<a name="sysman-param-runcommand"></a>

AWS Systems Manager의 도구인 Run Command에서 파라미터를 사용할 수 있습니다. 자세한 내용은 [AWS Systems Manager Run Command](run-command.md) 섹션을 참조하세요.

## 콘솔을 사용하여 문자열 파라미터 실행
<a name="param-test-console"></a>

다음 절차는 `String` 파라미터를 사용하는 명령을 실행하는 과정을 안내합니다.

**Parameter Store를 사용하여 문자열 파라미터를 실행하려면**

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

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

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

1. **명령 문서** 목록에서 `AWS-RunPowerShellScript`(Windows) 또는 `AWS-RunShellScript`(Linux)를 선택합니다.

1. **Command parameters(명령 파라미터)**에 **echo \$1\$1ssm:*parameter-name*\$1\$1**를 입력합니다. 예를 들면 **echo \$1\$1ssm:/Test/helloWorld\$1\$1**입니다.

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

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

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

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**(실행)을 선택합니다.

1. **명령 ID** 페이지의 **대상 및 출력(Targets and outputs)** 영역에서 명령을 실행한 노드의 ID 옆에 있는 버튼을 선택한 다음, **출력 보기(View output)**를 선택합니다. 명령의 출력이 파라미터에 제공한 값(예: **This is my first parameter**)인지 확인합니다.

## AWS CLI를 사용하여 파라미터 실행
<a name="param-test-cli"></a>

**예 1: 단순 명령**  
다음 예제의 명령에는 `DNS-IP`라는 Systems Manager 파라미터가 포함되어 있습니다. 이 파라미터의 값은 단순히 노드의 IP 주소입니다. 이 예에서는 AWS Command Line Interface(AWS CLI) 명령을 사용하여 파라미터 값을 반향합니다.

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

```
aws ssm send-command \
    --document-name "AWS-RunShellScript" \
    --document-version "1" \
    --targets "Key=instanceids,Values=i-02573cafcfEXAMPLE" \
    --parameters "commands='echo {{ssm:DNS-IP}}'" \
    --timeout-seconds 600 \
    --max-concurrency "50" \
    --max-errors "0" \
    --region us-east-2
```

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

```
aws ssm send-command ^
    --document-name "AWS-RunPowerShellScript" ^
    --document-version "1" ^
    --targets "Key=instanceids,Values=i-02573cafcfEXAMPLE" ^
    --parameters "commands='echo {{ssm:DNS-IP}}'" ^
    --timeout-seconds 600 ^
    --max-concurrency "50" ^
    --max-errors "0" ^
    --region us-east-2
```

------

명령은 다음과 같은 정보를 반환합니다.

```
{
    "Command": {
        "CommandId": "c70a4671-8098-42da-b885-89716EXAMPLE",
        "DocumentName": "AWS-RunShellScript",
        "DocumentVersion": "1",
        "Comment": "",
        "ExpiresAfter": "2023-12-26T15:19:17.771000-05:00",
        "Parameters": {
            "commands": [
                "echo {{ssm:DNS-IP}}"
            ]
        },
        "InstanceIds": [],
        "Targets": [
            {
                "Key": "instanceids",
                "Values": [
                    "i-02573cafcfEXAMPLE"
                ]
            }
        ],
        "RequestedDateTime": "2023-12-26T14:09:17.771000-05:00",
        "Status": "Pending",
        "StatusDetails": "Pending",
        "OutputS3Region": "us-east-2",
        "OutputS3BucketName": "",
        "OutputS3KeyPrefix": "",
        "MaxConcurrency": "50",
        "MaxErrors": "0",
        "TargetCount": 0,
        "CompletedCount": 0,
        "ErrorCount": 0,
        "DeliveryTimedOutCount": 0,
        "ServiceRole": "",
        "NotificationConfig": {
            "NotificationArn": "",
            "NotificationEvents": [],
            "NotificationType": ""
        },
        "CloudWatchOutputConfig": {
            "CloudWatchLogGroupName": "",
            "CloudWatchOutputEnabled": false
        },
        "TimeoutSeconds": 600,
        "AlarmConfiguration": {
            "IgnorePollAlarmFailure": false,
            "Alarms": []
        },
        "TriggeredAlarms": []
    }
}
```

명령 실행을 마친 후 다음 명령을 사용하여 해당 명령에 대한 자세한 정보를 볼 수 있습니다.
+ [https://docs.aws.amazon.com/cli/latest/reference/ssm/get-command-invocation.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/get-command-invocation.html) - 명령 실행에 대한 세부 정보를 확인합니다.
+ [https://docs.aws.amazon.com/cli/latest/reference/ssm/link-cli-ref-list-command-invocations.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/link-cli-ref-list-command-invocations.html) - 특정 관리형 노드의 명령 실행 상태를 확인합니다.
+ [https://docs.aws.amazon.com/cli/latest/reference/ssm/link-cli-ref-list-commands.html](https://docs.aws.amazon.com/cli/latest/reference/ssm/link-cli-ref-list-commands.html) - 여러 관리형 노드의 명령 실행 상태를 확인합니다.

**예 2: `SecureString` 파라미터 값 암호화 해제**  
다음 예제 명령은 **SecurePassword**라는 `SecureString` 파라미터를 사용합니다. `parameters` 필드에서 사용되는 명령은 `SecureString` 파라미터 값을 검색하고 암호를 복호화한 다음 로컬 관리자 암호를 일반 텍스트로 전달하지 않고도 재설정합니다.

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

```
aws ssm send-command \
        --document-name "AWS-RunShellScript" \
        --document-version "1" \
        --targets "Key=instanceids,Values=i-02573cafcfEXAMPLE" \
        --parameters '{"commands":["secure=$(aws ssm get-parameters --names SecurePassword --with-decryption --query Parameters[0].Value --output text --region us-east-2)","echo $secure | passwd myuser --stdin"]}' \
        --timeout-seconds 600 \
        --max-concurrency "50" \
        --max-errors "0" \
        --region us-east-2
```

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

```
aws ssm send-command ^
        --document-name "AWS-RunPowerShellScript" ^
        --document-version "1" ^
        --targets "Key=instanceids,Values=i-02573cafcfEXAMPLE" ^
        --parameters "commands=['$secure = (Get-SSMParameterValue -Names SecurePassword -WithDecryption $True).Parameters[0].Value','net user administrator $secure']" ^
        --timeout-seconds 600 ^
        --max-concurrency "50" ^
        --max-errors "0" ^
        --region us-east-2
```

------

**예 3: SSM 문서에서 파라미터 참조**  
다음 예에서 보듯이 SSM 문서의 [*파라미터(Parameters)*] 섹션에서 Systems Manager 파라미터를 참조할 수도 있습니다.

```
{
   "schemaVersion":"2.0",
   "description":"Sample version 2.0 document v2",
   "parameters":{
      "commands" : {
        "type": "StringList",
        "default": ["{{ssm:parameter-name}}"]
      }
    },
    "mainSteps":[
       {
          "action":"aws:runShellScript",
          "name":"runShellScript",
          "inputs":{
             "runCommand": "{{commands}}"
          }
       }
    ]
}
```

SSM 문서의 `runtimeConfig` 섹션에 사용된 *로컬 파라미터*에 대한 유사한 구문을 Parameter Store 파라미터와 혼동하지 마세요. 로컬 파라미터는 Systems Manager 파라미터와 동일하지 않습니다. 로컬 파라미터는 `ssm:` 접두사가 없다는 점에서 Systems Manager 파라미터와 구별됩니다.

```
"runtimeConfig":{
        "aws:runShellScript":{
            "properties":[
                {
                    "id":"0.aws:runShellScript",
                    "runCommand":"{{ commands }}",
                    "workingDirectory":"{{ workingDirectory }}",
                    "timeoutSeconds":"{{ executionTimeout }}"
```

**참고**  
SSM 문서는 `SecureString` 파라미터에 대한 참조를 지원하지 않습니다. 다시 말해 `SecureString` 등과 함께 Run Command 파라미터를 사용하기 위해서는 다음 예제에서와 같이 Run Command로 전달하기 전에 파라미터 값을 검색해야 합니다.  

```
value=$(aws ssm get-parameters --names parameter-name --with-decryption)
```

```
aws ssm send-command \
    --name AWS-JoinDomain \
    --parameters password=$value \
    --instance-id instance-id
```

```
aws ssm send-command ^
    --name AWS-JoinDomain ^
    --parameters password=$value ^
    --instance-id instance-id
```

```
$secure = (Get-SSMParameterValue -Names parameter-name -WithDecryption $True).Parameters[0].Value | ConvertTo-SecureString -AsPlainText -Force
```

```
$cred = New-Object System.Management.Automation.PSCredential -argumentlist user-name,$secure
```