

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

# AWS Systems Manager Documents
<a name="documents"></a>

AWS Systems Manager 문서(SSM 문서)는 Systems Manager가 관리형 인스턴스에서 실행하는 작업을 정의합니다. Systems Manager에는 런타임에 파라미터를 지정하여 사용할 수 있는 사전 구성 문서가 100개 이상 포함되어 있습니다. **Amazon 소유(Owned by Amazon)** 탭을 선택하거나 `ListDocuments` API 작업 호출 시 `Owner` 필터에 대해 Amazon을 지정하여 Systems Manager 문서(Systems Manager Documents) 콘솔에서 사전 구성된 문서를 찾을 수 있습니다. 문서는 JavaScript Object Notation(JSON) 또는 YAML을 사용하며 사용자가 지정하는 단계와 파라미터를 포함합니다.

보안 강화를 위해 2025년 7월 14일부터 SSM 문서는 파라미터를 처리할 때 환경 변수 보간을 지원합니다. 스키마 버전 2.2 및 SSM Agent 버전 3.3.2746.0 이상에서 사용할 수 있는 이 기능은 명령 삽입 공격을 방지하는 데 도움이 됩니다.

SSM 문서를 시작하려면 [Systems Manager 콘솔](https://console.aws.amazon.com/systems-manager/documents)을 엽니다. 탐색 창에서 **Documents**를 선택합니다.

**중요**  
Systems Manager에서 *Amazon 소유* SSM 문서는 Amazon Web Services 자체에서 생성하고 관리하는 문서입니다. *Amazon 소유* 문서에는 문서 이름에 접두사(예: `AWS-*`)가 포함됩니다. 문서의 소유자는 AWS 내 특정 사용자 계정이 아닌 Amazon으로 간주됩니다. 이 문서는 누구나 사용할 수 있도록 공개되어 있습니다.

## Documents 도구가 조직에 주는 이점은 무엇인가요?
<a name="ssm-docs-benefits"></a>

AWS Systems Manager의 도구인 Documents는 다음 이점을 제공합니다.
+ **문서 범주**

  필요한 문서를 찾는 데 도움이 되도록 검색 중인 문서 유형에 따라 범주를 선택합니다. 검색 범위를 넓히기 위해 동일한 문서 유형의 여러 범주를 선택할 수 있습니다. 서로 다른 문서 유형의 범주 선택은 지원되지 않습니다. 범주는 Amazon이 소유한 문서에만 지원됩니다.
+  **문서 버전** 

  다양한 버전의 문서를 작성하여 저장할 수 있습니다. 그런 다음 각 문서의 기본 버전을 지정할 수 있습니다. 문서의 기본 버전은 새로운 버전으로 업데이트하거나 이전 버전으로 되돌릴 수 있습니다. 문서의 콘텐츠를 변경하면 Systems Manager가 자동으로 문서의 버전을 높입니다. 콘솔, AWS Command Line Interface(AWS CLI) 명령 또는 API 호출에서 문서 버전을 지정하여 문서의 모든 버전을 검색하거나 사용할 수 있습니다.
+  **필요에 맞게 문서 사용자 지정** 

  문서에서 각 단계 및 작업을 사용자 정의하고 싶다면 자신만의 고유한 문서를 생성할 수 있습니다. 시스템은 문서를 생성한 AWS 리전의 AWS 계정으로 문서를 저장합니다. SSM 문서 생성 방법에 대한 자세한 내용은 [SSM 문서 콘텐츠 생성](documents-creating-content.md) 섹션을 참조하세요.
+  **문서에 태그 지정** 

  문서에 태그를 지정하면 문서에 지정한 태그를 토대로 하나 이상의 문서를 빠르게 식별하는 데 도움이 될 수 있습니다. 예를 들어 특정 환경, 부서, 사용자, 그룹 또는 기간의 문서에 태그를 지정할 수 있습니다. 또한 사용자나 그룹이 액세스할 수 있는 태그를 지정하는 AWS Identity and Access Management(IAM) 정책을 생성하여 문서에 대한 액세스를 제한할 수도 있습니다.
+  **문서 공유** 

  문서를 퍼블릭으로 설정하거나 동일한 AWS 리전에서 특정 AWS 계정와 공유할 수 있습니다. 고객 또는 직원에게 공급하는 모든 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스의 구성이 동일하기를 바라는 경우 계정 간 문서 공유가 유용할 수 있습니다. 인스턴스의 애플리케이션 및 패치를 최신 상태를 유지하는 것 외에도 고객 인스턴스의 특정 활동을 제한하고자 할 수도 있습니다. 또는 조직 전체의 직원 계정에서 사용하는 인스턴스가 특정 내부 리소스에 대해 액세스가 허용되도록 하고자 할 수도 있습니다. 자세한 내용은 [SSM 문서 공유](documents-ssm-sharing.md) 섹션을 참조하세요.

## 누가 Documents를 사용해야 하나요?
<a name="documents-who"></a>
+ Systems Manager 도구를 사용하여 규모에 맞게 운영 효율성을 개선하고, 수동 개입과 관련된 오류를 줄이고, 일반적인 문제 해결 시간을 단축하고자 하는 AWS 고객.
+ 배포 및 구성 태스크를 자동화하려는 인프라 전문가
+ 일반적인 문제를 안정적으로 해결하고, 문제 해결 효율성을 높이고, 반복 작업을 줄이려는 관리자
+ 일반적으로 수동으로 수행하는 태스크를 자동화하려는 사용자

## SSM 문서의 유형은 무엇인가요?
<a name="what-are-document-types"></a>

다음 표에서는 여러 유형의 SSM 문서와 그 용도에 대해 설명합니다.


****  

| Type | 용도 | 세부 정보 | 
| --- | --- | --- | 
|  ApplicationConfiguration ApplicationConfigurationSchema  |   [AWS AppConfig](https://docs.aws.amazon.com/appconfig/latest/userguide/what-is-appconfig.html)   |  AWS Systems Manager의 도구인 AWS AppConfig를 사용하여 애플리케이션 구성을 생성, 관리 및 신속하게 배포합니다. `ApplicationConfiguration` 문서 유형을 사용하는 문서를 만들어 SSM 문서에 구성 데이터를 저장할 수 있습니다. 자세한 내용은 *AWS AppConfig 사용 설명서*의 [자유형 구성](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile.html#free-form-configurations) 단원을 참조하십시오. SSM 문서에서 구성을 생성하는 경우 해당 JSON 스키마를 지정해야 합니다. 스키마는 `ApplicationConfigurationSchema` 문서 유형을 사용하여, 규칙 세트와 같이 각 애플리케이션 구성 설정에 대해 허용 가능한 속성을 정의합니다. 자세한 내용은 *AWS AppConfig 사용 설명서*의 [검사기 정보](https://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-creating-configuration-and-profile-validators.html) 단원을 참조하십시오.  | 
|  Automation 실행서  |   [자동화](systems-manager-automation.md)   [State Manager](systems-manager-state.md)   [Maintenance Windows](maintenance-windows.md)   |  Automation 실행서는 Amazon Machine Image(AMI) 생성 또는 업데이트와 같은 일반적인 유지 관리 및 배포 태스크를 실행할 때 사용됩니다. State Manager는 Automation 실행서를 사용하여 구성을 적용합니다. 이 작업은 인스턴스 수명 주기 중 언제든지 하나 이상의 대상에서 실행할 수 있습니다. Maintenance Windows에서는 Automation 실행서를 사용하여 지정된 일정을 기반으로 일반 유지 관리 및 배포 태스크를 수행합니다. Linux 기반 운영 체제에서 지원되는 모든 Automation 실행서는 macOS용 EC2 인스턴스에서도 지원됩니다.  | 
|  Change Calendar 문서  |   [Change Calendar](systems-manager-change-calendar.md)   |  AWS Systems Manager의 도구인 Change Calendar는 `ChangeCalendar` 문서 유형을 사용합니다. Change Calendar 문서는 자동화 작업에서 환경 변경을 허용하거나 금지할 수 있는 일정 항목 및 연관된 이벤트를 저장합니다. Change Calendar에서 문서는 [iCalendar 2.0](https://icalendar.org/) 데이터를 일반 텍스트 형식으로 저장합니다. Change Calendar는 macOS용 EC2 인스턴스에서 지원되지 않습니다.  | 
|  AWS CloudFormation 템플릿  |   [AWS CloudFormation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html)   |  AWS CloudFormation 템플릿은 CloudFormation 스택에서 프로비저닝할 리소스에 대해 설명합니다. CloudFormation 템플릿을 Systems Manager 문서로 저장하여 Systems Manager 문서 기능을 활용할 수 있습니다. 여기에는 여러 버전의 템플릿 생성 및 비교와 같은 AWS 리전에 있는 다른 계정과 템플릿 공유가 포함됩니다. Systems Manager의 도구인 Application Manager를 사용하여 CloudFormation 템플릿 및 스택을 생성하고 편집할 수 있습니다. 자세한 내용은 [Application Manager에서 CloudFormation 템플릿 및 스택 작업](application-manager-working-stacks.md) 섹션을 참조하세요.  | 
|  명령 문서  |   [Run Command](run-command.md)   [State Manager](systems-manager-state.md)   [Maintenance Windows](maintenance-windows.md)   |  AWS Systems Manager의 도구인 Run Command는 명령 문서를 사용하여 명령을 실행합니다. AWS Systems Manager의 도구인 State Manager는 명령 문서를 사용하여 구성을 적용합니다. 이 작업은 인스턴스 수명 주기 중 언제든지 하나 이상의 대상에서 실행할 수 있습니다. AWS Systems Manager의 도구인 Maintenance Windows에서는 Command 문서를 사용하여 지정된 일정을 기반으로 구성을 적용합니다. 대부분의 Command 문서는 모든 Linux 및 Systems Manager에서 지원하는 Windows Server 운영 체제에서 지원됩니다. 다음 Command 문서는 macOS용 EC2 인스턴스에서 지원됩니다. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/systems-manager/latest/userguide/documents.html)  | 
|  AWS Config 규정 준수 팩 템플릿  |   [AWS Config](https://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html)   |  AWS Config 규정 준수 팩 템플릿은 AWS Config 관리형 또는 사용자 지정 규칙 및 수정 작업 목록을 포함하는 규정 준수 팩을 생성하는 데 사용되는 YAML 형식의 문서입니다. 자세한 내용을 알아보려면 [규정 준수 팩](https://docs.aws.amazon.com/config/latest/developerguide/conformance-packs.html)을 참조하세요.  | 
|  패키지 문서  |   [Distributor](distributor.md)   |  AWS Systems Manager의 도구인 Distributor에서 패키지는 SSM 문서로 표현됩니다. 패키지 문서에는 관리형 인스턴스에 설치할 소프트웨어 또는 자산이 포함된 연결된 ZIP 아카이브 파일이 포함됩니다. Distributor에서 패키지를 생성하면 패키지 문서가 생성됩니다. Distributor는 Oracle Linux와 macOS 관리형 인스턴스에서 지원되지 않습니다.  | 
|  정책 문서  |   [State Manager](systems-manager-state.md)   |  AWS Systems Manager의 도구인 Inventory는 State Manager 연결이 있는 `AWS-GatherSoftwareInventory` Policy 문서를 사용하여 관리형 인스턴스에서 인벤토리 데이터를 수집합니다. 자체 SSM 문서 생성 시 Automation 실행서와 Command 문서는 관리형 인스턴스에서 정책을 적용하는 데 선호되는 방법입니다. Systems Manager Inventory 및 `AWS-GatherSoftwareInventory` Policy 문서는 Systems Manager에서 지원하는 모든 운영 체제에서 지원됩니다.  | 
|  인시던트 후 분석 템플릿  |   [Incident Manager 인시던트 후 분석](https://docs.aws.amazon.com/incident-manager/latest/userguide/analysis.html)   |  Incident Manager는 인시던트 후 분석 템플릿을 사용하여 AWS 운영 관리 모범 사례를 기반으로 분석을 생성합니다. 템플릿을 사용하여 팀에서 인시던트 대응에 대한 개선 사항을 식별하는 데 사용할 수 있는 분석을 생성합니다.  | 
|  세션 문서  |   [Session Manager](session-manager.md)   |  AWS Systems Manager의 도구인 Session Manager에서는 Session 문서를 사용하여 시작할 세션의 유형(예: 포트 전달 세션, 대화형 명령을 실행할 세션, SSH 터널을 생성할 세션)을 결정합니다. Session 문서는 모든 Linux 및 Systems Manager에서 지원하는 Windows Server 운영 체제에서 지원됩니다. 다음 Command 문서는 macOS용 EC2 인스턴스에서 지원됩니다. [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/systems-manager/latest/userguide/documents.html)  | 

**SSM 문서 할당량**  
SSM 문서 할당량에 대한 내용은 **Amazon Web Services 일반 참조의 [Systems Manager 서비스 할당량](https://docs.aws.amazon.com/general/latest/gr/ssm.html#limits_ssm)을 참조하세요.

**Topics**
+ [Documents 도구가 조직에 주는 이점은 무엇인가요?](#ssm-docs-benefits)
+ [누가 Documents를 사용해야 하나요?](#documents-who)
+ [SSM 문서의 유형은 무엇인가요?](#what-are-document-types)
+ [문서 구성 요소](documents-components.md)
+ [SSM 문서 콘텐츠 생성](documents-creating-content.md)
+ [문서 작업](documents-using.md)
+ [파라미터 처리 문제 해결](parameter-troubleshooting.md)

# 문서 구성 요소
<a name="documents-components"></a>

이 섹션에는 SSM 문서를 구성하는 구성 요소에 대한 정보가 포함되어 있습니다.

**Topics**
+ [스키마, 특성 및 예제](documents-schemas-features.md)
+ [데이터 요소 및 파마미터](documents-syntax-data-elements-parameters.md)
+ [Command 문서 플러그인 참조](documents-command-ssm-plugin-reference.md)

# 스키마, 특성 및 예제
<a name="documents-schemas-features"></a>

AWS Systems Manager 문서는 다음 스키마 버전을 사용합니다.
+ `Command` 유형의 문서는 스키마 버전 1.2, 2.0 및 2.2을 사용해야 합니다. 1.2 문서를 사용하는 경우 스키마 버전 2.2를 사용하는 문서 생성을 권장합니다.
+ `Policy` 유형의 문서는 스키마 버전 2.0 이상을 사용해야 합니다.
+ `Automation` 유형의 문서는 스키마 버전 0.3을 사용해야 합니다.
+ `Session` 유형의 문서는 스키마 버전 1.0을 사용해야 합니다.
+ JSON 또는 YAML에서 문서를 만들 수 있습니다.

`Session` 문서 스키마에 대한 자세한 정보는 [Session 문서 스키마](session-manager-schema.md) 문서를 참조하세요.

`Command` 및 `Policy` 문서에 최신 스키마 버전을 사용하여 다음 기능을 활용할 수 있습니다.


**스키마 버전 2.2 문서 기능**  

| 기능 | 세부 정보 | 
| --- | --- | 
|  문서 편집  |  이제 문서를 업데이트할 수 있습니다. 버전 1.2에서는 문서를 업데이트하려면 다른 이름으로 저장해야 했습니다.  | 
|  자동 버전 관리  |  문서로 업데이트하면 새로운 버전이 만들어집니다. 이것은 스키마가 아닌 문서 버전입니다.  | 
|  기본 버전  |  문서 버전이 다수인 경우에는 기본 문서로 사용할 버전을 지정할 수 있습니다.  | 
|  시퀀싱  |  문서의 플러그인 또는 *단계*는 지정된 순서로 실행됩니다.  | 
|  교차 플랫폼 지원  |  크로스 플랫폼 지원으로 동일한 SSM 문서 내에서 플러그인마다 다른 운영 체제를 지정할 수 있습니다. 교차 플랫폼 지원 기능은 단계 내에서 `precondition` 파라미터를 사용합니다.  | 
| 파라미터 보간 | 보간은 변수 값을 문자열에 삽입하거나 대체하는 것을 의미합니다. 문자열을 사용하기 전에 실제 값으로 공백을 채우는 것으로 생각하세요. SSM 문서에서 파라미터 보건을 사용하면 명령 실행 전에 문자열 파라미터를 환경 변수에 보간하여 명령 주입에 대한 보안을 강화할 수 있습니다. `ENV_VAR`로 설정하면 에이전트는 파라미터 값이 포함된 `SSM_parameter-name`이라는 이름으로 환경 변수를 생성합니다. | 

**참고**  
새로운 Systems Manager 기능과 SSM 문서 기능을 사용하려면 인스턴스의 AWS Systems Manager SSM Agent를 최신 버전으로 업데이트하여 최신 상태를 유지해야 합니다. 자세한 내용은 [Run Command를 사용하여 SSM Agent 업데이트](run-command-tutorial-update-software.md#rc-console-agentexample) 섹션을 참조하세요.

다음 표에는 주요 스키마 버전의 차이점이 나열되어 있습니다.


****  

| 버전 1.2 | 버전 2.2(최신 버전) | 세부 정보 | 
| --- | --- | --- | 
|  runtimeConfig  |  mainSteps  |  버전 2.2에서는 `mainSteps` 섹션이 `runtimeConfig` 섹션으로 대체되었습니다. `mainSteps` 섹션을 사용하면 Systems Manager가 단계를 순서대로 실행할 수 있습니다.  | 
|  properties  |  입력  |  버전 2.2에서는 `properties` 섹션이 `inputs` 섹션으로 대체되었습니다. `inputs` 섹션은 각 단계의 파라미터를 허용합니다.  | 
|    명령  |  runCommand  |  버전 2.2에서는 `inputs` 섹션이 `commands` 파라미터 대신 `runCommand` 파라미터를 사용합니다.  | 
|  id  |  작업  |  버전 2.2에서는 `ID`가 `Action`으로 대체되었습니다. 여기에서는 이름만 변경되었을 뿐입니다.  | 
|  해당 사항 없음  |  이름  |  버전 2.2 에서 `name`은 단계를 나타내는 사용자 정의 이름입니다.  | 

**Precondition 파라미터 사용**  
스키마 버전 2.2 이상에서는 `precondition` 파라미터를 사용하여 플러그인마다 대상 운영 체제를 지정하거나 SSM 문서에 정의한 입력 파라미터를 검증할 수 있습니다. `precondition` 파라미터는 SSM 문서의 입력 파라미터 참조 및 `platformType`의 `Linux`, `MacOS`, `Windows` 값 사용을 지원합니다. `StringEquals` 연산자만 지원됩니다.

스키마 버전 2.2 이상을 사용하는 문서에서 `precondition` 파라미터를 지정하지 않으면 플러그인과 운영 체제의 호환성에 따라 각 플러그인이 실행되거나 생략됩니다. 운영 체제와의 플러그인 호환성은 `precondition`보다 먼저 평가됩니다. 반대로 스키마 버전 2.0 이하를 사용하는 문서에서는 비호환 플러그인을 실행하려고 하면 오류가 발생합니다.

예를 들어 스키마 버전 2.2 문서에서 `precondition`이 지정되지 않고 `aws:runShellScript` 플러그인이 나열되면 Linux 인스턴스에서는 단계가 실행되지만, `aws:runShellScript`가 Windows Server 인스턴스와 호환되지 않기 때문에 Windows Server 인스턴스에서는 이 단계를 건너뜁니다. 하지만 스키마 버전 2.0 문서에서는 `aws:runShellScript` 플러그인을 지정하더라도 Windows Server 인스턴스에서 문서를 실행하면 실행이 실패합니다. 이 섹션 후반부의 SSM 문서에 있는 precondition 파라미터의 예를 참조하세요.

## 스키마 버전 2.2
<a name="documents-schema-twox"></a>

**최상위 수준 요소**  
다음은 스키마 버전 2.2를 사용하여 SSM 문서의 최상위 요소를 나타낸 예제입니다.

------
#### [ YAML ]

```
---
schemaVersion: "2.2"
description: A description of the document.
parameters:
  parameter 1:
    property 1: "value"
    property 2: "value"
  parameter 2:
    property 1: "value"
    property 2: "value"
mainSteps:
  - action: Plugin name
    name: A name for the step.
    inputs:
      input 1: "value"
      input 2: "value"
      input 3: "{{ parameter 1 }}"
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "A description of the document.",
   "parameters": {
       "parameter 1": {
           "property 1": "value",
           "property 2": "value"
        },
        "parameter 2":{
           "property 1": "value",
           "property 2": "value"
        } 
    },
   "mainSteps": [
      {
         "action": "Plugin name",
         "name": "A name for the step.",
         "inputs": {
            "input 1": "value",
            "input 2": "value",
            "input 3": "{{ parameter 1 }}"
         }
      }
   ]
}
```

------

**스키마 버전 2.2 예제**  
다음 예제에서는 `aws:runPowerShellScript` 플러그인을 사용하여 대상 인스턴스에서 PowerShell 명령을 실행합니다.

------
#### [ YAML ]

```
---
schemaVersion: "2.2"
description: "Example document"
parameters:
  Message:
    type: "String"
    description: "Example parameter"
    default: "Hello World"
    allowedValues: 
    - "Hello World"
mainSteps:
  - action: "aws:runPowerShellScript"
    name: "example"
    inputs:
      timeoutSeconds: '60'
      runCommand:
      - "Write-Output {{Message}}"
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "Example document",
   "parameters": {
      "Message": {
         "type": "String",
         "description": "Example parameter",
         "default": "Hello World",
         "allowedValues": ["Hello World"]
      }
   },
   "mainSteps": [
      {
         "action": "aws:runPowerShellScript",
         "name": "example",
         "inputs": {
            "timeoutSeconds": "60",
            "runCommand": [
               "Write-Output {{Message}}"
            ]
         }
      }
   ]
}
```

------

**스키마 버전 2.2 precondition 파라미터 예제**  
스키마 버전 2.2는 교차 플랫폼 지원 기능을 제공합니다. 이 말은 단일 SSM 문서 내에서 플러그인마다 다른 운영 체제를 지정할 수 있다는 것을 의미합니다. 교차 플랫폼 지원 기능은 다음 예제와 같이 단계 내에서 `precondition` 파라미터를 사용합니다. `precondition` 파라미터를 사용하여 SSM 문서에 정의한 입력 파라미터를 검증할 수도 있습니다. 다음 예 중 두 번째 예에서 이를 확인할 수 있습니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: cross-platform sample
mainSteps:
- action: aws:runPowerShellScript
  name: PatchWindows
  precondition:
    StringEquals:
    - platformType
    - Windows
  inputs:
    runCommand:
    - cmds
- action: aws:runShellScript
  name: PatchLinux
  precondition:
    StringEquals:
    - platformType
    - Linux
  inputs:
    runCommand:
    - cmds
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "cross-platform sample",
   "mainSteps": [
      {
         "action": "aws:runPowerShellScript",
         "name": "PatchWindows",
         "precondition": {
            "StringEquals": [
               "platformType",
               "Windows"
            ]
         },
         "inputs": {
            "runCommand": [
               "cmds"
            ]
         }
      },
      {
         "action": "aws:runShellScript",
         "name": "PatchLinux",
         "precondition": {
            "StringEquals": [
               "platformType",
               "Linux"
            ]
         },
         "inputs": {
            "runCommand": [
               "cmds"
            ]
         }
      }
   ]
}
```

------

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
parameters:
  action:
    type: String
    allowedValues:
    - Install
    - Uninstall
  confirmed:
    type: String
    allowedValues:
    - True
    - False
mainSteps:
- action: aws:runShellScript
  name: InstallAwsCLI
  precondition:
    StringEquals:
    - "{{ action }}"
    - "Install"
  inputs:
    runCommand:
    - sudo apt install aws-cli
- action: aws:runShellScript
  name: UninstallAwsCLI
  precondition:
    StringEquals:
    - "{{ action }} {{ confirmed }}"
    - "Uninstall True"
  inputs:
    runCommand:
    - sudo apt remove aws-cli
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "parameters": {
      "action": {
         "type": "String",
         "allowedValues": [
            "Install",
            "Uninstall"
         ]
      },
      "confirmed": {
         "type": "String",
         "allowedValues": [
            true,
            false
         ]
      }
   },
   "mainSteps": [
      {
         "action": "aws:runShellScript",
         "name": "InstallAwsCLI",
         "precondition": {
            "StringEquals": [
               "{{ action }}",
               "Install"
            ]
         },
         "inputs": {
            "runCommand": [
               "sudo apt install aws-cli"
            ]
         }
      },
      {
         "action": "aws:runShellScript",
         "name": "UninstallAwsCLI",
         "precondition": {
            "StringEquals": [
               "{{ action }} {{ confirmed }}",
               "Uninstall True"
            ]
         },
         "inputs": {
            "runCommand": [
               "sudo apt remove aws-cli"
            ]
         }
      }
   ]
}
```

------

**3.3.2746.0 이전 SSM Agent 버전을 사용한 스키마 버전 2.2 보간 예제**  
3.3.2746.0 이전 SSM Agent 버전에서는 에이전트가 `interpolationType` 파라미터를 무시하고 대신 원시 문자열 대체를 수행합니다. `SSM_parameter-name`을(를) 명시적으로 참조하는 경우 이를 명시적으로 설정해야 합니다. 다음 Linux 예제에서는 `SSM_Message` 환경 변수가 명시적으로 참조됩니다.

```
{
    "schemaVersion": "2.2",
    "description": "An example document",
    "parameters": {
        "Message": {
            "type": "String",
            "description": "Message to be printed",
            "default": "Hello",
            "interpolationType" : "ENV_VAR",
	     "allowedPattern: "^[^"]*$"

        }
    },
    "mainSteps": [{
        "action": "aws:runShellScript",
        "name": "printMessage",
        "inputs": {
            "runCommand": [
              "if [ -z "${SSM_Message+x}" ]; then",
              "    export SSM_Message=\"{{Message}}\"",
              "fi",
              "",
              "echo $SSM_Message"
            ]
        }
    }
}
```

**참고**  
SSM 문서에서 이중 중괄호(`{{ }}`)를 사용하지 않는 경우 기술적으로 `allowedPattern`이 필요하지 않습니다.

**스키마 버전 2.2 State Manager 예제**  
Systems Manager의 도구인 State Manager에서 다음 SSM 문서를 사용하여 ClamAV 안티바이러스 소프트웨어를 설치할 수 있습니다. State Manager에서는 특정 구성만 사용 가능합니다. 즉, State Manager 연결이 실행될 때마다 시스템이 ClamAV 소프트웨어가 설치되어 있는지 확인합니다. 설치되어 있지 않은 경우 State Manager은 이 문서를 다시 실행합니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: State Manager Bootstrap Example
parameters: {}
mainSteps:
- action: aws:runShellScript
  name: configureServer
  inputs:
    runCommand:
    - sudo yum install -y httpd24
    - sudo yum --enablerepo=epel install -y clamav
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "State Manager Bootstrap Example",
   "parameters": {},
   "mainSteps": [
      {
         "action": "aws:runShellScript",
         "name": "configureServer",
         "inputs": {
            "runCommand": [
               "sudo yum install -y httpd24",
               "sudo yum --enablerepo=epel install -y clamav"
            ]
         }
      }
   ]
}
```

------

**스키마 버전 2.2 인벤토리 예제**  
State Manager에서 다음과 같은 SSM 문서를 사용하여 해당 인스턴스에 대한 인벤토리 메타데이터를 수집할 수 있습니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: Software Inventory Policy Document.
parameters:
  applications:
    type: String
    default: Enabled
    description: "(Optional) Collect data for installed applications."
    allowedValues:
    - Enabled
    - Disabled
  awsComponents:
    type: String
    default: Enabled
    description: "(Optional) Collect data for AWS Components like amazon-ssm-agent."
    allowedValues:
    - Enabled
    - Disabled
  networkConfig:
    type: String
    default: Enabled
    description: "(Optional) Collect data for Network configurations."
    allowedValues:
    - Enabled
    - Disabled
  windowsUpdates:
    type: String
    default: Enabled
    description: "(Optional) Collect data for all Windows Updates."
    allowedValues:
    - Enabled
    - Disabled
  instanceDetailedInformation:
    type: String
    default: Enabled
    description: "(Optional) Collect additional information about the instance, including
      the CPU model, speed, and the number of cores, to name a few."
    allowedValues:
    - Enabled
    - Disabled
  customInventory:
    type: String
    default: Enabled
    description: "(Optional) Collect data for custom inventory."
    allowedValues:
    - Enabled
    - Disabled
mainSteps:
- action: aws:softwareInventory
  name: collectSoftwareInventoryItems
  inputs:
    applications: "{{ applications }}"
    awsComponents: "{{ awsComponents }}"
    networkConfig: "{{ networkConfig }}"
    windowsUpdates: "{{ windowsUpdates }}"
    instanceDetailedInformation: "{{ instanceDetailedInformation }}"
    customInventory: "{{ customInventory }}"
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "Software Inventory Policy Document.",
   "parameters": {
      "applications": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect data for installed applications.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      },
      "awsComponents": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect data for AWS Components like amazon-ssm-agent.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      },
      "networkConfig": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect data for Network configurations.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      },
      "windowsUpdates": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect data for all Windows Updates.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      },
      "instanceDetailedInformation": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect additional information about the instance, including\nthe CPU model, speed, and the number of cores, to name a few.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      },
      "customInventory": {
         "type": "String",
         "default": "Enabled",
         "description": "(Optional) Collect data for custom inventory.",
         "allowedValues": [
            "Enabled",
            "Disabled"
         ]
      }
   },
   "mainSteps": [
      {
         "action": "aws:softwareInventory",
         "name": "collectSoftwareInventoryItems",
         "inputs": {
            "applications": "{{ applications }}",
            "awsComponents": "{{ awsComponents }}",
            "networkConfig": "{{ networkConfig }}",
            "windowsUpdates": "{{ windowsUpdates }}",
            "instanceDetailedInformation": "{{ instanceDetailedInformation }}",
            "customInventory": "{{ customInventory }}"
         }
      }
   ]
}
```

------

**스키마 버전 2.2 `AWS-ConfigureAWSPackage` 예제**  
다음은 `AWS-ConfigureAWSPackage` 문서를 나타낸 예제입니다. `mainSteps` 섹션에는 `action` 단계의 `aws:configurePackage` 플러그인이 포함되어 있습니다.

**참고**  
Linux 운영 체제에서는 `AmazonCloudWatchAgent` 및 `AWSSupport-EC2Rescue` 패키지만 지원됩니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: 'Install or uninstall the latest version or specified version of an AWS
  package. Available packages include the following: AWSPVDriver, AwsEnaNetworkDriver,
  AwsVssComponents, and AmazonCloudWatchAgent, and AWSSupport-EC2Rescue.'
parameters:
  action:
    description: "(Required) Specify whether or not to install or uninstall the package."
    type: String
    allowedValues:
    - Install
    - Uninstall
  name:
    description: "(Required) The package to install/uninstall."
    type: String
    allowedPattern: "^arn:[a-z0-9][-.a-z0-9]{0,62}:[a-z0-9][-.a-z0-9]{0,62}:([a-z0-9][-.a-z0-9]{0,62})?:([a-z0-9][-.a-z0-9]{0,62})?:package\\/[a-zA-Z][a-zA-Z0-9\\-_]{0,39}$|^[a-zA-Z][a-zA-Z0-9\\-_]{0,39}$"
  version:
    type: String
    description: "(Optional) A specific version of the package to install or uninstall."
mainSteps:
- action: aws:configurePackage
  name: configurePackage
  inputs:
    name: "{{ name }}"
    action: "{{ action }}"
    version: "{{ version }}"
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "Install or uninstall the latest version or specified version of an AWS package. Available packages include the following: AWSPVDriver, AwsEnaNetworkDriver, AwsVssComponents, and AmazonCloudWatchAgent, and AWSSupport-EC2Rescue.",
   "parameters": {
      "action": {
         "description":"(Required) Specify whether or not to install or uninstall the package.",
         "type":"String",
         "allowedValues":[
            "Install",
            "Uninstall"
         ]
      },
      "name": {
         "description": "(Required) The package to install/uninstall.",
         "type": "String",
         "allowedPattern": "^arn:[a-z0-9][-.a-z0-9]{0,62}:[a-z0-9][-.a-z0-9]{0,62}:([a-z0-9][-.a-z0-9]{0,62})?:([a-z0-9][-.a-z0-9]{0,62})?:package\\/[a-zA-Z][a-zA-Z0-9\\-_]{0,39}$|^[a-zA-Z][a-zA-Z0-9\\-_]{0,39}$"
      },
      "version": {
         "type": "String",
         "description": "(Optional) A specific version of the package to install or uninstall."
      }
   },
   "mainSteps":[
      {
         "action": "aws:configurePackage",
         "name": "configurePackage",
         "inputs": {
            "name": "{{ name }}",
            "action": "{{ action }}",
            "version": "{{ version }}"
         }
      }
   ]
}
```

------

## 스키마 버전 1.2
<a name="documents-schema-onex"></a>

다음은 스키마 버전 1.2 문서에서 최상위 요소를 나타낸 예제입니다.

```
{
   "schemaVersion":"1.2",
   "description":"A description of the SSM document.",
   "parameters":{
      "parameter 1":{
         "one or more parameter properties"
      },
      "parameter 2":{
         "one or more parameter properties"
      },
      "parameter 3":{
         "one or more parameter properties"
      }
   },
   "runtimeConfig":{
      "plugin 1":{
         "properties":[
            {
               "one or more plugin properties"
            }
         ]
      }
   }
}
```

**스키마 버전 1.2 `aws:runShellScript` 예제**  
다음 예에서는 `AWS-RunShellScript` SSM 문서를 보여줍니다. **runtimeConfig** 섹션에는 `aws:runShellScript` 플러그인이 포함되어 있습니다.

```
{
    "schemaVersion":"1.2",
    "description":"Run a shell script or specify the commands to run.",
    "parameters":{
        "commands":{
            "type":"StringList",
            "description":"(Required) Specify a shell script or a command to run.",
            "minItems":1,
            "displayType":"textarea"
        },
        "workingDirectory":{
            "type":"String",
            "default":"",
            "description":"(Optional) The path to the working directory on your instance.",
            "maxChars":4096
        },
        "executionTimeout":{
            "type":"String",
            "default":"3600",
            "description":"(Optional) The time in seconds for a command to complete before it is considered to have failed. Default is 3600 (1 hour). Maximum is 172800 (48 hours).",
            "allowedPattern":"([1-9][0-9]{0,3})|(1[0-9]{1,4})|(2[0-7][0-9]{1,3})|(28[0-7][0-9]{1,2})|(28800)"
        }
    },
    "runtimeConfig":{
        "aws:runShellScript":{
            "properties":[
                {
                    "id":"0.aws:runShellScript",
                    "runCommand":"{{ commands }}",
                    "workingDirectory":"{{ workingDirectory }}",
                    "timeoutSeconds":"{{ executionTimeout }}"
                }
            ]
        }
    }
}
```

## 스키마 버전 0.3
<a name="automation-doc-syntax-examples"></a>

**최상위 수준 요소**  
다음 예에서는 스키마 버전이 0.3인 JSON 형식 Automation 실행서의 최상위 요소를 보여줍니다.

```
{
    "description": "document-description",
    "schemaVersion": "0.3",
    "assumeRole": "{{assumeRole}}",
    "parameters": {
        "parameter1": {
            "type": "String",
            "description": "parameter-1-description",
            "default": ""
        },
        "parameter2": {
            "type": "String",
            "description": "parameter-2-description",
            "default": ""
        }
    },
    "variables": {
        "variable1": {
            "type": "StringMap",
            "description": "variable-1-description",
            "default": {}
        },
        "variable2": {
            "type": "String",
            "description": "variable-2-description",
            "default": "default-value"
        }
    },
    "mainSteps": [
        {
            "name": "myStepName",
            "action": "action-name",
            "maxAttempts": 1,
            "inputs": {
                "Handler": "python-only-handler-name",
                "Runtime": "runtime-name",
                "Attachment": "script-or-zip-name"
            },
            "outputs": {
                "Name": "output-name",
                "Selector": "selector.value",
                "Type": "data-type"
            }
        }
    ],
    "files": {
        "script-or-zip-name": {
            "checksums": {
                "sha256": "checksum"
            },
            "size": 1234
        }
    }
}
```

**YAML Automation 실행서 예**  
다음 샘플은 Automation 실행서의 내용을 YAML 형식으로 보여줍니다. 문서 스키마 버전 0.3에 대한 이 작업 예제는 Markdown을 사용하여 문서 설명의 서식을 지정하는 방법을 보여줍니다.

```
description: >-
  ##Title: LaunchInstanceAndCheckState

  -----

  **Purpose**: This Automation runbook first launches an EC2 instance
  using the AMI ID provided in the parameter ```imageId```. The second step of
  this document continuously checks the instance status check value for the
  launched instance until the status ```ok``` is returned.


  ##Parameters:

  -----

  Name | Type | Description | Default Value

  ------------- | ------------- | ------------- | -------------

  assumeRole | String | (Optional) The ARN of the role that allows Automation to
  perform the actions on your behalf. | -

  imageId  | String | (Optional) The AMI ID to use for launching the instance.
  The default value uses the latest Amazon Linux AMI ID available. | {{
  ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64 }}
schemaVersion: '0.3'
assumeRole: 'arn:aws:iam::111122223333::role/AutomationServiceRole'
parameters:
  imageId:
    type: String
    default: '{{ ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64 }}'
    description: >-
      (Optional) The AMI ID to use for launching the instance. The default value
      uses the latest released Amazon Linux AMI ID.
  tagValue:
    type: String
    default: ' LaunchedBySsmAutomation'
    description: >-
      (Optional) The tag value to add to the instance. The default value is
      LaunchedBySsmAutomation.
  instanceType:
    type: String
    default: t2.micro
    description: >-
      (Optional) The instance type to use for the instance. The default value is
      t2.micro.
mainSteps:
  - name: LaunchEc2Instance
    action: 'aws:executeScript'
    outputs:
      - Name: payload
        Selector: $.Payload
        Type: StringMap
    inputs:
      Runtime: python3.11
      Handler: launch_instance
      Script: ''
      InputPayload:
        image_id: '{{ imageId }}'
        tag_value: '{{ tagValue }}'
        instance_type: '{{ instanceType }}'
      Attachment: launch.py
    description: >-
      **About This Step**


      This step first launches an EC2 instance using the ```aws:executeScript```
      action and the provided python script.
  - name: WaitForInstanceStatusOk
    action: 'aws:executeScript'
    inputs:
      Runtime: python3.11
      Handler: poll_instance
      Script: |-
        def poll_instance(events, context):
          import boto3
          import time

          ec2 = boto3.client('ec2')

          instance_id = events['InstanceId']

          print('[INFO] Waiting for instance status check to report ok', instance_id)

          instance_status = "null"

          while True:
            res = ec2.describe_instance_status(InstanceIds=[instance_id])

            if len(res['InstanceStatuses']) == 0:
              print("Instance status information is not available yet")
              time.sleep(5)
              continue

            instance_status = res['InstanceStatuses'][0]['InstanceStatus']['Status']

            print('[INFO] Polling to get status of the instance', instance_status)

            if instance_status == 'ok':
              break

            time.sleep(10)

          return {'Status': instance_status, 'InstanceId': instance_id}
      InputPayload: '{{ LaunchEc2Instance.payload }}'
    description: >-
      **About This Step**


      The python script continuously polls the instance status check value for
      the instance launched in Step 1 until the ```ok``` status is returned.
files:
  launch.py:
    checksums:
      sha256: 18871b1311b295c43d0f...[truncated]...772da97b67e99d84d342ef4aEXAMPLE
```

## 보안 파라미터 처리 예제
<a name="secure-parameter-examples"></a>

다음 예제에서는 환경 변수 `interpolationType`을 사용한 보안 파라미터 처리를 보여줍니다.

### 기본 보안 명령 실행
<a name="basic-secure-command"></a>

이 예제는 명령 파라미터를 안전하게 처리하는 방법을 보여줍니다.

**참고**  
이중 중괄호(`{{ }}`)를 사용하지 않는 SSM 문서에서는 기술적으로 `allowedPattern`이 필요하지 않습니다.

------
#### [ YAML ]

```
---

schemaVersion: '2.2'
description: An example document.
parameters:
  Message:
    type: String
    description: "Message to be printed"
    default: Hello
    interpolationType: ENV_VAR
    allowedPattern: "^[^"]*$"
mainSteps:
  - action: aws:runShellScript
    name: printMessage
    precondition:
      StringEquals:
        - platformType
        - Linux
    inputs:
      runCommand:
        - echo {{Message}}
```

------
#### [ JSON ]

```
{
    "schemaVersion": "2.2",
    "description": "An example document.",
    "parameters": {
        "Message": {
            "type": "String",
            "description": "Message to be printed",
            "default": "Hello",
            "interpolationType": "ENV_VAR",
            "allowedPattern": "^[^"]*$"
        }
    },
    "mainSteps": [{
        "action": "aws:runShellScript",
        "name": "printMessage",
        "precondition": {
           "StringEquals": ["platformType", "Linux"]
        },
        "inputs": {
            "runCommand": [
              "echo {{Message}}"
            ]
        }
    }]
}
```

------

### 해석된 언어에서 파라미터 사용
<a name="interpreted-language-example"></a>

이 예제는 Python의 보안 파라미터 처리를 보여줍니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: 'Secure Python script execution'
parameters:
  inputData:
    type: String
    description: 'Input data for processing'
    interpolationType: 'ENV_VAR'
mainSteps:
  - action: aws:runPowerShellScript
    name: runPython
    inputs:
      runCommand:
        - |
          python3 -c '
          import os
          import json
          
          # Safely access parameter through environment variable
          input_data = os.environ.get("SSM_inputData", "")
          
          # Process the data
          try:
              processed_data = json.loads(input_data)
              print(f"Successfully processed: {processed_data}")
          except json.JSONDecodeError:
              print("Invalid JSON input")
          '
```

------

### 하위 버전 호환성 예제
<a name="backwards-compatibility-example"></a>

이 예제는 하위 버전 호환성을 유지하면서 파라미터를 안전하게 처리하는 방법을 보여줍니다.

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: 'Backwards compatible secure parameter handling'
parameters:
  userInput:
    type: String
    description: 'User input to process'
    interpolationType: 'ENV_VAR'
    allowedPattern: '^[^"]*$'

mainSteps:
  - action: aws:runShellScript
    name: processInput
    inputs:
      runCommand:
        - |
          # Handle both modern and legacy agent versions
          if [ -z "${SSM_userInput+x}" ]; then
              # Legacy agent - fall back to direct parameter reference
              export SSM_userInput="{{userInput}}"
          fi
          
          # Process the input securely
          echo "Processing input: $SSM_userInput"
```

------

**참고**  
이중 중괄호(`{{ }}`)를 사용하지 않는 SSM 문서에서는 기술적으로 `allowedPattern`이 필요하지 않습니다.

## 파라미터 보안 모범 사례
<a name="parameter-security-best-practices"></a>

SSM 문서에서 파라미터를 처리할 때 다음 모범 사례를 따르세요.
+ **환경 변수 보간 사용** - 명령 실행에 사용할 문자열 파라미터에 항상 `interpolationType: "ENV_VAR"`을 사용합니다.
+ **입력 검증 구현** - `allowedPattern`을 사용하여 파라미터 값을 안전한 패턴으로 제한합니다.
+ **레거시 시스템 처리** - 환경 변수 보간을 지원하지 않는 이전 SSM Agent 버전에 대한 대체 로직을 포함합니다.
+ **특수 문자 이스케이프** - 명령에서 파라미터 값을 사용하는 경우 특수 문자를 적절히 이스케이프하여 쉘의 해석을 방지합니다.
+ **파라미터 범위 제한** - 사용 사례에서 가능한 가장 제한적인 파라미터 패턴을 사용합니다.

# 데이터 요소 및 파마미터
<a name="documents-syntax-data-elements-parameters"></a>

이 주제에서는 SSM 문서에 사용되는 데이터 요소를 설명합니다. 문서를 생성하는 데 사용되는 스키마 버전은 문서에서 허용하는 구문과 데이터 요소를 정의합니다. Command 문서에는 스키마 버전 2.2 이상을 사용하는 것이 좋습니다. Automation 런북은 스키마 버전 0.3을 사용합니다. 또한 Automation 런북에서는 Markdown을 사용할 수 있습니다. 마크업 언어인 Markdown을 사용하면 문서와 문서 내의 개별 단계에 wiki 스타일의 설명을 추가할 수 있습니다. 마크다운 사용에 대한 자세한 내용은 AWS Management Console 시작 안내서의 [콘솔에서 마크다운 사용](https://docs.aws.amazon.com/general/latest/gr/aws-markdown.html)을 참조하세요.

다음 섹션에서는 SSM 문서에 포함할 수 있는 데이터 요소에 대해 설명합니다.

## 최상위 데이터 요소
<a name="top-level"></a>

**schemaVersion**  
사용할 스키마 버전입니다.  
형식: 버전  
필수 여부: 예

**description**  
문서 목적을 설명하는 정보입니다. 또한 이 필드를 사용하여 파라미터에 문서 실행 값이 필요한지 또는 파라미터 값을 제공하는 것이 선택 사항인지 여부를 지정할 수 있습니다. 필수 파라미터와 선택적 파라미터는 이 주제의 예에서 볼 수 있습니다.  
유형: 문자열  
필수 여부: 아니요

**parameters**  
문서가 허용하는 파라미터를 정의하는 구조입니다.  
문자열 파라미터를 처리할 때 보안을 강화하기 위해 `interpolationType` 속성을 지정하여 환경 변수 보간을 사용할 수 있습니다. `ENV_VAR`로 설정하면 파라미터 값이 포함된 `SSM_parameter-name`이라는 이름으로 환경 변수가 생성됩니다.  
다음은 환경 변수 `interpolationType`을 사용하는 파라미터의 예입니다.  

```
{
    "schemaVersion": "2.2",
    "description": "An example document.",
    "parameters": {
        "Message": {
            "type": "String",
            "description": "Message to be printed",
            "default": "Hello",
            "interpolationType" : "ENV_VAR",
            "allowedPattern": "^[^"]*$"

        }
    },
    "mainSteps": [{
        "action": "aws:runShellScript",
        "name": "printMessage",
        "precondition" : {
           "StringEquals" : ["platformType", "Linux"]
        },
        "inputs": {
            "runCommand": [
              "echo {{Message}}"
            ]
        }
    }
}
```
이중 중괄호(`{{ }}`)를 사용하지 않는 SSM 문서에서는 기술적으로 `allowedPattern`이 필요하지 않습니다.
자주 사용하는 파라미터의 경우 AWS Systems Manager의 도구인 Parameter Store에 해당 파라미터를 저장하는 것이 좋습니다. 그런 다음 Parameter Store 파라미터를 기본값으로 참조하는 파라미터를 문서에서 정의할 수 있습니다. Parameter Store 파라미터를 참조하려면 다음 구문을 사용합니다.  

```
{{ssm:parameter-name}}
```
다른 문서 파라미터와 동일한 방식으로 Parameter Store 파라미터를 참조하는 파라미터를 사용할 수 있습니다. 다음 예제에서 `commands` 파라미터의 기본값은 Parameter Store 파라미터 `myShellCommands`입니다. `commands` 파라미터를 `runCommand` 문자열로 지정하면 문서에서 `myShellCommands` 파라미터에 저장된 명령을 실행합니다.  

```
---
schemaVersion: '2.2'
description: runShellScript with command strings stored as Parameter Store parameter
parameters:
  commands:
    type: StringList
    description: "(Required) The commands to run on the instance."
    default: ["{{ ssm:myShellCommands }}"],
            interpolationType : 'ENV_VAR'
            allowedPattern: '^[^"]*$'

mainSteps:
- action: aws:runShellScript
  name: runShellScriptDefaultParams
  inputs:
    runCommand:"{{ commands }}"
```

```
{
    "schemaVersion": "2.2",
    "description": "runShellScript with command strings stored as Parameter Store parameter",
    "parameters": {
      "commands": {
        "type": "StringList",
        "description": "(Required) The commands to run on the instance.",
        "default": ["{{ ssm:myShellCommands }}"],
        "interpolationType" : "ENV_VAR"
      }
    },
    "mainSteps": [
      {
        "action": "aws:runShellScript",
        "name": "runShellScriptDefaultParams",
        "inputs": {
            "runCommand": [
              "{{ commands }}"
          ]
        }
      }
    ]
  }
```
문서의 `parameters` 섹션에서 `String` 및 `StringList` Parameter Store 파라미터를 참조할 수 있습니다. `SecureString` Parameter Store 파라미터를 참조할 수 없습니다.
Parameter Store에 대한 자세한 내용은 [AWS Systems Manager Parameter Store](systems-manager-parameter-store.md) 섹션을 참조하세요.  
형식: 구조  
`parameters` 구조는 다음의 필드 및 값을 수락합니다.  
+ `type`: (필수) 허용되는 값은 다음과 같습니다. `String`, `StringList`, `Integer` `Boolean`, `MapList`, `StringMap`. 각 유형의 예를 보려면 다음 단원의 [SSM 문서 파라미터 `type` 예제](#top-level-properties-type)를 참조하십시오.
**참고**  
Command 유형 문서에서는 `String` 및 `StringList` 파라미터 유형만 지원합니다.
+ `description`: (선택 사항) 파라미터에 대한 설명입니다.
+ `default`: (선택 사항) 파라미터의 기본값 또는 Parameter Store 내 파라미터에 대한 참조입니다.
+ `allowedValues`: (선택 사항) 파라미터에 허용되는 값의 배열입니다. 파라미터에 허용된 값을 정의하면 사용자 입력이 검증됩니다. 사용자가 허용되지 않는 값을 입력하면 실행이 시작되지 않습니다.

------
#### [ YAML ]

  ```
  DirectoryType:
    type: String
    description: "(Required) The directory type to launch."
    default: AwsMad
    allowedValues:
    - AdConnector
    - AwsMad
    - SimpleAd
  ```

------
#### [ JSON ]

  ```
  "DirectoryType": {
    "type": "String",
    "description": "(Required) The directory type to launch.",
    "default": "AwsMad",
    "allowedValues": [
      "AdConnector",
      "AwsMad",
      "SimpleAd"
    ]
  }
  ```

------
+ `allowedPattern`: (선택 사항) 사용자 입력이 파라미터에 대해 정의된 패턴과 일치하는지 여부를 확인하는 정규 표현식입니다. 사용자 입력이 허용된 패턴과 일치하지 않으면 실행이 시작되지 않습니다.
**참고**  
Systems Manager는 `allowedPattern`에 대한 두 가지 검증을 수행합니다. 첫 번째 유효성 검사는 문서를 사용할 때 API 레벨에서 [Java regex 라이브러리](https://docs.oracle.com/javase/8/docs/api/java/util/regex/package-summary.html)를 사용하여 수행됩니다. 두 번째 유효성 검사는 문서를 처리하기 전에 [GO regexp 라이브러리](https://pkg.go.dev/regexp)를 사용하여 SSM Agent에서 수행됩니다.

------
#### [ YAML ]

  ```
  InstanceId:
    type: String
    description: "(Required) The instance ID to target."
    allowedPattern: "^i-(?:[a-f0-9]{8}|[a-f0-9]{17})$"
    default: ''
  ```

------
#### [ JSON ]

  ```
  "InstanceId": {
    "type": "String",
    "description": "(Required) The instance ID to target.",
    "allowedPattern": "^i-(?:[a-f0-9]{8}|[a-f0-9]{17})$",
    "default": ""
  }
  ```

------
+ `displayType`: (선택 사항) AWS Management Console에서 `textfield` 또는 `textarea`를 표시하는 데 사용됩니다. `textfield`는 한 줄 텍스트 상자이고, `textarea`는 여러 줄 텍스트 상자입니다.
+ `minItems`: (선택 사항) 허용되는 최소 항목 수입니다.
+ `maxItems`: (선택 사항) 허용되는 최대 항목 수입니다.
+ `minChars`: (선택 사항) 허용되는 파라미터 문자 최소 개수입니다.
+ `maxChars`: (선택 사항) 허용되는 파라미터 문자 최대 개수입니다.
+ `interpolationType`: (선택 사항) 명령 실행 전에 파라미터 값을 처리하는 방법을 정의합니다. `ENV_VAR`로 설정하면 파라미터 값을 `SSM_parameter-name`이라는 환경 변수로 사용할 수 있습니다. 이 기능은 파라미터 값을 리터럴 문자열로 처리하여 명령 주입을 방지하는 데 도움이 됩니다.

  타입: 문자열

  유효한 값: `ENV_VAR`
필수 여부: 아니요

**variables**  
(스키마 버전 0.3만 해당) Automation 런북의 전체 단계에서 참조하거나 업데이트할 수 있는 값입니다. 변수는 파라미터와 비슷하지만 매우 중요한 점에서 다릅니다. 런북의 컨텍스트에서는 파라미터 값이 고정되어 있지만 런북의 컨텍스트에서 변수 값을 변경할 수 있습니다. 변수 값을 업데이트할 때 데이터 유형은 정의된 데이터 유형과 일치해야 합니다. 자동화에서 변수 값을 업데이트하는 방법에 대한 자세한 내용은 [`aws:updateVariable` - 런북 변수 값을 업데이트](automation-action-update-variable.md) 섹션을 참조하세요.  
형식: Boolean \$1 Integer \$1 MapList \$1 String \$1 StringList \$1 StringMap  
필수 여부: 아니요  

```
variables:
    payload:
        type: StringMap
        default: "{}"
```

```
{
    "variables": [
        "payload": {
            "type": "StringMap",
            "default": "{}"
        }
    ]
}
```

**runtimeConfig**  
(스키마 버전 1.2만 해당) 하나 이상의 Systems Manager 플러그인에 의해 적용되는 인스턴스 구성입니다. 플러그인은 순서대로 실행되지 않습니다.  
형식: Dictionary<string,PluginConfiguration>  
필수 여부: 아니요

**mainSteps**  
(스키마 버전 0.3, 2.0 및 2.2만 해당) 여러 단계(플러그인)를 포함할 수 있는 객체입니다. 플러그인은 단계 내에서 정의됩니다. 단계는 이 문서에 나열된 순서대로 실행됩니다.  
형식: Dictionary<string,PluginConfiguration>  
필수 여부: 예

**출력**  
(스키마 버전 0.3에만 해당) 이 문서를 실행하여 생성되었고 다른 프로세스에서 사용할 수 있는 데이터입니다. 예를 들어 문서에서 새 AMI를 생성하는 경우 출력 값으로 "CreateImage.ImageId"를 지정한 다음, 이 출력을 사용하여 후속 자동화 실행에서 새 인스턴스를 생성할 수 있습니다. 출력에 대한 자세한 내용은 [작업 출력을 입력으로 사용](automation-action-outputs-inputs.md) 섹션을 참조하세요.  
형식: Dictionary<string,OutputConfiguration>  
필수 여부: 아니요

**files**  
(스키마 버전 0.3에만 해당) 문서에 첨부되어 자동화 실행 중에 실행되는 스크립트 파일(및 해당 체크섬)입니다. `aws:executeScript` 작업을 포함하고 하나 이상의 단계에서 첨부 파일이 지정된 문서에만 적용됩니다.  
Automation 런북에서 지원하는 런타임에 대한 자세한 내용은 [`aws:executeScript` - 스크립트 실행](automation-action-executeScript.md) 섹션을 참조하세요. Automation 런북에 스크립트 포함에 대한 자세한 내용은 [런북에서 스크립트 사용](automation-document-script-considerations.md) 및 [Automation 런북의 시각적 디자인 경험](automation-visual-designer.md) 섹션을 참조하세요.  
첨부 파일이 포함된 Automation 실행서를 생성할 때 옵션 `--attachments`(AWS CLI용) 또는 `Attachments`(API 및 SDK용)를 사용하여 첨부 파일을 지정해야 합니다. SSM 문서와 Amazon Simple Storage Service(Amazon S3) 버킷에 저장된 파일에 대해 파일 위치를 지정할 수 있습니다. 자세한 내용은 AWS Systems Manager API 참조의 [첨부 파일](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateDocument.html#systemsmanager-CreateDocument-request-Attachments)을 참조하세요.  

```
---
files:
  launch.py:
    checksums:
      sha256: 18871b1311b295c43d0f...[truncated]...772da97b67e99d84d342ef4aEXAMPLE
```

```
"files": {
    "launch.py": {
        "checksums": {
            "sha256": "18871b1311b295c43d0f...[truncated]...772da97b67e99d84d342ef4aEXAMPLE"
        }
    }
}
```
형식: Dictionary<string,FilesConfiguration>  
필수 여부: 아니요

## SSM 문서 파라미터 `type` 예제
<a name="top-level-properties-type"></a>

SSM 문서의 파라미터 유형은 정적입니다. 즉, 파라미터 유형을 정의한 후에는 변경할 수 없습니다. SSM 문서 플러그인과 함께 파라미터를 사용하는 경우 파라미터 유형을 플러그인의 입력 내에서 동적으로 변경할 수 없습니다. 예를 들어 이러한 입력은 문자열이나 문자열 목록을 허용하기 때문에 `aws:runShellScript` 플러그인의 `runCommand` 입력 내에서 `Integer` 파라미터를 참조할 수 없습니다. 플러그인 입력에 파라미터를 사용하려면 파라미터 유형이 허용되는 유형과 일치해야 합니다. 예를 들어 `aws:updateSsmAgent` 플러그인의 `allowDowngrade` 입력에 대해 `Boolean` 유형 파라미터를 지정해야 합니다. 파라미터 유형이 플러그인의 입력 유형과 일치하지 않으면 SSM 문서 검증에 실패하고 시스템에서는 문서를 생성하지 않습니다. 이는 다른 플러그 인 또는 AWS Systems Manager Automation 작업에 대한 입력 내에서 파라미터 다운스트림을 사용할 때도 마찬가지입니다. 예를 들어 `aws:runDocument` 플러그 인의 `documentParameters` 입력 내에서 `StringList` 파라미터를 참조할 수 없습니다. `documentParameters` 입력은 다운스트림 SSM 문서 파라미터 유형이 `StringList` 파라미터이고 참조하는 파라미터와 일치하더라도 문자열 맵을 허용합니다.

Automation 작업에서 파라미터를 사용할 때, 대부분의 경우 SSM 문서 생성 시 파라미터 유형을 검증하지 않습니다. `aws:runCommand` 작업을 사용하는 경우에만 SSM 문서 생성 시 파라미터 유형이 검증됩니다. 다른 모든 경우에는 작업을 실행하기 전에 작업의 입력이 확인되면 자동화 실행 중에 파라미터 검증이 수행됩니다. 예를 들어 입력 파라미터가 `String`이고 이를 `aws:runInstances` 작업의 `MaxInstanceCount` 입력 값으로 참조하면 SSM 문서가 생성됩니다. 그러나 문서 실행 시 `MaxInstanceCount` 입력에 `Integer`가 필요하기 때문에 `aws:runInstances` 작업을 검증하는 중에 자동화가 실패합니다.

다음은 각 파라미터 `type`의 예입니다.

문자열  
인용 부호로 묶인 0개 이상의 유니코드 문자 시퀀스입니다. 예를 들면 "i-1234567890abcdef0"입니다. 패치 기준에서 특정 분류 및 심각도 수준의 모든 패치가 설치 승인을 받도록 지정할 수 있습니다.  
문자열 파라미터에는 보안 강화를 위해 환경 변수 보간을 활성화하는 선택적 `interpolationType` 필드 및 값 `ENV_VAR`이 포함될 수 있습니다.  

```
---
InstanceId:
  type: String
  description: "(Optional) The target EC2 instance ID."
  interpolationType: ENV_VAR
```

```
"InstanceId":{
  "type":"String",
  "description":"(Optional) The target EC2 instance ID.",
  "interpolationType": "ENV_VAR"
}
```

StringList  
쉼표로 구분된 문자열 항목의 목록입니다. 예를 들면 ["cd \$1”, “pwd”]입니다.  

```
---
commands:
  type: StringList
  description: "(Required) Specify a shell script or a command to run."
  default: ""
  minItems: 1
  displayType: textarea
```

```
"commands":{
  "type":"StringList",
  "description":"(Required) Specify a shell script or a command to run.",
  "minItems":1,
  "displayType":"textarea"
}
```

부울  
`true` 또는 `false`만 허용됩니다. "true" 또는 0은 허용되지 않습니다.  

```
---
canRun:
  type: Boolean
  description: ''
  default: true
```

```
"canRun": {
  "type": "Boolean",
  "description": "",
  "default": true
}
```

Integer  
정수입니다. 십진수(예: 3.14159) 또는 인용 부호로 묶인 숫자(예: "3")는 허용되지 않습니다.  

```
---
timeout:
  type: Integer
  description: The type of action to perform.
  default: 100
```

```
"timeout": {
  "type": "Integer",
  "description": "The type of action to perform.",
  "default": 100    
}
```

StringMap  
키-값 매핑입니다. 키와 값은 문자열이어야 합니다. 예를 들면 \$1"Env”: “Prod”\$1입니다.  

```
---
notificationConfig:
  type: StringMap
  description: The configuration for events to be notified about
  default:
    NotificationType: 'Command'
    NotificationEvents:
    - 'Failed'
    NotificationArn: "$dependency.topicArn"
  maxChars: 150
```

```
"notificationConfig" : {
  "type" : "StringMap",
  "description" : "The configuration for events to be notified about",
  "default" : {
    "NotificationType" : "Command",
    "NotificationEvents" : ["Failed"],
    "NotificationArn" : "$dependency.topicArn"
  },
  "maxChars" : 150
}
```

MapList  
SfortMar 객체의 목록입니다.  

```
blockDeviceMappings:
  type: MapList
  description: The mappings for the create image inputs
  default:
  - DeviceName: "/dev/sda1"
    Ebs:
      VolumeSize: "50"
  - DeviceName: "/dev/sdm"
    Ebs:
      VolumeSize: "100"
  maxItems: 2
```

```
"blockDeviceMappings":{
  "type":"MapList",
  "description":"The mappings for the create image inputs",
  "default":[
    {
      "DeviceName":"/dev/sda1",
      "Ebs":{
        "VolumeSize":"50"
      }
    },
    {
      "DeviceName":"/dev/sdm",
      "Ebs":{
        "VolumeSize":"100"
      }
    }
  ],
  "maxItems":2
}
```

## SSM Command 문서 내용 보기
<a name="viewing-ssm-document-content"></a>

AWS Systems Manager(SSM) 문서에 대한 필수 및 옵션 파라미터를 미리 보기 위해 문서에서 실행하는 작업 외에도 Systems Manager 콘솔에서 문서의 내용을 볼 수 있습니다.

**SSM Command 문서 내용을 보려면**

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

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

1. 검색 상자에서 [**문서 유형(Document type)**]을 선택한 다음 [**Command**]를 선택합니다.

1. 문서의 이름을 선택한 후 [**콘텐츠(Content)**] 탭을 선택합니다.

1. 콘텐츠 필드에서 문서에 사용 가능한 파라미터와 작업 단계를 검토합니다.

   예를 들어 다음 이미지는 (1) `version` 및 (2) `allowDowngrade`가 `AWS-UpdateSSMAgent` 문서에 대한 옵션 파라미터이고 문서에서 실행되는 첫 번째 작업이 (3) `aws:updateSsmAgent`임을 보여줍니다.  
![\[Systems Manager 콘솔에서 SSM 문서 내용 보기\]](http://docs.aws.amazon.com/ko_kr/systems-manager/latest/userguide/images/view-document-content.png)

# Command 문서 플러그인 참조
<a name="documents-command-ssm-plugin-reference"></a>

이 참조는 AWS Systems Manager(SSM) Command 유형 문서에서 지정할 수 있는 플러그인을 설명합니다. 이러한 플러그인은 Automation 작업을 사용하는 SSM Automation 실행서에서는 사용할 수 없습니다. AWS Systems Manager 자동화 작업에 대한 자세한 내용은 [Systems Manager Automation 작업 참조](automation-actions.md) 섹션을 참조하세요.

Systems Manager는 SSM 문서의 콘텐츠를 읽어 관리형 인스턴스에서 수행할 작업을 결정합니다. 각 문서에는 코드 실행 섹션이 포함됩니다. 문서의 스키마 버전에 따라 이 코드 실행 섹션이 하나 이상의 플러그인 또는 단계를 포함할 수 있습니다. 이 도움말 주제의 목적을 위해, 플러그인 및 단계를 *플러그인*으로 부릅니다. 이 섹션에는 각 Systems Manager 플러그인에 대한 정보가 포함되어 있습니다. 문서 생성 및 스키마 버전 간 차이를 비롯해 문서에 대한 자세한 내용은 [AWS Systems Manager Documents](documents.md) 섹션을 참조하세요.

`aws:runShellScript` 및 `aws:runPowerShellScript`와 같은 문자열 파라미터를 허용하는 플러그인의 경우 `interpolationType` 파라미터를 사용하여 파라미터 입력을 잠재적으로 실행 가능한 명령이 아닌 문자열 리터럴로 처리하여 보안을 강화할 수 있습니다. 예제:

```
{
    "schemaVersion": "2.2",
    "description": "runShellScript with command strings stored as Parameter Store parameter",
    "parameters": {
      "commands": {
        "type": "StringList",
        "description": "(Required) The commands to run on the instance.",
        "default": ["{{ ssm:myShellCommands }}"],
        "interpolationType" : "ENV_VAR"
      }
    },
    //truncated
 }
```

**참고**  
여기서 설명하는 일부 플러그인은 Windows Server 인스턴스 또는 Linux 인스턴스 중 하나에서만 실행할 수 있습니다. 플러그인마다 플랫폼 종속성이 표시되어 있습니다.  
다음 문서 플러그인은 macOS용 Amazon Elastic Compute Cloud(Amazon EC2) 인스턴스에서 지원됩니다.  
`aws:refreshAssociation`
`aws:runShellScript`
`aws:runPowerShellScript`
`aws:softwareInventory`
`aws:updateSsmAgent`

**Topics**
+ [공유 입력](#shared-inputs)
+ [`aws:applications`](#aws-applications)
+ [`aws:cloudWatch`](#aws-cloudWatch)
+ [`aws:configureDocker`](#aws-configuredocker)
+ [`aws:configurePackage`](#aws-configurepackage)
+ [`aws:domainJoin`](#aws-domainJoin)
+ [`aws:downloadContent`](#aws-downloadContent)
+ [`aws:psModule`](#aws-psModule)
+ [`aws:refreshAssociation`](#aws-refreshassociation)
+ [`aws:runDockerAction`](#aws-rundockeraction)
+ [`aws:runDocument`](#aws-rundocument)
+ [`aws:runPowerShellScript`](#aws-runPowerShellScript)
+ [`aws:runShellScript`](#aws-runShellScript)
+ [`aws:softwareInventory`](#aws-softwareinventory)
+ [`aws:updateAgent`](#aws-updateagent)
+ [`aws:updateSsmAgent`](#aws-updatessmagent)

## 공유 입력
<a name="shared-inputs"></a>

(SSM Agent 버전 3.0.502 이상 한정) 모든 플러그 인은 다음 입력을 사용할 수 있습니다.

**finallyStep**  
문서를 실행할 마지막 단계입니다. 이 입력이 단계에 대해 정의된 경우 `onFailure` 또는 `onSuccess` 입력에 지정된 `exit` 값보다 우선합니다. 이 입력이 있는 단계가 예상대로 실행되려면 해당 단계가 문서의 `mainSteps`에 정의된 마지막 단계여야 합니다.  
유형: Boolean  
유효한 값: `true` \$1 `false`  
필수 여부: 아니요

**onFailure**  
`exit` 값이 있는 플러그인에 대해 이 입력을 지정하고 단계가 실패하면 단계 상태는 실패를 반영하고 문서는 `finallyStep`이 정의되지 않는 한 나머지 단계를 실행하지 않습니다. `successAndExit` 값이 있는 플러그인에 대해 이 입력을 지정하고 단계가 실패하면 단계 상태는 성공으로 표시되고 문서는 `finallyStep`이 정의되지 않는 한 나머지 단계를 실행하지 않습니다.  
유형: 문자열  
유효한 값: `exit` \$1 `successAndExit`  
필수 여부: 아니요

**onSuccess**  
플러그인에 대해 이 입력을 지정하고 단계가 성공적으로 실행되면 `finallyStep`이 정의되지 않는 한 문서는 나머지 단계를 실행하지 않습니다.  
타입: 문자열  
유효한 값: `exit`  
필수 여부: 아니요

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: Shared inputs example
parameters:
  customDocumentParameter:
    type: String
    description: Example parameter for a custom Command-type document.
mainSteps:
- action: aws:runDocument
  name: runCustomConfiguration
  inputs:
    documentType: SSMDocument
    documentPath: "yourCustomDocument"
    documentParameters: '"documentParameter":{{customDocumentParameter}}'
    onSuccess: exit
- action: aws:runDocument
  name: ifConfigurationFailure
  inputs:
    documentType: SSMDocument
    documentPath: "yourCustomRepairDocument"
    onFailure: exit
- action: aws:runDocument
  name: finalConfiguration
  inputs:
    documentType: SSMDocument
    documentPath: "yourCustomFinalDocument"
    finallyStep: true
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "Shared inputs example",
   "parameters": {
      "customDocumentParameter": {
         "type": "String",
         "description": "Example parameter for a custom Command-type document."
      }
   },
   "mainSteps":[
      {
         "action": "aws:runDocument",
         "name": "runCustomConfiguration",
         "inputs": {
            "documentType": "SSMDocument",
            "documentPath": "yourCustomDocument",
            "documentParameters": "\"documentParameter\":{{customDocumentParameter}}",
            "onSuccess": "exit"
         }
      },
      {
         "action": "aws:runDocument",
         "name": "ifConfigurationFailure",
         "inputs": {
            "documentType": "SSMDocument",
            "documentPath": "yourCustomRepairDocument",
            "onFailure": "exit"
         }
      },
      {
         "action": "aws:runDocument",
         "name":"finalConfiguration",
         "inputs": {
            "documentType": "SSMDocument",
            "documentPath": "yourCustomFinalDocument",
            "finallyStep": true
         }
      }
   ]
}
```

------

## `aws:applications`
<a name="aws-applications"></a>

EC2 인스턴스에서 애플리케이션을 설치, 복구 또는 제거합니다. 이 플러그인은 Windows Server 운영 체제에서만 실행됩니다.

### 구문
<a name="applications-syntax"></a>

#### 스키마 2.2
<a name="applications-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:applications plugin
parameters:
  source:
    description: "(Required) Source of msi."
    type: String
mainSteps:
- action: aws:applications
  name: example
  inputs:
    action: Install
    source: "{{ source }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion":"2.2",
  "description":"aws:applications",
  "parameters":{
    "source":{
    "description":"(Required) Source of msi.",
    "type":"String"
    }
  },
  "mainSteps":[
    {
      "action":"aws:applications",
      "name":"example",
      "inputs":{
        "action":"Install",
        "source":"{{ source }}"
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="applications-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:applications:
    properties:
    - id: 0.aws:applications
      action: "{{ action }}"
      parameters: "{{ parameters }}"
      source: "{{ source }}"
      sourceHash: "{{ sourceHash }}"
```

------
#### [ JSON ]

```
{
   "runtimeConfig":{
      "aws:applications":{
         "properties":[
            {
               "id":"0.aws:applications",
               "action":"{{ action }}",
               "parameters":"{{ parameters }}",
               "source":"{{ source }}",
               "sourceHash":"{{ sourceHash }}"
            }
         ]
      }
   }
}
```

------

### 속성
<a name="applications-properties"></a>

**작업**  
수행할 작업입니다.  
형식: 열거형  
유효한 값: `Install` \$1 `Repair` \$1 `Uninstall`  
필수 여부: 예

**parameters**  
설치 프로그램에 대한 파라미터입니다.  
유형: 문자열  
필수 여부: 아니요

**source**  
애플리케이션용 `.msi` 파일의 URL입니다.  
유형: 문자열  
필수 항목 여부: 예

**sourceHash**  
`.msi` 파일의 SHA256 해시입니다.  
유형: 문자열  
필수 여부: 아니요

## `aws:cloudWatch`
<a name="aws-cloudWatch"></a>

Windows Server에서 Amazon CloudWatch 또는 Amazon CloudWatch Logs로 데이터를 내보내고 CloudWatch 지표를 사용하여 데이터를 모니터링합니다. 이 플러그인은 Windows Server 운영 체제에서만 실행됩니다. Amazon Elastic Compute Cloud(Amazon EC2)와의 CloudWatch 통합 구성에 대한 자세한 내용은 *Amazon CloudWatch 사용 설명서*의 [CloudWatch 에이전트를 사용하여 지표, 로그 및 추적 수집](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html)을 참조하세요.

**중요**  
통합 CloudWatch 에이전트가 Amazon CloudWatch Logs에 로그 데이터를 전송하기 위한 도구로 SSM Agent를 대체했습니다. SSM Agent aws:cloudWatch 플러그인은 지원되지 않습니다. 로그 수집 프로세스에 통합된 CloudWatch 에이전트만 사용하는 것이 좋습니다. 자세한 내용은 다음 항목을 참조하세요.  
[통합 CloudWatch Logs로 노드 로그 전송(CloudWatch 에이전트)](monitoring-cloudwatch-agent.md)
[Windows 서버 노드 로그 수집을 CloudWatch 에이전트로 마이그레이션](monitoring-cloudwatch-agent.md#monitoring-cloudwatch-agent-migrate)
*Amazon CloudWatch 사용 설명서의 [CloudWatch 에이전트를 사용하여 지표, 로그 및 추적 수집](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html).*

다음의 데이터 형식을 내보내고 모니터링할 수 있습니다.

**ApplicationEventLog**  
CloudWatch Logs로 애플리케이션 이벤트 로그 데이터를 보냅니다.

**CustomLogs**  
Amazon CloudWatch Logs로 텍스트 기반 로그 파일을 보냅니다. CloudWatch 플러그인은 로그 파일의 지문을 생성합니다. 그러면 시스템이 각 지문에 데이터 오프셋을 연결합니다. 플러그인은 변경 사항이 있을 경우 파일을 업로드하고, 오프셋을 기록하고, 지문에 오프셋을 연결합니다. 이 방법은 사용자가 플러그인을 설정하고, 대량 파일을 포함하는 디렉터리에 서비스를 연결하고, 시스템이 모든 파일을 업로드하는 상황을 방지하기 위해 사용됩니다.  
애플리케이션이 폴링 도중 로그를 자르거나 정리하려 할 경우 `LogDirectoryPath`에 지정된 모든 로그에서 항목이 손실될 수 있음을 유의하세요. 예를 들어 로그 파일 크기를 제한하려는 경우, 해당 제한에 도달하면 새 로그 파일을 생성한 후 새 파일에 데이터를 계속 기록합니다.

**ETW**  
CloudWatch Logs로 Windows용 이벤트 추적(ETW) 데이터를 보냅니다.

**IIS**  
CloudWatch Logs로 IIS 로그 데이터를 전송합니다.

**PerformanceCounter**  
CloudWatch로 Windows 성능 카운터를 보냅니다. CloudWatch에 지표로 업로드할 여러 범주를 선택할 수 있습니다. 업로드하려는 각 성능 카운터에 대해 고유한 ID(예: "PerformanceCounter2", "PerformanceCounter3" 등)를 지정하여 **PerformanceCounter** 섹션을 생성하고 해당 속성을 구성합니다.  
AWS Systems Manager SSM Agent 또는 CloudWatch 플러그 인이 중지되고 성능 카운터 데이터가 에 로그되지 않습니다. 이 동작은 사용자 지정 로그나 Windows 이벤트 로그와 다릅니다. 사용자 정의 로그와 Windows 이벤트 로그는 성능 측정 데이터를 보관했다가 SSM Agent 또는 CloudWatch 플러그인이 사용 가능해지면 CloudWatch에 업로드합니다.

**SecurityEventLog**  
CloudWatch Logs로 보안 이벤트 로그 데이터를 보냅니다.

**SystemEventLog**  
CloudWatch Logs로 시스템 이벤트 로그 데이터를 전송합니다.

데이터에 다음 대상을 정의할 수 있습니다.

**CloudWatch**  
성능 카운터 지표 데이터가 보내지는 대상입니다. 고유한 ID(예: "CloudWatch2", CloudWatch3" 등)를 갖는 섹션을 추가하고 새 ID마다 다른 리전을 지정하여 동일한 데이터를 여러 위치로 보낼 수 있습니다.

**CloudWatchLogs**  
로그 데이터가 보내지는 대상입니다. 고유한 ID(예: "CloudWatchLogs2", CloudWatchLogs3" 등)를 갖는 섹션을 추가하고 새 ID마다 다른 리전을 지정하여 동일한 데이터를 여러 위치로 보낼 수 있습니다.

### 구문
<a name="cloudWatch-syntax"></a>

```
"runtimeConfig":{
        "aws:cloudWatch":{
            "settings":{
                "startType":"{{ status }}"
            },
            "properties":"{{ properties }}"
        }
    }
```

### 설정 및 속성
<a name="cloudWatch-properties"></a>

**AccessKey**  
사용자의 액세스 키 ID입니다. 이 속성은 IAM 역할을 사용해 인스턴스를 시작하지 않은 한 필수입니다. 이 속성은 SSM과 함께 사용할 수 없습니다.  
유형: 문자열  
필수 여부: 아니요

**CategoryName**  
Performance Monitor의 성능 카운터 범주입니다.  
유형: 문자열  
필수 항목 여부: 예

**CounterName**  
Performance Monitor의 성능 카운터 이름입니다.  
유형: 문자열  
필수 항목 여부: 예

**CultureName**  
타임스탬프가 기록되는 로캘입니다. **CultureName**이 공백이면 기본적으로 Windows Server 인스턴스에서 사용 중인 것과 동일한 로캘로 설정됩니다.  
유형: 문자열  
유효한 값: 지원되는 값 목록은 Microsoft 웹 사이트에서 [National Language Support(NLS)](https://msdn.microsoft.com/en-us/library/cc233982.aspx)를 참조하세요. **div**, **div-MV**, **hu**, **hu-HU** 값은 지원되지 않습니다.  
필수 여부: 아니요

**DimensionName**  
Amazon CloudWatch 지표의 차원입니다. `DimensionName`를 지정할 경우 `DimensionValue`을 지정해야 합니다. 이런 파라미터는 메트릭 나열 시 또 다른 보기를 제공합니다. 특정 차원에 속하는 모든 지표를 볼 수 있도록 여러 지표에서 같은 차원을 사용할 수 있습니다.  
유형: 문자열  
필수 여부: 아니요

**DimensionValue**  
Amazon CloudWatch 지표의 차원 값입니다.  
유형: 문자열  
필수 여부: 아니요

**인코딩**  
사용할 파일 인코딩입니다(예: UTF-8). 표시 이름이 아니라 인코딩 이름을 사용합니다.  
유형: 문자열  
유효한 값: 지원되는 값 목록은 Microsoft Learn Library의 [Encoding Class](https://learn.microsoft.com/en-us/dotnet/api/system.text.encoding?view=net-7.0)를 참조하세요.  
필수 여부: 예

**필터**  
로그 이름의 접두사입니다. 모든 파일을 모니터링하려면 이 파라미터를 공백으로 둡니다.  
유형: 문자열  
유효한 값: 지원되는 값 목록은 MSDN 라이브러리에서 [FileSystemWatcherFilter Property](http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.filter.aspx) 항목을 참조하세요.  
필수 여부: 아니요

**흐름**  
데이터의 대상(CloudWatch 또는 CloudWatch Logs)과 함께 업로드할 각 데이터 형식입니다. 예를 들어 `"Id": "PerformanceCounter"`에서 정의된 성능 카운터를 `"Id": "CloudWatch"`에서 정의된 CloudWatch 대상으로 보내려면 **"PerformanceCounter,CloudWatch"**를 입력합니다. 마찬가지로, 사용자 정의 로그, ETW 로그 및 시스템 로그를 `"Id": "ETW"`에서 정의된 CloudWatch Logs 대상으로 보내려면 **"(ETW),CloudWatchLogs"**를 입력합니다. 또한, 같은 성능 카운터 또는 로그 파일을 두 개 이상의 대상으로 보낼 수 있습니다. 예를 들어, 애플리케이션 로그를 `"Id": "CloudWatchLogs"` 및 `"Id": "CloudWatchLogs2"`에서 정의된 두 개의 대상으로 보내려면 **"ApplicationEventLog,(CloudWatchLogs, CloudWatchLogs2)"**를 입력합니다.  
유형: 문자열  
유효한 값(원본): `ApplicationEventLog` \$1 `CustomLogs` \$1 `ETW` \$1 `PerformanceCounter` \$1 `SystemEventLog` \$1 `SecurityEventLog`   
유효한 값(대상): `CloudWatch` \$1 `CloudWatchLogs` \$1 `CloudWatch`*n* \$1 `CloudWatchLogs`*n*   
필수 여부: 예

**FullName**  
구성 요소의 전체 이름입니다.  
유형: 문자열  
필수 항목 여부: 예

**Id**  
데이터 원본 또는 대상을 식별합니다. 이 식별자는 구성 파일 내에서 고유해야 합니다.  
유형: 문자열  
필수 항목 여부: 예

**InstanceName**  
성능 카운터 인스턴스의 이름입니다. 각 성능 카운터 구성 요소가 메트릭을 하나씩만 지원하므로, 모든 인스턴스를 나타내기 위해 별표(\$1)를 사용하지 않도록 합니다. 하지만 **\$1Total**을 사용할 수는 있습니다.  
유형: 문자열  
필수 항목 여부: 예

**수준**  
Amazon CloudWatch로 전송할 메시지의 유형입니다.  
유형: 문자열  
유효한 값:   
+ **1** - 오류 메시지만 업로드됩니다.
+ **2** - 경고 메시지만 업로드됩니다.
+ **4** - 정보 메시지만 업로드됩니다.
이들 값을 적절히 더하여 두 가지 이상의 메시지 유형을 포함할 수 있습니다. 예를 들어 **3**은 오류 메시지(**1**)와 경고 메시지(**2**)가 포함된다는 의미입니다. 값 **7**은 오류 메시지(**1**), 경고 메시지(**2**) 및 정보 메시지(**4**)가 포함된다는 의미입니다.  
필수 여부: 예  
Windows 보안 로그는 수준을 7로 설정해야 합니다.

**LineCount**  
로그 파일을 식별하는 헤더의 행 수입니다. 예를 들어, IIS 로그 파일에 있는 헤더들은 사실상 동일합니다. **3**을 입력하면 로그 파일 헤더에서 처음 나오는 세 줄을 읽어 식별하는 식입니다. IIS 로그 파일에서 세 번째 줄은 날짜와 타임스탬프(로그 파일 간에 차이가 있음)입니다.  
유형: 정수  
필수 여부: 아니요

**LogDirectoryPath**  
CustomLogs의 경우, 로그가 EC2 인스턴스에서 저장되는 경로입니다. IIS 로그의 경우, 개별 사이트에 대해 IIS 로그가 저장되는 폴더입니다(예: **C:\$1\$1inetpub\$1\$1logs\$1\$1LogFiles\$1\$1W3SVC*n***). IIS 로그에는 W3C 로그 형식만 지원됩니다. IIS, NCSA 및 사용자 정의 형식은 지원되지 않습니다.  
유형: 문자열  
필수 항목 여부: 예

**LogGroup**  
로그 그룹의 이름. 이 이름은 CloudWatch 콘솔에서 [**로그 그룹(Log Groups)**] 화면에 표시됩니다.  
유형: 문자열  
필수 항목 여부: 예

**LogName**  
로그 파일의 이름입니다.  

1. 로그 이름을 찾으려면 이벤트 뷰어의 탐색 창에서 [**애플리케이션 및 서비스 로그(Applications and Services Logs)**]를 선택합니다.

1. 로그 목록에서 업로드하려는 로그(예: `Microsoft` > `Windows` > `Backup` > `Operational`)를 마우스 오른쪽 버튼으로 클릭한 후 **Create Custom View(사용자 정의 뷰 생성)**를 선택합니다.

1. [**사용자 정의 뷰 생성(Create Custom View)**] 대화 상자에서 **XML** 탭을 선택합니다. **LogName**은 <Select Path=> 태그 안에 있습니다(예: `Microsoft-Windows-Backup`). 이 텍스트를 **LogName** 파라미터에 복사합니다.
유형: 문자열  
유효한 값: `Application` \$1 `Security` \$1 `System` \$1 `Microsoft-Windows-WinINet/Analytic`  
필수 여부: 예

**LogStream**  
대상 로그 스트림입니다. 기본값인 **\$1instance\$1id\$1**를 사용하는 경우 이 인스턴스의 인스턴스 ID가 로그 스트림 이름으로 사용됩니다.  
유형: 문자열  
유효한 값: `{instance_id}` \$1 `{hostname}` \$1 `{ip_address}` *<log\$1stream\$1name>*  
미리 존재하지 않는 로그 스트림 이름을 입력하면 CloudWatch Logs에서 이 이름을 자동으로 생성합니다. 리터럴 문자열이나 사전 정의된 변수(**\$1instance\$1id\$1**, **\$1hostname\$1**, **\$1ip\$1address\$1**) 또는 세 변수 모두의 조합을 사용하여 로그 스트림 이름을 정의할 수 있습니다.  
이 파라미터에 지정된 로그 스트림 이름은 CloudWatch 콘솔의 **로그 그룹 > *<YourLogStream>*의 스트림(Log Groups > Streams for <YourLogStream>)** 화면에 표시됩니다.  
필수 여부: 예

**MetricName**  
성능 데이터를 포함할 CloudWatch 지표입니다.  
이름에 특수 문자를 사용할 수 없습니다. 사용하면 측정치 및 연결된 경보가 작동하지 않을 수 있습니다.
유형: 문자열  
필수 항목 여부: 예

**NameSpace**  
성능 카운터 데이터가 기록될 지표 네임스페이스입니다.  
유형: 문자열  
필수 항목 여부: 예

**PollInterval**  
새 성능 카운터 및 로그 데이터가 업로드되기 전에 경과해야 하는 시간(초)입니다.  
유형: 정수  
유효한 값: 이 값을 5초 이상으로 설정합니다. 15초(00:00:15)를 권장합니다.  
필수 여부: 예

**리전**  
로그 데이터를 보내려는 AWS 리전입니다. 로그 데이터를 보내는 다른 리전으로 성능 카운터를 보낼 수 있지만, 이 파라미터를 인스턴스가 실행 중인 것과 같은 리전으로 설정하는 것이 좋습니다.  
유형: 문자열  
유효한 값: Systems Manager와 CloudWatch Logs에서 모두 지원하는 AWS 리전의 리전 ID입니다(예: `us-east-2`, `eu-west-1`, 및 `ap-southeast-1`). 각 서비스에서 지원하는 AWS 리전 목록은 **Amazon Web Services 일반 참조의 [Amazon CloudWatch Logs 서비스 엔드포인트](https://docs.aws.amazon.com/general/latest/gr/cwl_region.html#cwl_region) 및 [Systems Manager 서비스 엔드포포인트](https://docs.aws.amazon.com/general/latest/gr/ssm.html#ssm_region)를 참조하세요.  
필수 여부: 예

**SecretKey**  
 보안 액세스 키입니다. 이 속성은 IAM 역할을 사용해 인스턴스를 시작하지 않은 한 필수입니다.  
유형: 문자열  
필수 여부: 아니요

**startType**  
인스턴스에서 CloudWatch를 설정하거나 해제합니다.  
유형: 문자열  
유효한 값: `Enabled` \$1 `Disabled`  
필수 여부: 예

**TimestampFormat**  
사용하려는 타임스탬프 형식입니다. 지원되는 값 목록은 MSDN 라이브러리에서 [Custom Date and Time Format Strings](http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx) 항목을 참조하세요.  
유형: 문자열  
필수 항목 여부: 예

**TimeZoneKind**  
로그의 타임스탬프에 시간대 정보가 포함되어 있지 않을 때 시간대 정보를 제공합니다. 이 파라미터가 공백으로 남겨져 있고 타임스탬프에 시간대 정보가 포함되어 있지 않으면 CloudWatch Logs가 기본적으로 현지 시간대로 설정됩니다. 타임스탬프에 표준 시간대 정보가 이미 포함되어 있는 경우 이 파라미터는 무시됩니다.  
유형: 문자열  
유효한 값: `Local` \$1 `UTC`  
필수 여부: 아니요

**단위**  
지표의 측정 단위입니다.  
유형: 문자열  
유효한 값: Seconds \$1 Microseconds \$1 Milliseconds \$1 Bytes \$1 Kilobytes \$1 Megabytes \$1 Gigabytes \$1 Terabytes \$1 Bits \$1 Kilobits \$1 Megabits \$1 Gigabits \$1 Terabits \$1 Percent \$1 Count \$1 Bytes/Second \$1 Kilobytes/Second \$1 Megabytes/Second \$1 Gigabytes/Second \$1 Terabytes/Second \$1 Bits/Second \$1 Kilobits/Second \$1 Megabits/Second \$1 Gigabits/Second \$1 Terabits/Second \$1 Count/Second \$1 None  
필수 여부: 예

## `aws:configureDocker`
<a name="aws-configuredocker"></a>

(스키마 버전 2.0 이상) 컨테이너 및 도커에서 사용할 인스턴스를 구성합니다. 이 플러그인은 대부분의 Linux 변형 및 Windows Server 운영 체제에서 지원됩니다.

### 구문
<a name="configuredocker-syntax"></a>

#### 스키마 2.2
<a name="configuredocker-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:configureDocker
parameters:
  action:
    description: "(Required) The type of action to perform."
    type: String
    default: Install
    allowedValues:
    - Install
    - Uninstall
mainSteps:
- action: aws:configureDocker
  name: configureDocker
  inputs:
    action: "{{ action }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:configureDocker plugin",
  "parameters": {
    "action": {
      "description": "(Required) The type of action to perform.",
      "type": "String",
      "default": "Install",
      "allowedValues": [
        "Install",
        "Uninstall"
      ]
    }
  },
  "mainSteps": [
    {
      "action": "aws:configureDocker",
      "name": "configureDocker",
      "inputs": {
        "action": "{{ action }}"
      }
    }
  ]
}
```

------

### 입력
<a name="configuredocker-properties"></a>

**작업**  
수행할 작업의 유형입니다.  
형식: 열거형  
유효한 값: `Install` \$1 `Uninstall`  
필수 여부: 예

## `aws:configurePackage`
<a name="aws-configurepackage"></a>

(스키마 버전 2.0 이상) AWS Systems Manager Distributor 패키지를 설치하거나 제거합니다. 최신 버전, 기본 버전 또는 지정한 패키지 버전을 설치할 수 있습니다. AWS에서 제공하는 패키지도 지원됩니다. 이 플러그인은 Windows Server 및 Linux 운영 체제에서 실행해야 하지만 사용 가능한 일부 패키지는 Linux 운영 체제에서 지원되지 않습니다.

Windows Server에 사용할 수 있는 AWS 패키지는 `AWSPVDriver`, `AWSNVMe`, `AwsEnaNetworkDriver`, `AwsVssComponents`, `AmazonCloudWatchAgent`, `CodeDeployAgent` 및 `AWSSupport-EC2Rescue.`입니다.

Linux 운영 체제에 사용할 수 있는 AWS 패키지는 `AmazonCloudWatchAgent`, `CodeDeployAgent` 및 `AWSSupport-EC2Rescue`입니다.

### 구문
<a name="configurepackage-syntax"></a>

#### 스키마 2.2
<a name="configurepackage-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:configurePackage
parameters:
  name:
    description: "(Required) The name of the AWS package to install or uninstall."
    type: String
  action:
    description: "(Required) The type of action to perform."
    type: String
    default: Install
    allowedValues:
    - Install
    - Uninstall
  ssmParameter:
    description: "(Required) Argument stored in Parameter Store."
    type: String
    default: "{{ ssm:parameter_store_arg }}"
mainSteps:
- action: aws:configurePackage
  name: configurePackage
  inputs:
    name: "{{ name }}"
    action: "{{ action }}"
    additionalArguments: 
      "{\"SSM_parameter_store_arg\": \"{{ ssmParameter }}\", \"SSM_custom_arg\": \"myValue\"}"
```

------
#### [ JSON ]

```
{
   "schemaVersion": "2.2",
   "description": "aws:configurePackage",
   "parameters": {
      "name": {
         "description": "(Required) The name of the AWS package to install or uninstall.",
         "type": "String"
      },
      "action": {
         "description": "(Required) The type of action to perform.",
         "type": "String",
         "default": "Install",
         "allowedValues": [
            "Install",
            "Uninstall"
         ]
      },
      "ssmParameter": {
         "description": "(Required) Argument stored in Parameter Store.",
         "type": "String",
         "default": "{{ ssm:parameter_store_arg }}"
      }
   },
   "mainSteps": [
      {
         "action": "aws:configurePackage",
         "name": "configurePackage",
         "inputs": {
            "name": "{{ name }}",
            "action": "{{ action }}",
            "additionalArguments": "{\"SSM_parameter_store_arg\": \"{{ ssmParameter }}\", \"SSM_custom_arg\": \"myValue\"}"
         }
      }
   ]
}
```

------

### 입력
<a name="configurepackage-properties"></a>

**이름**  
설치 또는 제거할 AWS 패키지의 이름입니다. `AWSPVDriver`, `AwsEnaNetworkDriver`, `AwsVssComponents`, `AmazonCloudWatchAgent` 등의 패키지를 사용할 수 있습니다.  
유형: 문자열  
필수 항목 여부: 예

**작업**  
패키지를 설치 또는 제거합니다.  
형식: 열거형  
유효한 값: `Install` \$1 `Uninstall`  
필수 여부: 예

**installationType**  
수행할 설치 유형입니다. `Uninstall and reinstall`을 지정하면 패키지가 완전히 제거되었다가 다시 설치됩니다. 재설치가 완료될 때까지 애플리케이션을 사용할 수 없습니다. `In-place update`를 지정하면 업데이트 스크립트에서 제공한 지침에 따라 새 파일이나 변경된 파일만 기존 설치에 추가됩니다. 애플리케이션은 업데이트 프로세스 전체에서 사용할 수 있습니다. AWS 게시된 패키지에는 `In-place update` 옵션이 지원되지 않습니다. `Uninstall and reinstall`이 기본값입니다.  
형식: 열거형  
유효한 값: `Uninstall and reinstall` \$1 `In-place update`  
필수 여부: 아니요

**additionalArguments**  
스크립트 설치, 제거 또는 업데이트에 제공되는 추가 파라미터의 JSON 문자열입니다. 각 파라미터에는 `SSM_`가 접두사로 붙어야 합니다. 규칙 `{{ssm:parameter-name}}`을 사용하여 추가 인수에서 Parameter Store 파라미터를 참조할 수 있습니다. 설치, 제거 또는 업데이트 스크립트에서 추가 파라미터를 사용하려면 운영 체제에 적합한 구문을 사용하여 파라미터를 환경 변수로 참조해야 합니다. 예를 들어 PowerShell에서 `SSM_arg` 인수를 `$Env:SSM_arg`로 참조합니다. 정의하는 인수 수에는 제한이 없지만 추가 인수 입력에는 4,096자 제한이 있습니다. 이 제한에는 정의한 모든 키와 값이 포함됩니다.  
유형: StringMap  
필수 여부: 아니요

**버전**  
설치 또는 제거할 패키지의 특정 버전입니다. 설치하는 경우 기본적으로 시스템이 최근에 게시된 버전을 설치합니다. 제거하는 경우 기본적으로 시스템이 현재 설치된 버전을 제거합니다. 설치된 버전이 발견되지 않으면 최근에 게시된 버전이 다운로드되고 제거 작업이 실행됩니다.  
유형: 문자열  
필수 여부: 아니요

## `aws:domainJoin`
<a name="aws-domainJoin"></a>

도메인에 EC2 인스턴스를 조인합니다. 이 플러그인은 Linux 및 Windows Server 운영 체제에서 실행됩니다. 이 플러그인은 Linux 인스턴스의 호스트 이름을 EC2AMAZ-*XXXXXXX* 형식으로 변경합니다. EC2 인스턴스 조인에 대한 자세한 내용은 *AWS Directory Service Administration Guide*의 [Join an EC2 Instance to Your AWS Managed Microsoft AD Directory](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_join_instance.html)를 참조하세요.

### 구문
<a name="domainJoin-syntax"></a>

#### 스키마 2.2
<a name="domainJoin-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:domainJoin
parameters:
  directoryId:
    description: "(Required) The ID of the directory."
    type: String
  directoryName:
    description: "(Required) The name of the domain."
    type: String
  directoryOU:
    description: "(Optional) The organizational unit to assign the computer object to."
    type: String
  dnsIpAddresses:
    description: "(Required) The IP addresses of the DNS servers for your directory."
    type: StringList
  hostname:
    description: "(Optional) The hostname you want to assign to the node."
    type: String
mainSteps:
- action: aws:domainJoin
  name: domainJoin
  inputs:
    directoryId: "{{ directoryId }}"
    directoryName: "{{ directoryName }}"
    directoryOU: "{{ directoryOU }}"
    dnsIpAddresses: "{{ dnsIpAddresses }}"
    hostname: "{{ hostname }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:domainJoin",
  "parameters": {
    "directoryId": {
      "description": "(Required) The ID of the directory.",
      "type": "String"
    },
    "directoryName": {
      "description": "(Required) The name of the domain.",
      "type": "String"
    },
    "directoryOU": {
        "description": "(Optional) The organizational unit to assign the computer object to.",
        "type": "String"
      },
    "dnsIpAddresses": {
      "description": "(Required) The IP addresses of the DNS servers for your directory.",
      "type": "StringList"
    },
    "hostname": {
        "description": "(Optional) The hostname you want to assign to the node.",
        "type": "String"
      }
  },
  "mainSteps": [
    {
      "action": "aws:domainJoin",
      "name": "domainJoin",
      "inputs": {
        "directoryId": "{{ directoryId }}",
        "directoryName": "{{ directoryName }}",
        "directoryOU":"{{ directoryOU }}",
        "dnsIpAddresses":"{{ dnsIpAddresses }}",
        "hostname":"{{ hostname }}"
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="domainJoin-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:domainJoin:
    properties:
      directoryId: "{{ directoryId }}"
      directoryName: "{{ directoryName }}"
      directoryOU: "{{ directoryOU }}"
      dnsIpAddresses: "{{ dnsIpAddresses }}"
```

------
#### [ JSON ]

```
{
   "runtimeConfig":{
      "aws:domainJoin":{
         "properties":{
            "directoryId":"{{ directoryId }}",
            "directoryName":"{{ directoryName }}",
            "directoryOU":"{{ directoryOU }}",
            "dnsIpAddresses":"{{ dnsIpAddresses }}"
         }
      }
   }
}
```

------

### 속성
<a name="domainJoin-properties"></a>

**directoryId**  
디렉터리의 ID입니다.  
유형: 문자열  
필수 항목 여부: 예  
예: "directoryId": "d-1234567890"

**directoryName**  
도메인 이름.  
유형: 문자열  
필수 항목 여부: 예  
예: "directoryName": "example.com"

**directoryOU**  
조직 단위(OU)입니다.  
유형: 문자열  
필수 여부: 아니요  
예: "directoryOU": "OU=test,DC=example,DC=com"

**dnsIpAddresses**  
DNS 서버의 IP 주소입니다.  
유형: StringList  
필수 여부: 예  
예: "dnsIpAddresses": ["198.51.100.1","198.51.100.2"]

**hostname**  
노드에 할당하려는 호스트 이름입니다. 제공되지 않은 경우 Windows Server 인스턴스의 이름은 변경되지 않지만 Linux 인스턴스는 기본 이름 지정 패턴을 사용합니다. 제공된 경우 Windows Server 인스턴스는 제공된 정확한 값을 사용하는 반면, Linux 인스턴스의 경우 접두사 역할을 합니다(`keepHostName`가 'true'로 설정된 경우 제외).  
유형: 문자열  
필수 여부: 아니요

**keepHostName**  
도메인에 가입할 때 Linux 인스턴스의 호스트 이름이 변경될지 여부를 결정합니다. Linux 전용 파라미터입니다. 기본적으로 (`hostname`, `hostnameNumAppendDigits`에 입력이 없고 `keepHostName`이 'false'로 설정된 경우) Linux 호스트의 이름이 EC2AMAZ-XXXXXX 패턴으로 변경됩니다. 'true'로 설정하면 원래 호스트 이름을 유지하고 `hostname` 및 `hostnameNumAppendDigits`에 대한 입력을 무시합니다.  
유형: 부울  
필수 여부: 아니요

**hostnameNumAppendDigits**  
호스트 이름 값 뒤에 추가할 무작위 숫자의 수를 정의합니다. 이는 Linux 전용 파라미터이며 `hostname` 파라미터와 함께 사용됩니다. `hostname`이 제공되지 않으면 무시됩니다.  
유형: 문자열  
허용된 값: 1\$15  
필수 여부: 아니요

### 예제
<a name="domainJoin-examples"></a>

예시는 *AWS Directory Service 관리 안내서*의 [AWS Managed Microsoft AD에 Amazon EC2 인스턴스 조인](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ec2-join-aws-domain.html)을 참조하세요.

## `aws:downloadContent`
<a name="aws-downloadContent"></a>

(스키마 버전 2.0 이상) 원격 위치에서 SSM 문서 및 스크립트를 다운로드합니다. GitHub Enterprise 리포지토리는 지원되지 않습니다. 이 플러그인은 Linux 및 Windows Server 운영 체제에서 지원됩니다.

### 구문
<a name="downloadContent-syntax"></a>

#### 스키마 2.2
<a name="downloadContent-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:downloadContent
parameters:
  sourceType:
    description: "(Required) The download source."
    type: String
  sourceInfo:
    description: "(Required) The information required to retrieve the content from
      the required source."
    type: StringMap
mainSteps:
- action: aws:downloadContent
  name: downloadContent
  inputs:
    sourceType: "{{ sourceType }}"
    sourceInfo: "{{ sourceInfo }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:downloadContent",
  "parameters": {
    "sourceType": {
    "description": "(Required) The download source.",
    "type": "String"
  },
  "sourceInfo": {
    "description": "(Required) The information required to retrieve the content from the required source.",
    "type": "StringMap"
    }
  },
  "mainSteps": [
    {
      "action": "aws:downloadContent",
      "name": "downloadContent",
      "inputs": {
        "sourceType":"{{ sourceType }}",
        "sourceInfo":"{{ sourceInfo }}"
      }
    }
  ]
}
```

------

### 입력
<a name="downloadContent-inputs"></a>

**sourceType**  
다운로드 소스입니다. Systems Manager는 스크립트 및 SSM 문서 다운로드를 위해 `GitHub`, `Git`, `HTTP`, `S3` 및 `SSMDocument` 소스 유형을 지원합니다.  
유형: 문자열  
필수 항목 여부: 예

**sourceInfo**  
필요한 원본에서 콘텐츠를 검색하는 데 필요한 정보입니다.  
유형: StringMap  
필수 여부: 예  
 **sourceType `GitHub,`에 대해 다음을 지정합니다.**  
+ owner: 리포지토리 소유자입니다.
+ repository: 리포지토리의 이름입니다.
+ path: 다운로드할 파일 또는 디렉터리에 대한 경로입니다.
+ getOptions: 마스터가 아닌 분기 또는 리포지토리의 특정 커밋에서 내용을 검색하는 추가 옵션입니다. 마스터 분기에서 최신 커밋을 사용하는 경우 getOptions를 생략할 수 있습니다. 리포지토리가 2020년 10월 1일 이후에 생성된 경우 기본 분기의 이름은 master 대신 main이 될 수 있습니다. 이 경우 getOptions 파라미터에 대한 값을 지정해야 합니다.

  이 파라미터는 다음 형식을 사용합니다.
  + branch:refs/heads/*branch\$1name*

    기본값은 `master`입니다.

    기본이 아닌 브랜치를 지정하려면 다음 형식을 사용합니다.

    branch:refs/heads/*branch\$1name*
  + commitID:*commitID*

    기본값은 `head`입니다.

    최신 버전이 아닌 커밋에서 SSM 문서의 버전을 사용하려면 전체 커밋 ID를 지정합니다. 예제:

    ```
    "getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE",
    ```
+ tokenInfo: GitHub 액세스 토큰 정보를 `{{ssm-secure:secure-string-token-name}}` 형식으로 저장하는 Systems Manager 파라미터(SecureString 파라미터)입니다.
**참고**  
이 `tokenInfo` 필드는 SecureString 파라미터를 지원하는 유일한 SSM 문서 플러그인 필드입니다. SecureString 파라미터는 다른 SSM 문서 플러그인이나 다른 필드에서 지원되지 않습니다.

```
{
    "owner":"TestUser",
    "repository":"GitHubTest",
    "path":"scripts/python/test-script",
    "getOptions":"branch:master",
    "tokenInfo":"{{ssm-secure:secure-string-token}}"
}
```
 **sourceType `Git`에 대해 다음을 지정해야 합니다.**  
+ repository

  다운로드할 파일 또는 디렉터리의 Git 리포지토리 URL입니다.

  유형: 문자열
또한 다음과 같은 파라미터(옵션)를 지정할 수 있습니다.  
+ getOptions

  마스터가 아닌 분기 또는 리포지토리의 특정 커밋에서 내용을 검색하는 추가 옵션입니다. 마스터 분기에서 최신 커밋을 사용하는 경우 getOptions를 생략할 수 있습니다.

  유형: 문자열

  이 파라미터는 다음 형식을 사용합니다.
  + branch:refs/heads/*branch\$1name*

    기본값은 `master`입니다.

    `"branch"`는 SSM 문서가 `master`가 아닌 분기에 저장된 경우에만 필요합니다. 예:

    ```
    "getOptions": "branch:refs/heads/main"
    ```
  + commitID:*commitID*

    기본값은 `head`입니다.

    최신 버전이 아닌 커밋에서 SSM 문서의 버전을 사용하려면 전체 커밋 ID를 지정합니다. 예:

    ```
    "getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE",
    ```
+ privateSSHKey

  지정하는 `repository`에 연결할 때 사용할 SSH 키입니다. `{{ssm-secure:your-secure-string-parameter}}` 형식을 사용하여 SSH 키 값에 대한 `SecureString` 파라미터를 참조할 수 있습니다.

  유형: 문자열
+ 건너뛰기 키 검사

  지정한 `repository`에 연결할 때 StrictHostKeyChecking 옵션의 값을 결정합니다. 기본값은 `false`입니다.

  유형: Boolean
+ 사용자 이름

  HTTP를 사용하여 지정한 `repository`에 연결할 때 사용할 사용자 이름입니다. `{{ssm-secure:your-secure-string-parameter}}` 형식을 사용하여 사용자 이름 값에 대한 `SecureString` 파라미터를 참조할 수 있습니다.

  유형: 문자열
+ 암호

  HTTP를 사용하여 지정한 `repository`에 연결할 때 사용할 암호입니다. `{{ssm-secure:your-secure-string-parameter}}` 형식을 사용하여 암호 값에 대한 `SecureString` 파라미터를 참조할 수 있습니다.

  유형: 문자열
 **sourceType `HTTP`에 대해 다음을 지정해야 합니다.**  
+ url

  다운로드할 파일 또는 디렉터리의 URL입니다.

  유형: 문자열
또한 다음과 같은 파라미터(옵션)를 지정할 수 있습니다.  
+ allowInsecureDownload

  보안 소켓 계층(SSL) 또는 전송 계층 보안(TLS)으로 암호화되지 않은 연결을 통해 다운로드를 수행할 수 있는지 여부를 결정합니다. 기본값은 `false`입니다. 암호화 없이 다운로드를 수행하지 않는 것이 좋습니다. 그렇게 하기로 선택하는 경우 모든 관련 위험을 감수해야 합니다. 보안은 AWS와 사용자의 공동 책임입니다. 이것을 공동 책임 모델이라고 합니다. 자세한 내용은 [공동 책임 모델](https://aws.amazon.com/compliance/shared-responsibility-model/)을 참조하세요.

  유형: Boolean
+ authMethod

  지정한 `url`에 연결할 때 사용자 이름과 암호를 인증에 사용할지 여부를 결정합니다. `Basic` 또는 `Digest`를 지정하는 경우 `username` 및 `password` 파라미터에 대한 값을 제공해야 합니다. `Digest` 메서드를 사용하려면 인스턴스에 SSM Agent 버전 3.0.1181.0 이상이 설치되어 있어야 합니다. `Digest` 메서드는 MD5 및 SHA256 암호화를 지원합니다.

  유형: 문자열

  유효한 값: `None` \$1 `Basic` \$1 `Digest`
+ 사용자 이름

  `Basic` 인증을 사용하여 지정한 `url`에 연결할 때 사용할 사용자 이름입니다. `{{ssm-secure:your-secure-string-parameter}}` 형식을 사용하여 사용자 이름 값에 대한 `SecureString` 파라미터를 참조할 수 있습니다.

  유형: 문자열
+ 암호

  `Basic` 인증을 사용하여 지정한 `url`에 연결할 때 사용할 암호입니다. `{{ssm-secure:your-secure-string-parameter}}` 형식을 사용하여 암호 값에 대한 `SecureString` 파라미터를 참조할 수 있습니다.

  유형: 문자열
 **sourceType `S3`에 대해 다음을 지정합니다.**  
+ path: Amazon S3에서 다운로드할 파일 또는 디렉터리의 URL입니다.
S3 버킷에서 파일을 다운로드할 때 다운로드 디렉터리에 .etag 파일이 생성됩니다.

```
{
    "path": "https://s3.amazonaws.com/amzn-s3-demo-bucket/powershell/helloPowershell.ps1" 
}
```
 **sourceType `SSMDocument`에 대해 다음 중 *하나*를 지정합니다.**  
+ name: 문서의 이름 및 버전입니다. 형식: `name:version`. 버전은 선택 항목입니다.

  ```
  {
      "name": "Example-RunPowerShellScript:3" 
  }
  ```
+ name: 문서에 대한 ARN입니다(`arn:aws:ssm:region:account_id:document/document_name` 형식).

  ```
  {
     "name":"arn:aws:ssm:us-east-2:3344556677:document/MySharedDoc"
  }
  ```

**destinationPath**  
파일을 다운로드하고자 할 때 선택할 수 있는 인스턴스의 로컬 경로 옵션입니다. 경로를 지정하지 않은 경우에는 명령 ID와 관련된 경로에 콘텐츠가 다운로드됩니다.  
유형: 문자열  
필수 여부: 아니요

## `aws:psModule`
<a name="aws-psModule"></a>

Amazon EC2 인스턴스에 PowerShell 모듈을 설치합니다. 이 플러그인은 Windows Server 운영 체제에서만 실행됩니다.

### 구문
<a name="psModule-syntax"></a>

#### 스키마 2.2
<a name="psModule-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:psModule
parameters:
  source:
    description: "(Required) The URL or local path on the instance to the application
      .zip file."
    type: String
mainSteps:
- action: aws:psModule
  name: psModule
  inputs:
    source: "{{ source }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:psModule",
  "parameters": {
    "source": {
      "description": "(Required) The URL or local path on the instance to the application .zip file.",
      "type": "String"
    }
  },
  "mainSteps": [
    {
      "action": "aws:psModule",
      "name": "psModule",
      "inputs": {
        "source": "{{ source }}"
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="domainJoin-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:psModule:
    properties:
    - runCommand: "{{ commands }}"
      source: "{{ source }}"
      sourceHash: "{{ sourceHash }}"
      workingDirectory: "{{ workingDirectory }}"
      timeoutSeconds: "{{ executionTimeout }}"
```

------
#### [ JSON ]

```
{
   "runtimeConfig":{
      "aws:psModule":{
         "properties":[
            {
               "runCommand":"{{ commands }}",
               "source":"{{ source }}",
               "sourceHash":"{{ sourceHash }}",
               "workingDirectory":"{{ workingDirectory }}",
               "timeoutSeconds":"{{ executionTimeout }}"
            }
         ]
      }
   }
}
```

------

### 속성
<a name="psModule-properties"></a>

**runCommand**  
모듈 설치 후 실행될 PowerShell 명령입니다.  
유형: StringList  
필수 여부: 아니요

**source**  
애플리케이션 `.zip` 파일에 대한 URL 또는 인스턴스 상 로컬 경로입니다.  
유형: 문자열  
필수 항목 여부: 예

**sourceHash**  
`.zip` 파일의 SHA256 해시입니다.  
유형: 문자열  
필수 여부: 아니요

**timeoutSeconds**  
명령이 실패로 간주되기 전에 완료되어야 할 시간(초)입니다.  
유형: 문자열  
필수 여부: 아니요

**workingDirectory**  
인스턴스 상의 작업 디렉터리에 대한 경로.  
유형: 문자열  
필수 여부: 아니요

## `aws:refreshAssociation`
<a name="aws-refreshassociation"></a>

(스키마 버전 2.0 이상) 온디맨드로 연결을 새로 고칩니다(강제 적용). 이 작업은 대상에 바운딩된 선택된 연결 또는 모든 연결에서 정의된 대로 시스템 상태를 변경합니다. 이 플러그인은 Linux 및 Microsoft Windows Server 운영 체제에서 실행됩니다.

### 구문
<a name="refreshassociation-syntax"></a>

#### 스키마 2.2
<a name="refreshassociation-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:refreshAssociation
parameters:
  associationIds:
    description: "(Optional) List of association IDs. If empty, all associations bound
      to the specified target are applied."
    type: StringList
mainSteps:
- action: aws:refreshAssociation
  name: refreshAssociation
  inputs:
    associationIds:
    - "{{ associationIds }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:refreshAssociation",
  "parameters": {
    "associationIds": {
      "description": "(Optional) List of association IDs. If empty, all associations bound to the specified target are applied.",
      "type": "StringList"
    }
  },
  "mainSteps": [
    {
      "action": "aws:refreshAssociation",
      "name": "refreshAssociation",
      "inputs": {
        "associationIds": [
          "{{ associationIds }}"
        ]
      }
    }
  ]
}
```

------

### 입력
<a name="refreshassociation-properties"></a>

**associationIds**  
연결 ID의 목록입니다. 비어 있을 경우, 지정된 대상에 바인딩된 모든 연결이 적용됩니다.  
유형: StringList  
필수 여부: 아니요

## `aws:runDockerAction`
<a name="aws-rundockeraction"></a>

(스키마 버전 2.0 이상) 컨테이너에서 도커 작업을 실행합니다. 이 플러그인은 Linux 및 Microsoft Windows Server 운영 체제에서 실행됩니다.

### 구문
<a name="rundockeraction-syntax"></a>

#### 스키마 2.2
<a name="rundockeraction-syntax-2.2"></a>

------
#### [ YAML ]

```
---
mainSteps:
- action: aws:runDockerAction
  name: RunDockerAction
  inputs:
    action: "{{ action }}"
    container: "{{ container }}"
    image: "{{ image }}"
    memory: "{{ memory }}"
    cpuShares: "{{ cpuShares }}"
    volume: "{{ volume }}"
    cmd: "{{ cmd }}"
    env: "{{ env }}"
    user: "{{ user }}"
    publish: "{{ publish }}"
    workingDirectory: "{{ workingDirectory }}"
    timeoutSeconds: "{{ timeoutSeconds }}"
```

------
#### [ JSON ]

```
{
   "mainSteps":[
      {
         "action":"aws:runDockerAction",
         "name":"RunDockerAction",
         "inputs":{
            "action":"{{ action }}",
            "container":"{{ container }}",
            "image":"{{ image }}",
            "memory":"{{ memory }}",
            "cpuShares":"{{ cpuShares }}",
            "volume":"{{ volume }}",
            "cmd":"{{ cmd }}",
            "env":"{{ env }}",
            "user":"{{ user }}",
            "publish":"{{ publish }}",
            "workingDirectory": "{{ workingDirectory }}",
            "timeoutSeconds": "{{ timeoutSeconds }}"
         }
      }
   ]
}
```

------

### 입력
<a name="rundockeraction-properties"></a>

**작업**  
수행할 작업의 유형입니다.  
유형: 문자열  
필수 항목 여부: 예

**컨테이너**  
도커 컨테이너 ID입니다.  
유형: 문자열  
필수 여부: 아니요

**image**  
도커 이미지 이름입니다.  
유형: 문자열  
필수 여부: 아니요

**cmd**  
컨테이너 명령입니다.  
유형: 문자열  
필수 여부: 아니요

**메모리**  
컨테이너 메모리 제한입니다.  
유형: 문자열  
필수 여부: 아니요

**cpuShares**  
컨테이너 CPU 공유입니다(상대 가중치).  
유형: 문자열  
필수 여부: 아니요

**볼륨**  
컨테이너 볼륨 마운트입니다.  
유형: StringList  
필수 여부: 아니요

**env**  
컨테이너 환경 변수입니다.  
유형: 문자열  
필수 여부: 아니요

**user**  
컨테이너 사용자 이름입니다.  
유형: 문자열  
Required: No

**게시**  
컨테이너 게시 포트입니다.  
유형: 문자열  
필수 여부: 아니요

**workingDirectory**  
관리형 노드의 작업 디렉터리 경로.  
유형: 문자열  
필수 여부: 아니요

**timeoutSeconds**  
명령이 실패로 간주되기 전에 완료되어야 할 시간(초)입니다.  
유형: 문자열  
필수 여부: 아니요

## `aws:runDocument`
<a name="aws-rundocument"></a>

(스키마 버전 2.0 이상) Systems Manager 또는 로컬 공유에 저장된 SSM 문서를 실행합니다. 이 플러그인을 [`aws:downloadContent`](#aws-downloadContent) 플러그인과 함께 사용하면 원격 위치에서 로컬 공유로 SSM 문서를 다운로드하여 실행할 수 있습니다. 이 플러그인은 Linux 및 Windows Server 운영 체제에서 지원됩니다. 이 플러그인은 `aws:updateSsmAgent` 플러그 인을 사용하는 `AWS-UpdateSSMAgent` 문서 또는 다른 문서 실행을 지원하지 않습니다.

### 구문
<a name="rundocument-syntax"></a>

#### 스키마 2.2
<a name="aws-rundocument-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:runDocument
parameters:
  documentType:
    description: "(Required) The document type to run."
    type: String
    allowedValues:
    - LocalPath
    - SSMDocument
mainSteps:
- action: aws:runDocument
  name: runDocument
  inputs:
    documentType: "{{ documentType }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:runDocument",
  "parameters": {
    "documentType": {
      "description": "(Required) The document type to run.",
      "type": "String",
      "allowedValues": [
        "LocalPath",
        "SSMDocument"
      ]
    }
  },
  "mainSteps": [
    {
      "action": "aws:runDocument",
      "name": "runDocument",
      "inputs": {
        "documentType": "{{ documentType }}"
      }
    }
  ]
}
```

------

### 입력
<a name="rundocument-properties"></a>

**documentType**  
실행할 문서 유형입니다. 로컬 문서(`LocalPath`) 또는 Systems Manager에 저장된 문서(`SSMDocument`)를 실행할 수 있습니다.  
유형: 문자열  
필수 항목 여부: 예

**documentPath**  
문서에 대한 경로입니다. `documentType`이 `LocalPath`일 경우, 로컬 공유에 저장된 문서에 대한 경로를 지정합니다. `documentType`이 `SSMDocument`일 경우, 문서의 이름을 지정합니다.  
유형: 문자열  
필수 여부: 아니요

**documentParameters**  
문서에 대한 파라미터입니다.  
유형: StringMap  
필수 여부: 아니요

## `aws:runPowerShellScript`
<a name="aws-runPowerShellScript"></a>

PowerShell 스크립트를 실행하거나 실행할 스크립트에 대한 경로를 지정합니다. 이 플러그인은 Microsoft Windows Server 및 Linux 운영 체제에서 실행됩니다.

### 구문
<a name="runPowerShellScript-syntax"></a>

#### 스키마 2.2
<a name="runPowerShellScript-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:runPowerShellScript
parameters:
  commands:
    type: String
    description: "(Required) The commands to run or the path to an existing script
      on the instance."
    default: Write-Host "Hello World"
mainSteps:
- action: aws:runPowerShellScript
  name: runPowerShellScript
  inputs:
    timeoutSeconds: '60'
    runCommand:
    - "{{ commands }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:runPowerShellScript",
  "parameters": {
    "commands": {
      "type": "String",
      "description": "(Required) The commands to run or the path to an existing script on the instance.",
      "default": "Write-Host \"Hello World\""
    }
  },
  "mainSteps": [
    {
      "action": "aws:runPowerShellScript",
      "name": "runPowerShellScript",
      "inputs": {
        "timeoutSeconds": "60",
        "runCommand": [
          "{{ commands }}"
        ]
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="runPowerShellScript-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:runPowerShellScript:
    properties:
    - id: 0.aws:runPowerShellScript
      runCommand: "{{ commands }}"
      workingDirectory: "{{ workingDirectory }}"
      timeoutSeconds: "{{ executionTimeout }}"
```

------
#### [ JSON ]

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

------

### 속성
<a name="runPowerShellScript-properties"></a>

**runCommand**  
실행할 명령 또는 인스턴스의 기존 스크립트에 대한 경로를 지정합니다.  
유형: StringList  
필수 여부: 예

**timeoutSeconds**  
명령이 실패로 간주되기 전에 완료되어야 할 시간(초)입니다. 시간 제한에 도달하면 Systems Manager가 명령 실행을 멈춥니다.  
유형: 문자열  
필수 여부: 아니요

**workingDirectory**  
인스턴스 상의 작업 디렉터리에 대한 경로.  
유형: 문자열  
필수 여부: 아니요

## `aws:runShellScript`
<a name="aws-runShellScript"></a>

Linux 셸 스크립트를 실행하거나 실행할 스크립트에 대한 경로를 지정합니다. 이 플러그인은 Linux 운영 체제에서만 실행됩니다.

### 구문
<a name="runShellScript-syntax"></a>

#### 스키마 2.2
<a name="runShellScript-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:runShellScript
parameters:
  commands:
    type: String
    description: "(Required) The commands to run or the path to an existing script
      on the instance."
    default: echo Hello World
mainSteps:
- action: aws:runShellScript
  name: runShellScript
  inputs:
    timeoutSeconds: '60'
    runCommand:
    - "{{ commands }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:runShellScript",
  "parameters": {
    "commands": {
      "type": "String",
      "description": "(Required) The commands to run or the path to an existing script on the instance.",
      "default": "echo Hello World"
    }
  },
  "mainSteps": [
    {
      "action": "aws:runShellScript",
      "name": "runShellScript",
      "inputs": {
        "timeoutSeconds": "60",
        "runCommand": [
          "{{ commands }}"
        ]
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="runShellScript-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:runShellScript:
    properties:
    - runCommand: "{{ commands }}"
      workingDirectory: "{{ workingDirectory }}"
      timeoutSeconds: "{{ executionTimeout }}"
```

------
#### [ JSON ]

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

------

### 속성
<a name="runShellScript-properties"></a>

**runCommand**  
실행할 명령 또는 인스턴스의 기존 스크립트에 대한 경로를 지정합니다.  
유형: StringList  
필수 여부: 예

**timeoutSeconds**  
명령이 실패로 간주되기 전에 완료되어야 할 시간(초)입니다. 시간 제한에 도달하면 Systems Manager가 명령 실행을 멈춥니다.  
유형: 문자열  
필수 여부: 아니요

**workingDirectory**  
인스턴스 상의 작업 디렉터리에 대한 경로.  
유형: 문자열  
필수 여부: 아니요

## `aws:softwareInventory`
<a name="aws-softwareinventory"></a>

(스키마 버전 2.0 이상) 관리형 인스턴스의 애플리케이션, 파일 및 구성에 대한 메타데이터를 수집합니다. 이 플러그인은 Linux 및 Microsoft Windows Server 운영 체제에서 실행됩니다. 인벤토리 수집을 구성할 때 AWS Systems Manager State Manager 연결을 생성하는 것으로 시작합니다. Systems Manager는 연결이 실행될 때 인벤토리 데이터를 수집합니다. 연결을 먼저 생성하지 않고 `aws:softwareInventory` 플러그인을 호출하려고 하면 시스템이 다음 오류를 반환합니다.

```
The aws:softwareInventory plugin can only be invoked via ssm-associate.
```

인스턴스에는 한 번에 하나의 인벤토리 연결만 구성할 수 있습니다. 둘 이상의 연결로 인스턴스를 구성할 경우 인벤토리 연결이 실행되지 않으며 인벤토리 데이터가 수집되지 않습니다. 인벤토리 수집에 대한 자세한 내용은 [AWS Systems Manager Inventory](systems-manager-inventory.md) 섹션을 참조하세요.

### 구문
<a name="softwareinventory-syntax"></a>

#### 스키마 2.2
<a name="softwareinventory-syntax-2.2"></a>

------
#### [ YAML ]

```
---
mainSteps:
- action: aws:softwareInventory
  name: collectSoftwareInventoryItems
  inputs:
    applications: "{{ applications }}"
    awsComponents: "{{ awsComponents }}"
    networkConfig: "{{ networkConfig }}"
    files: "{{ files }}"
    services: "{{ services }}"
    windowsRoles: "{{ windowsRoles }}"
    windowsRegistry: "{{ windowsRegistry}}"
    windowsUpdates: "{{ windowsUpdates }}"
    instanceDetailedInformation: "{{ instanceDetailedInformation }}"
    customInventory: "{{ customInventory }}"
```

------
#### [ JSON ]

```
{
   "mainSteps":[
      {
         "action":"aws:softwareInventory",
         "name":"collectSoftwareInventoryItems",
         "inputs":{
            "applications":"{{ applications }}",
            "awsComponents":"{{ awsComponents }}",
            "networkConfig":"{{ networkConfig }}",
            "files":"{{ files }}",
            "services":"{{ services }}",
            "windowsRoles":"{{ windowsRoles }}",
            "windowsRegistry":"{{ windowsRegistry}}",
            "windowsUpdates":"{{ windowsUpdates }}",
            "instanceDetailedInformation":"{{ instanceDetailedInformation }}",
            "customInventory":"{{ customInventory }}"
         }
      }
   ]
}
```

------

### 입력
<a name="softwareinventory-properties"></a>

**애플리케이션**  
(선택 사항) 설치한 애플리케이션에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**awsComponents**  
(옵션) amazon-ssm-agent 같은 AWS 구성 요소의 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**files**  
(옵션, SSM Agent 버전 2.2.64.0 이상 필요) 몇 가지 예를 들자면 파일 이름, 파일 생성 시각, 파일을 마지막으로 수정하고 액세스한 시간, 파일 크기 등 파일에 관한 메타데이터 정보를 수집합니다. 파일 인벤토리 수집에 대한 자세한 내용은 [파일 및 Windows 레지스트리 인벤토리 관련 작업](inventory-file-and-registry.md) 섹션을 참조하세요.  
유형: 문자열  
필수 여부: 아니요

**networkConfig**  
(선택 사항) 네트워크 구성에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**billingInfo**  
(선택 사항) AMI의 청구 코드와 연결된 플랫폼 세부 정보에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**windowsUpdates**  
(선택 사항) 모든 Windows 업데이트에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**InstanceDetailedInformation**  
(옵션) CPU 모델, 속도, 코어 수를 포함하여 기본 인벤토리 플러그인(`aws:instanceInformation`)에서 제공하는 것 이외의 인스턴스 정보를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**서비스**  
(옵션, Windows OS에만 해당, SSM Agent 버전 2.2.64.0 이상 필요) 서비스 구성에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**windowsRegistry**  
(옵션, Windows OS에만 해당, SSM Agent 버전 2.2.64.0 이상 필요) Windows 레지스트리 키 및 값을 수집합니다. 키 경로를 선택하고 모든 키와 값을 반복적으로 수집할 수 있습니다. 특정 경로에 대해 특정 레지스트리 키와 그 값을 수집할 수도 있습니다. 인벤토리는 키 경로, 이름 및 값을 수집합니다. Windows 레지스트리 인벤토리를 수집하는 방법에 대한 자세한 내용은 [파일 및 Windows 레지스트리 인벤토리 관련 작업](inventory-file-and-registry.md) 섹션을 참조하세요.  
유형: 문자열  
필수 여부: 아니요

**windowsRoles**  
(옵션, Windows OS에만 해당, SSM Agent 버전 2.2.64.0 이상 필요) Microsoft Windows 역할 구성에 대한 메타데이터를 수집합니다.  
유형: 문자열  
필수 여부: 아니요

**customInventory**  
(선택 사항) 사용자 지정 인벤토리 데이터를 수집합니다. 사용자 정의 인벤토리에 대한 자세한 내용은 [사용자 정의 인벤토리 작업](inventory-custom.md) 섹션을 참조하세요.  
유형: 문자열  
필수 여부: 아니요

**customInventoryDirectory**  
(선택 사항) 지정된 디렉터리에서 사용자 지정 인벤토리 데이터를 수집합니다. 사용자 정의 인벤토리에 대한 자세한 내용은 [사용자 정의 인벤토리 작업](inventory-custom.md) 섹션을 참조하세요.  
유형: 문자열  
필수 여부: 아니요

## `aws:updateAgent`
<a name="aws-updateagent"></a>

EC2Config 서비스를 최신 버전으로 업데이트하거나 이전 버전을 지정합니다. 이 플러그인은 Microsoft Windows Server 운영 체제에서만 실행됩니다. EC2Config 서비스에 대한 자세한 내용은 *Amazon EC2 사용 설명서*의 [EC2Config 서비스(레거시)를 사용하여 Windows 인스턴스 구성](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2config-service.html)을 참조하세요.

### 구문
<a name="updateagent-syntax"></a>

#### 스키마 2.2
<a name="updateagent-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:updateAgent
mainSteps:
- action: aws:updateAgent
  name: updateAgent
  inputs:
    agentName: Ec2Config
    source: https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:updateAgent",
  "mainSteps": [
    {
      "action": "aws:updateAgent",
      "name": "updateAgent",
      "inputs": {
        "agentName": "Ec2Config",
        "source": "https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json"
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="updateagent-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:updateAgent:
    properties:
      agentName: Ec2Config
      source: https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json
      allowDowngrade: "{{ allowDowngrade }}"
      targetVersion: "{{ version }}"
```

------
#### [ JSON ]

```
{
   "runtimeConfig":{
      "aws:updateAgent":{
         "properties":{
            "agentName":"Ec2Config",
            "source":"https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json",
            "allowDowngrade":"{{ allowDowngrade }}",
            "targetVersion":"{{ version }}"
         }
      }
   }
}
```

------

### 속성
<a name="updateagent-properties"></a>

**agentName**  
EC2Config. 이것은 EC2Config 서비스를 실행하는 에이전트의 이름입니다.  
유형: 문자열  
필수 항목 여부: 예

**allowDowngrade**  
EC2Config 서비스를 이전 버전으로 다운그레이드할 수 있게 허용합니다. false로 설정할 경우, 서비스가 새 버전으로 업그레이드만 될 수 있습니다(기본값). true로 설정하는 경우, 이전 버전을 지정합니다.  
유형: 부울  
필수 여부: 아니요

**source**  
Systems Manager가 설치할 EC2Config의 버전을 복사하는 위치입니다. 이 위치는 변경할 수 없습니다.  
유형: 문자열  
필수 항목 여부: 예

**targetVersion**  
설치할 EC2Config 서비스의 특정 버전입니다. 버전을 지정하지 않으면 서비스는 최신 버전으로 업데이트됩니다.  
유형: 문자열  
필수 여부: 아니요

## `aws:updateSsmAgent`
<a name="aws-updatessmagent"></a>

SSM Agent를 최신 버전으로 업데이트하거나 이전 버전을 지정합니다. 이 플러그인은 Linux 및 Windows Server 운영 체제에서 실행됩니다. 자세한 내용은 [SSM Agent 작업](ssm-agent.md) 섹션을 참조하세요.

### 구문
<a name="updateSSMagent-syntax"></a>

#### 스키마 2.2
<a name="updateaSSMgent-syntax-2.2"></a>

------
#### [ YAML ]

```
---
schemaVersion: '2.2'
description: aws:updateSsmAgent
parameters:
  allowDowngrade:
    default: 'false'
    description: "(Optional) Allow the Amazon SSM Agent service to be downgraded to
      an earlier version. If set to false, the service can be upgraded to newer versions
      only (default). If set to true, specify the earlier version."
    type: String
    allowedValues:
    - 'true'
    - 'false'
mainSteps:
- action: aws:updateSsmAgent
  name: updateSSMAgent
  inputs:
    agentName: amazon-ssm-agent
    source: https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json
    allowDowngrade: "{{ allowDowngrade }}"
```

------
#### [ JSON ]

```
{
  "schemaVersion": "2.2",
  "description": "aws:updateSsmAgent",
  "parameters": {
    "allowDowngrade": {
      "default": "false",
      "description": "(Required) Allow the Amazon SSM Agent service to be downgraded to an earlier version. If set to false, the service can be upgraded to newer versions only (default). If set to true, specify the earlier version.",
      "type": "String",
      "allowedValues": [
        "true",
        "false"
      ]
    }
  },
  "mainSteps": [
    {
      "action": "aws:updateSsmAgent",
      "name": "awsupdateSsmAgent",
      "inputs": {
        "agentName": "amazon-ssm-agent",
        "source": "https://s3.{Region}.amazonaws.com/amazon-ssm-{Region}/ssm-agent-manifest.json",
        "allowDowngrade": "{{ allowDowngrade }}"
      }
    }
  ]
}
```

------

#### 스키마 1.2
<a name="updateaSSMgent-syntax-1.2"></a>

------
#### [ YAML ]

```
---
runtimeConfig:
  aws:updateSsmAgent:
    properties:
    - agentName: amazon-ssm-agent
      source: https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json
      allowDowngrade: "{{ allowDowngrade }}"
```

------
#### [ JSON ]

```
{
   "runtimeConfig":{
      "aws:updateSsmAgent":{
         "properties":[
            {
               "agentName":"amazon-ssm-agent",
               "source":"https://s3.{Region}.amazonaws.com/aws-ssm-{Region}/manifest.json",
               "allowDowngrade":"{{ allowDowngrade }}"
            }
         ]
      }
   }
}
```

------

### 속성
<a name="updateSSMagent-properties"></a>

**agentName**  
amazon-ssm-agent. 요청을 처리하고 인스턴스에서 명령을 실행하는 Systems Manager Agent의 이름입니다.  
유형: 문자열  
필수 항목 여부: 예

**allowDowngrade**  
SSM Agent를 이전 버전으로 다운그레이드할 수 있게 허용합니다. false로 설정할 경우, 에이전트가 새 버전으로 업그레이드만 될 수 있습니다(기본값). true로 설정하는 경우, 이전 버전을 지정합니다.  
유형: Boolean  
필수 여부: 예

**source**  
Systems Manager가 설치할 SSM Agent 버전을 복사하는 위치입니다. 이 위치는 변경할 수 없습니다.  
유형: 문자열  
필수 항목 여부: 예

**targetVersion**  
설치할 SSM Agent의 특정 버전입니다. 버전을 지정하지 않으면 에이전트는 최신 버전으로 업데이트됩니다.  
유형: 문자열  
필수 여부: 아니요

# SSM 문서 콘텐츠 생성
<a name="documents-creating-content"></a>

AWS Systems Manager 퍼블릭 문서가 AWS 리소스에서 수행하려는 모든 작업을 수행하지 않는 경우 자체 SSM 문서를 생성할 수 있습니다. 콘솔을 사용하여 SSM 문서를 복제할 수도 있습니다. 문서를 복제하면 기존 문서의 내용이 수정 가능한 새 문서로 복사됩니다. 문서를 생성하거나 복제할 경우, 문서의 콘텐츠는 64KB를 초과할 수 없습니다. 이 할당량에는 런타임 시 입력 파라미터에 지정된 콘텐츠도 포함됩니다. 새 `Policy` 또는 `Command` 문서를 생성할 때는 문서 편집, 자동 버전 관리, 시퀀싱 등과 같은 최신 기능을 활용할 수 있도록 스키마 버전 2.2 이상을 사용하는 것이 좋습니다.

## SSM 문서 콘텐츠 작성
<a name="writing-ssm-doc-content"></a>

사용자 고유의 SSM 문서 콘텐츠를 생성하려면 SSM 문서에 사용할 수 있는 다양한 스키마, 기능, 플러그인 및 구문을 이해하는 것이 중요합니다. 다음 리소스를 숙지하는 것이 좋습니다.
+  [나만의 AWS Systems Manager 문서 작성](https://aws.amazon.com/blogs//mt/writing-your-own-aws-systems-manager-documents/) 
+  [데이터 요소 및 파마미터](documents-syntax-data-elements-parameters.md) 
+  [스키마, 특성 및 예제](documents-schemas-features.md) 
+  [Command 문서 플러그인 참조](documents-command-ssm-plugin-reference.md) 
+  [Systems Manager Automation 작업 참조](automation-actions.md) 
+  [Automation 시스템 변수](automation-variables.md) 
+  [추가 런북 예제](automation-document-examples.md) 
+  AWS Toolkit for Visual Studio Code를 사용하여 [Systems Manager Automation 실행서로 작업](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/systems-manager-automation-docs.html) 
+  [Automation 런북의 시각적 디자인 경험](automation-visual-designer.md) 
+  [런북에서 스크립트 사용](automation-document-script-considerations.md) 

사전 정의된 AWS SSM 문서는 필요한 일부 작업을 수행할 수 있습니다. 문서 유형에 따라 사용자 정의 SSM 문서 내에서 `aws:runDocument`, `aws:runCommand` 또는 `aws:executeAutomation` 플러그인을 사용하여 이러한 문서를 호출할 수 있습니다. 이러한 문서의 일부를 사용자 정의 SSM 문서로 복사하고 요구 사항에 맞게 콘텐츠를 편집할 수도 있습니다.

**작은 정보**  
SSM 문서 콘텐츠를 생성할 때 테스트하는 동안 SSM 문서의 콘텐츠를 변경하고 여러 번 업데이트할 수 있습니다. 다음 명령은 최신 콘텐츠로 SSM 문서를 업데이트하고 문서의 기본 버전을 최신 버전의 문서로 업데이트합니다.  
Linux 및 Windows 명령은 `jq` 명령줄 도구를 사용하여 JSON 응답 데이터를 필터링합니다.

```
latestDocVersion=$(aws ssm update-document \
    --content file://path/to/file/documentContent.json \
    --name "ExampleDocument" \
    --document-format JSON \
    --document-version '$LATEST' \
    | jq -r '.DocumentDescription.LatestVersion')

aws ssm update-document-default-version \
    --name "ExampleDocument" \
    --document-version $latestDocVersion
```

```
latestDocVersion=$(aws ssm update-document ^
    --content file://C:\path\to\file\documentContent.json ^
    --name "ExampleDocument" ^
    --document-format JSON ^
    --document-version "$LATEST" ^
    | jq -r '.DocumentDescription.LatestVersion')

aws ssm update-document-default-version ^
    --name "ExampleDocument" ^
    --document-version $latestDocVersion
```

```
$content = Get-Content -Path "C:\path\to\file\documentContent.json" | Out-String
$latestDocVersion = Update-SSMDocument `
    -Content $content `
    -Name "ExampleDocument" `
    -DocumentFormat "JSON" `
    -DocumentVersion '$LATEST' `
    | Select-Object -ExpandProperty LatestVersion

Update-SSMDocumentDefaultVersion `
    -Name "ExampleDocument" `
    -DocumentVersion $latestDocVersion
```

### SSM 문서에 대한 보안 모범 사례
<a name="ssm-document-security-practices"></a>

SSM 문서를 생성할 때 다음 보안 모범 사례를 따르면 명령 주입을 방지하고 안전한 파라미터 처리를 보장하는 데 도움이 됩니다.
+ 명령 또는 스크립트에 사용할 문자열 파라미터에 환경 변수 보간을 사용합니다. 문자열 파라미터에 값이 `ENV_VAR`인 `interpolationType` 속성을 추가합니다.

  ```
  {
      "command": {
          "type": "String",
          "description": "Command to execute",
          "interpolationType": "ENV_VAR"
      }
  }
  ```

  보간으로 전달되는 값에서 큰따옴표가 허용되지 않도록 지정하여 SSM 문서의 보안을 더욱 강화할 수 있습니다.

  ```
  {
      "command": {
          "type": "String",
          "description": "Command to execute",
          "interpolationType": "ENV_VAR",
              "allowedPattern": "^[^"]*$"
      }
  }
  ```
+ Python, Ruby, Node.js와 같은 해석된 언어를 사용하는 경우 적절한 환경 변수 구문을 사용하여 파라미터를 참조합니다.

  ```
  # Python example
  import os
  command = os.environ['SSM_Message']
  ```
+ 이전 SSM Agent 버전(3.3.2746.0 이전)과의 하위 버전 호환성을 위해 환경 변수에 대한 대체 로직을 포함합니다.

  ```
  if [ -z "${SSM_command+x}" ]; then
      export SSM_command="{{command}}"
  fi
  ```
+ 추가 입력 검증을 위해 환경 변수 보간을 `allowedPattern`과 결합합니다. 다음 예제에서 `allowedPattern` 값 `^[^"]*$`는 구체적으로 문자열 값의 큰따옴표를 방지합니다.

  ```
  {
      "command": {
          "type": "String",
          "interpolationType": "ENV_VAR",
          "allowedPattern": "^[a-zA-Z0-9_-]+$"
      }
  }
  ```
+ SSM 문서를 구현하기 전에 다음 보안 고려 사항을 확인합니다.
  + 사용자 입력을 수락하는 모든 문자열 파라미터가 적절한 경우 환경 변수 보간을 사용합니다.
  + 입력 검증이 가능한 경우 `allowedPattern`을 사용하여 구현됩니다.
  + 문서에 파라미터 처리를 위한 적절한 오류 처리가 포함되어 있습니다.
  + 이전 SSM Agent 버전을 사용하는 환경에서는 하위 버전 호환성이 유지됩니다.

Systems Manager가 액세스하는 AWS 서비스 소유 리소스와 데이터 경계 정책을 구성하는 방법에 대한 자세한 내용은 [AWS Systems Manager의 데이터 경계](data-perimeters.md) 섹션을 참조하세요.

## SSM 문서 복제
<a name="cloning-ssm-document"></a>

Systems Manager Documents 콘솔을 사용하여 AWS Systems Manager 문서를 복제하여 SSM 문서를 생성할 수 있습니다. SSM 문서를 복제하면 기존 문서의 내용이 수정 가능한 새 문서로 복사됩니다. 64KB보다 큰 문서는 복제할 수 없습니다.

**SSM 문서를 복제하려면**

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

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

1. 검색 상자에 복제하려는 문서의 이름을 입력합니다.

1. 복제할 문서의 이름을 선택한 다음 [**작업(Actions)**] 드롭다운에서 [**문서 복제(Clone document)**]를 선택합니다.

1. 원하는 대로 문서를 수정한 다음 [**문서 생성(Create document)**]을 선택하여 문서를 저장합니다.

다음 방법 중 하나를 통해 SSM 문서 콘텐츠를 작성한 후 해당 콘텐츠를 사용하는 SSM 문서를 생성할 수 있습니다.

**Topics**
+ [SSM 문서 콘텐츠 작성](#writing-ssm-doc-content)
+ [SSM 문서 복제](#cloning-ssm-document)
+ [복합 문서 생성](#documents-creating-composite)

## 복합 문서 생성
<a name="documents-creating-composite"></a>

*복합* AWS Systems Manager(SSM) 문서는 하나 이상의 보조 SSM 문서를 실행하여 일련의 작업을 수행하는 사용자 정의 문서입니다. 복합 문서는 부트스트랩 소프트웨어 또는 도메인 조인 인스턴스와 같은 일반적인 태스크에 대한 표준 SSM 문서 집합을 생성할 수 있도록 하여 *코드형 인프라*를 승격합니다. 그러면 이들 문서를 동일한 AWS 리전에서 AWS 계정 간에 공유하여 SSM 문서 유지 관리를 줄이고 일관성을 보장할 수 있습니다.

예를 들어 다음 작업을 수행하는 복합 문서를 생성할 수 있습니다.

1. 허용 목록에 모든 패치를 설치합니다.

1. 안티바이러스 소프트웨어를 설치

1. GitHub에서 스크립트를 다운로드하고 실행합니다.

이 예에서는 사용자 정의 SSM 문서가 이러한 작업을 수행하기 위해 다음과 같은 플러그인을 포함합니다.

1. `aws:runDocument` 플러그인은 나열된 모든 허용 패치를 설치하는 `AWS-RunPatchBaseline` 문서를 실행합니다.

1. 안티바이러스 소프트웨어를 설치하는 `AWS-InstallApplication` 문서를 실행하기 위한 `aws:runDocument` 플러그인.

1. `aws:downloadContent` 플러그인은 GitHub에서 스크립트를 다운로드하고 실행합니다.

복합 및 보조 문서는 Systems Manager, GitHub(퍼블릭 및 프라이빗 리포지토리) 또는 Amazon S3에 저장할 수 있습니다. 복합 문서 및 보조 문서는 JSON 또는 YAML으로 생성할 수 있습니다.

**참고**  
복합 문서는 최대 3개 문서 깊이까지만 실행될 수 있습니다. 즉, 복합 문서가 하위 문서 하나를 호출하고, 이 하위 문서가 마지막 문서를 호출할 수 있습니다.

복합 문서를 생성하려면 사용자 정의 SSM 문서에서 [`aws:runDocument`](documents-command-ssm-plugin-reference.md#aws-rundocument) 플러그인을 추가하고 필요한 입력을 지정합니다. 다음은 다음 작업을 수행하는 복합 문서의 예입니다.

1. [`aws:downloadContent`](documents-command-ssm-plugin-reference.md#aws-downloadContent) 플러그인을 실행하여 GitHub 퍼블릭 리포지토리에서 SSM 문서를 부트스트랩이라고 하는 로컬 디렉터리로 다운로드합니다. SSM 문서는 StateManagerBootstrap.yml이라고 합니다(YAML 문서).

1. `aws:runDocument` 플러그인을 실행하여 StateManagerBootstrap.yml 문서를 실행합니다. 파라미터는 지정하지 않습니다.

1. `aws:runDocument` 플러그인을 실행하여 `AWS-ConfigureDocker pre-defined` SSM 문서를 실행합니다. 지정된 파라미터가 인스턴스에 도커를 설치합니다.

```
{
  "schemaVersion": "2.2",
  "description": "My composite document for bootstrapping software and installing Docker.",
  "parameters": {
  },
  "mainSteps": [
    {
      "action": "aws:downloadContent",
      "name": "downloadContent",
      "inputs": {
        "sourceType": "GitHub",
        "sourceInfo": "{\"owner\":\"TestUser1\",\"repository\":\"TestPublic\", \"path\":\"documents/bootstrap/StateManagerBootstrap.yml\"}",
        "destinationPath": "bootstrap"
      }
    },
    {
      "action": "aws:runDocument",
      "name": "runDocument",
      "inputs": {
        "documentType": "LocalPath",
        "documentPath": "bootstrap",
        "documentParameters": "{}"
      }
    },
    {
      "action": "aws:runDocument",
      "name": "configureDocker",
      "inputs": {
        "documentType": "SSMDocument",
        "documentPath": "AWS-ConfigureDocker",
        "documentParameters": "{\"action\":\"Install\"}"
      }
    }
  ]
}
```

**추가 정보**  
+ Run Command를 사용할 때 서버와 인스턴스를 재부팅하여 스크립트를 호출하는 방법은 [명령 실행 시 재부팅 처리](send-commands-reboot.md) 섹션을 참조하세요.
+ 사용자 정의 SSM 문서에 추가할 수 있는 플러그인에 대한 자세한 내용은 [Command 문서 플러그인 참조](documents-command-ssm-plugin-reference.md) 섹션을 참조하세요.
+ (복합 문서를 생성하지 않고) 원격 위치에서 문서를 실행하려는 경우, [원격 위치에서 문서 실행](documents-running-remote-github-s3.md) 섹션을 참조하세요.

# 문서 작업
<a name="documents-using"></a>

이 섹션에는 SSM 문서 사용 및 작업 방법에 대한 정보가 포함되어 있습니다.

**Topics**
+ [SSM 문서 버전 비교](comparing-versions.md)
+ [SSM 문서 생성](create-ssm-console.md)
+ [사용자 지정 SSM 문서 삭제 중](deleting-documents.md)
+ [원격 위치에서 문서 실행](documents-running-remote-github-s3.md)
+ [SSM 문서 공유](documents-ssm-sharing.md)
+ [SSM 문서 검색](ssm-documents-searching.md)

# SSM 문서 버전 비교
<a name="comparing-versions"></a>

Systems Manager Documents 콘솔에서 AWS Systems Manager(SSM) 문서 버전 간의 내용 차이를 비교할 수 있습니다. SSM 문서의 버전을 비교할 때 버전 내용 간의 차이가 강조 표시됩니다.

**SSM 문서 내용을 비교하려면(콘솔)**

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

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

1. 문서 목록에서 내용을 비교하려는 문서를 선택합니다.

1. [**콘텐츠(Content)**] 탭에서 [**버전 비교(Compare versions)**]를 선택하고 콘텐츠를 비교하려는 문서의 버전을 선택합니다.

# SSM 문서 생성
<a name="create-ssm-console"></a>

[SSM 문서 콘텐츠 작성](documents-creating-content.md#writing-ssm-doc-content) 섹션에 설명된 대로 사용자 정의 SSM 문서에 대한 콘텐츠를 생성한 후 Systems Manager 콘솔을 통해 콘텐츠를 사용하는 SSM 문서를 생성할 수 있습니다.

**SSM 문서를 생성하는 방법**

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

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

1. **명령 또는 세션 생성**을 선택합니다.

1. 문서에 대한 서술 이름을 입력합니다.

1. (선택 사항) **Target type(대상 유형)**에는 문서를 실행할 수 있는 리소스 유형을 지정합니다.

1. **문서 유형** 목록에서 생성할 문서의 유형을 선택합니다.

1. **콘텐츠** 필드에서 괄호를 삭제한 후 앞서 생성한 문서 콘텐츠를 붙여 넣습니다.

1. (선택 사항) **Document tags(문서 태그)** 섹션에서 문서에 적용할 하나 이상의 태그 키 이름/값 페어를 입력합니다.

   태그는 리소스에 할당하는 선택적 메타데이터입니다. 태그를 사용하면 용도, 소유자 또는 환경을 기준으로 하는 등 리소스를 다양한 방식으로 분류할 수 있습니다. 예를 들어 문서에 태그를 지정하여 실행하는 작업 유형, 대상 운영 체제 유형 및 실행 환경을 식별할 수 있습니다. 다음 키 이름/값 페어를 지정할 수 있습니다.
   + `Key=TaskType,Value=MyConfigurationUpdate`
   + `Key=OS,Value=AMAZON_LINUX_2`
   + `Key=Environment,Value=Production`

1. **문서 생성**을 선택하여 문서를 저장합니다.

# 사용자 지정 SSM 문서 삭제 중
<a name="deleting-documents"></a>

사용자 지정 SSM 문서를 더 이상 사용하지 않으려는 경우 AWS Systems Manager 콘솔을 사용하여 삭제할 수 있습니다.

**SSM 문서를 삭제하는 방법**

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

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

1. 삭제할 문서를 선택합니다.

1. **삭제(Delete)**를 선택합니다. 문서를 삭제할 것인지 묻는 메시지가 나타나면 **삭제(Delete)**를 선택합니다.

명령줄 도구 또는 SDK를 사용여 SSM 문서를 삭제하는 예제는 [AWS SDK 또는 CLI와 함께 `DeleteDocument` 사용](example_ssm_DeleteDocument_section.md) 섹션을 참조하세요.

# 원격 위치에서 문서 실행
<a name="documents-running-remote-github-s3"></a>

`AWS-RunDocument` 사전 정의 AWS Systems Manager(SSM) 문서를 사용하면 원격 위치로부터 SSM 문서를 실행할 수 있습니다. 이 문서는 다음 위치에 저장된 SSM 문서 실행을 지원합니다.
+ 퍼블릭 및 프라이빗 GitHub 리포지토리(GitHub Enterprise는 지원되지 않음)
+ Amazon S3 버킷
+ Systems Manager

AWS Systems Manager의 도구인 State Manager 또는 Automation을 사용하여 원격 문서를 실행할 수도 있지만 다음 절차에서는 Systems Manager 콘솔에서 AWS Systems Manager Run Command를 사용하여 원격 SSM 문서를 실행하는 방법만 설명합니다.

**참고**  
`AWS-RunDocument`는 Automation 런북 등의 다른 유형이 아닌 명령 유형 SSM 문서만 실행하는 데 사용할 수 있습니다. `AWS-RunDocument`는 `aws:downloadContent` 플러그인을 사용합니다. `aws:downloadContent` 플러그인에 대한 자세한 내용은 [`aws:downloadContent`](documents-command-ssm-plugin-reference.md#aws-downloadContent) 섹션을 참조하세요.

**주의**  
`AWS-RunDocument`는 다양한 소스(SSM 문서, GitHub, S3, URL)에서 문서 콘텐츠를 실행할 수 있습니다. 원격 문서를 실행할 때 평가되는 IAM 권한은 원격 문서에 대한 `ssm:GetDocument` 및 `AWS-RunDocument`에 대한 `ssm:SendCommand`입니다. 특정 SSM 문서에 대한 액세스를 거부하는 IAM 정책이 있는 경우 `AWS-RunDocument` 권한이 있는 사용자는 문서 콘텐츠를 파라미터로 전달하여 거부된 문서를 계속 실행할 수 있으며, 이러한 문서에는 동일한 문서별 IAM 제한이 적용되지 않을 수 있습니다.  
문서 실행을 적절하게 제한하려면 다음 방법 중 하나를 사용합니다.  
**승인된 소스 허용 목록**: 중첩된 문서 실행을 사용해야 하는 경우 SSM 문서 소스에 대한 `ssm:GetDocument`를 제어하는 IAM 정책, Amazon S3 소스에 대한 IAM 및 Amazon S3 버킷 정책, 퍼블릭 인터넷 소스에 대한 네트워크 설정(예: VPC 엔드포인트 또는 보안 그룹) 등 각 소스 유형에 대한 적절한 제어를 사용하여 승인된 소스만 액세스하도록 제한합니다.
**AWS-RunDocument에 대한 액세스 제한**: 중첩된 문서 실행을 방지하려면 IAM 정책에서 `aws:runDocument` 플러그인을 사용하는 `AWS-RunDocument` 및 기타 문서에 대한 `ssm:SendCommand`를 거부합니다.
**권한 경계 사용**: IAM 권한 경계를 구현하여 사용자의 최대 권한을 설정하면 실행 방법에 관계없이 승인되지 않은 문서를 실행하지 못하게 할 수 있습니다.
IAM 모범 사례 및 권한 경계에 대한 자세한 내용을 알아보려면 *AWS Identity and Access Management 사용 설명서*의 [IAM 엔터티의 권한 경계](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)를 참조하세요.

**시작하기 전 준비 사항**  
원격 문서를 실행하기 전에 다음 작업을 완료해야 합니다.
+ SSM Command 문서를 생성하여 원격 위치에 저장합니다. 자세한 내용은 [SSM 문서 콘텐츠 생성](documents-creating-content.md) 섹션을 참조하세요.
+ 프라이빗 GitHub 리포지토리에 저장된 원격 문서를 실행하려는 경우 GitHub 보안 액세스 토큰에 대한 Systems Manager `SecureString` 파라미터를 생성해야 합니다. 수동으로 SSH를 통해 토큰을 전달해서는 프라이빗 GitHub 리포지토리에 저장된 원격 문서에 액세스할 수 없습니다. 액세스 토큰은 Systems Manager `SecureString` 파라미터로 전달되어야 합니다. `SecureString` 파라미터 생성에 대한 자세한 내용은 [Systems Manager에서 Parameter Store 파라미터 생성](sysman-paramstore-su-create.md) 섹션을 참조하세요.

## 원격 문서 실행(콘솔)
<a name="documents-running-remote-github-s3-console"></a>

**원격 문서를 실행하려면**

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. [**문서(Document)**] 목록에서 **`AWS-RunDocument`**를 선택합니다.

1. **Command parameters(명령 파라미터)**의 **소스 유형**에서 옵션을 선택합니다.
   + **GitHub**를 선택하는 경우 다음 형식으로 **소스 정보**의 정보를 지정합니다.

     ```
     {
         "owner": "owner_name",
         "repository": "repository_name",
         "path": "path_to_document",
         "getOptions":"branch:branch_name",
         "tokenInfo": "{{ssm-secure:secure-string-token}}"
     }
     ```

     예제:

     ```
     {
         "owner":"TestUser",
         "repository":"GitHubTestExamples",
         "path":"scripts/python/test-script",
         "getOptions":"branch:exampleBranch",
         "tokenInfo":"{{ssm-secure:my-secure-string-token}}"
     }
     ```
**참고**  
`getOptions`는 마스터가 아닌 분기 또는 리포지토리의 특정 커밋에서 내용을 검색하는 추가 옵션입니다. 마스터 분기에서 최신 커밋을 사용하는 경우 `getOptions`를 생략할 수 있습니다. `branch` 파라미터는 SSM 문서가 `master`가 아닌 분기에 저장된 경우에만 필요합니다.  
리포지토리의 특정 *커밋*에 있는 SSM 문서의 버전을 사용하려면 `branch`대신 `getOptions`에서 `commitID`를 사용합니다. 예:  

     ```
     "getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE",
     ```
   + **S3**를 선택하는 경우 다음 형식으로 **Source Info(소스 정보)** 정보를 지정합니다.

     ```
     {"path":"URL_to_document_in_S3"}
     ```

     예:

     ```
     {"path":"https://s3.amazonaws.com/amzn-s3-demo-bucket/scripts/ruby/mySSMdoc.json"}
     ```
   + **SSMDocument**를 선택하는 경우 다음 형식으로 **Source Info(소스 정보)** 정보를 지정합니다.

     ```
     {"name": "document_name"}
     ```

     예:

     ```
     {"name": "mySSMdoc"}
     ```

1. [**문서 파라미터(Document Parameters)**] 필드에서 원격 SSM 문서에 대한 파라미터를 입력합니다. 예를 들어 `AWS-RunPowerShell` 문서를 실행하는 경우 다음을 지정할 수 있습니다.

   ```
   {"commands": ["date", "echo \"Hello World\""]}
   ```

   `AWS-ConfigureAWSPack` 문서를 실행하는 경우 다음을 지정할 수 있습니다.

   ```
   {
      "action":"Install",
      "name":"AWSPVDriver"
   }
   ```

1. **대상(Targets)** 섹션에서, 태그를 지정하거나, 수동으로 인스턴스나 엣지 디바이스를 선택하거나, 리소스 그룹을 지정하여 이 작업을 실행할 관리형 노드를 식별합니다.
**작은 정보**  
예상한 관리형 노드가 목록에 없으면 [관리형 노드 가용성 문제 해결](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**(실행)을 선택합니다.

**참고**  
Run Command를 사용할 때 서버와 인스턴스를 재부팅하여 스크립트를 호출하는 방법은 [명령 실행 시 재부팅 처리](send-commands-reboot.md) 섹션을 참조하세요.

# SSM 문서 공유
<a name="documents-ssm-sharing"></a>

동일한 AWS 리전에서 계정과 비공개적으로 또는 공개적으로 AWS Systems Manager(SSM) 문서를 공유할 수 있습니다. 문서를 사적으로 공유하려면 문서 권한을 수정하여 특정 개인들이 자신의 AWS 계정 ID에 따라 액세스할 수 있도록 허용합니다. SSM 문서를 공개적으로 공유하려면 문서 권한을 수정하여 `All`로 지정합니다. 문서는 공개 및 비공개로 동시에 공유할 수 없습니다.

**주의**  
신뢰할 수 있는 소스에서 공유된 SSM 문서만 사용합니다. 공유 문서를 사용할 때는 그 전에 문서의 내용을 미리 신중하게 검토하여 해당 문서가 자신의 인스턴스 구성을 어떻게 바꾸어놓을지 이해해야 합니다. 공유 문서 모범 사례에 대한 자세한 내용은 [공유 SSM 문서에 대한 모범 사례](#best-practices-shared) 섹션을 참조하세요.

**제한 사항**  
SSM 문서로 작업을 시작할 때 다음과 같은 제한 사항에 유의합니다.
+ 소유자만이 문서를 공유할 수 있습니다.
+ 문서를 삭제하려면 먼저 문서 공유를 중단해야 합니다. 자세한 내용은 [공유 SSM 문서에 대한 권한 수정](#modify-permissions-shared) 섹션을 참조하세요.
+ 최대 1,000개의 AWS 계정와 문서를 공유할 수 있습니다. [지원 Center](https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase)에 이 제한에 대한 증가를 요청할 수 있습니다. [**제한 유형(Limit type)**]에서 [*EC2 Systems Manager*]를 선택하고 요청 이유를 설명합니다.
+ 최대 5건의 SSM 문서를 공개적으로 공유할 수 있습니다. [지원 Center](https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase)에 이 제한에 대한 증가를 요청할 수 있습니다. [**제한 유형(Limit type)**]에서 [*EC2 Systems Manager*]를 선택하고 요청 이유를 설명합니다.
+ 동일한 AWS 리전에서만 다른 계정과 문서를 공유할 수 있습니다. 크로스 리전 공유는 지원되지 않습니다.

**중요**  
Systems Manager에서 *Amazon 소유* SSM 문서는 Amazon Web Services 자체에서 생성하고 관리하는 문서입니다. *Amazon 소유* 문서에는 문서 이름에 접두사(예: `AWS-*`)가 포함됩니다. 문서의 소유자는 AWS 내 특정 사용자 계정이 아닌 Amazon으로 간주됩니다. 이 문서는 누구나 사용할 수 있도록 공개되어 있습니다.

Systems Manager Service Quotas에 대한 자세한 내용은 [AWS Systems Manager Service Quotas 사용 설명서](https://docs.aws.amazon.com/general/latest/gr/ssm.html#limits_ssm)를 참조하세요.

**Topics**
+ [공유 SSM 문서에 대한 모범 사례](#best-practices-shared)
+ [SSM 문서의 퍼블릭 공유 차단](#block-public-access)
+ [SSM 문서 공유](#ssm-how-to-share)
+ [공유 SSM 문서에 대한 권한 수정](#modify-permissions-shared)
+ [공유 SSM 문서 사용](#using-shared-documents)

## 공유 SSM 문서에 대한 모범 사례
<a name="best-practices-shared"></a>

문서를 공유하기 전에 또는 공유된 문서를 사용하기 전에 다음 지침을 읽어보십시오.

**민감한 정보의 삭제**  
AWS Systems Manager(SSM) 문서를 주의 깊게 살펴보고 민감한 정보는 모두 삭제합니다. 예를 들어 문서에 AWS 자격 증명이 포함되지 않도록 합니다. 특정 개인들과 문서를 공유하는 경우, 그 사용자들은 문서에 있는 정보를 볼 수 있습니다. 문서를 공개적으로 공유하는 경우에는 모든 사용자가 그 문서에 있는 정보를 볼 수 있습니다.

**문서의 퍼블릭 공유 차단**  
계정에서 공개적으로 공유된 모든 SSM 문서를 검토하고 계속 공유할지 여부를 확인합니다. 모든 사람과의 문서 공유를 중단하려면 이 항목의 [공유 SSM 문서에 대한 권한 수정](#modify-permissions-shared) 섹션에 설명된 대로 문서 권한 설정을 수정해야 합니다. 퍼블릭 공유 차단 설정을 켜도 현재 모든 사람과 공유하고 있는 문서에는 영향을 주지 않습니다. 사용 사례에서 모든 사람과의 문서를 공유해야 하는 경우가 아니면 Systems Manager Documents 콘솔의 **기본 설정** 섹션에서 SSM 문서의 퍼블릭 공유 차단 설정을 켜는 것이 좋습니다. 이 설정을 켜면 SSM 문서에 대한 원치 않는 액세스를 방지할 수 있습니다. 퍼블릭 공유 차단 설정은 AWS 리전마다 다를 수 있는 계정 수준 설정입니다.

**IAM 신뢰 정책을 사용하여 Run Command 작업 제한**  
문서에 대한 액세스 권한을 얻게 될 사용자들에 대해 제한적인 AWS Identity and Access Management(IAM) 정책을 생성합니다. IAM 정책은 사용자가 Amazon Elastic Compute Cloud(Amazon EC2) 콘솔에서 또는 AWS Command Line Interface(AWS CLI)나 AWS Tools for Windows PowerShell로 `ListDocuments`을 호출하여 볼 수 있는 SSM 문서를 결정합니다. 또한 이 정책은 사용자가 SSM 문서에서 수행할 수 있는 작업을 제한합니다. 제한적인 정책을 생성하여 사용자가 특정 문서만 사용하도록 할 수 있습니다. 자세한 내용은 [고객 관리형 정책 예제](security_iam_id-based-policy-examples.md#customer-managed-policies) 섹션을 참조하세요.

**공유 SSM 문서를 사용할 때는 주의해야 합니다.**  
자신에게 공유된 모든 문서, 특히 퍼블릭 문서의 내용을 검토하여 자신의 인스턴스에서 실행될 명령을 이해합니다. 문서가 실행된 후에는 의도적이든 비의도적이든 부정적인 영향을 미칠 수 있습니다. 문서가 외부 네트워크를 참조하는 경우, 그 문서를 사용하기 전에 외부 소스를 검토하십시오.

**문서 해시를 사용해 명령 전송하기**  
문서를 공유하면 시스템이 SHA256 해시를 생성해 그것을 문서에 할당합니다. 또한 시스템은 문서 내용에 대한 스냅샷을 저장합니다. 공유된 문서를 사용해 명령을 전송할 때 명령에 해시를 지정해 다음 조건이 참이 되도록 할 수 있습니다.  
+ 정확한 Systems Manager 문서에서 명령을 실행하고 있습니다.
+ 문서가 공유된 이후 그 내용이 변경되지 않았습니다.
해시가 지정된 문서와 일치하지 않거나 공유된 문서의 내용이 변경된 경우 명령은 `InvalidDocument` 예외를 반환합니다. 해시는 외부 위치에서 온 문서 내용은 확인할 수 없습니다.

**보간 파라미터를 사용하여 보안 강화**  
SSM 문서의 `String` 유형 파라미터의 경우 파라미터와 값 `interpolationType": "ENV_VAR`을 사용하여 파라미터 입력을 잠재적으로 실행 가능한 명령이 아닌 문자열 리터럴로 처리하여 명령 삽입 공격에 대한 보안을 강화합니다. 이 경우 에이전트는 파라미터의 값을 사용하여 `SSM_parameter-name`이라는 환경 변수를 생성합니다. `String` 유형 파라미터가 포함된 기존 SSM 문서는 모두 `"interpolationType": "ENV_VAR"`을 포함하도록 업데이트하는 것이 좋습니다. 자세한 내용은 [SSM 문서 콘텐츠 작성](documents-creating-content.md#writing-ssm-doc-content) 섹션을 참조하세요.

## SSM 문서의 퍼블릭 공유 차단
<a name="block-public-access"></a>

시작하기 전에 AWS 계정에서 공개적으로 공유된 모든 SSM 문서를 검토하고 계속 공유할지 여부를 확인합니다. 모든 사람과의 SSM 문서 공유를 중단하려면 이 항목의 [공유 SSM 문서에 대한 권한 수정](#modify-permissions-shared) 섹션에 설명된 대로 문서 권한 설정을 수정해야 합니다. 퍼블릭 공유 차단 설정을 켜도 현재 모든 사람과 공유하고 있는 SSM 문서에는 영향을 주지 않습니다. 퍼블릭 공유 차단 설정이 활성화되어 있으면 추가적인 SSM 문서는 모든 사람과 공유할 수 없습니다.

사용 사례에서 모든 사람과의 문서를 공유해야 하는 경우가 아니라면 SSM 문서의 퍼블릭 공유 차단 설정을 켜는 것이 좋습니다. 이 설정을 켜면 SSM 문서에 대한 원치 않는 액세스를 방지할 수 있습니다. 퍼블릭 공유 차단 설정은 AWS 리전마다 다를 수 있는 계정 수준 설정입니다. 다음 태스크를 완료하여 현재 공유하지 않는 모든 SSM 문서에 대한 퍼블릭 공유를 차단하세요.

### 퍼블릭 공유 차단(콘솔)
<a name="block-public-access-console"></a>

**SSM 문서의 퍼블릭 공유를 차단하려면**

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

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

1. [**기본 설정(Preferences)**]을 선택하고 [**퍼블릭 공유 차단(Block public sharing)**] 섹션에서 [**편집(Edit)**]을 선택합니다.

1. [**퍼블릭 공유 차단(Block public sharing)**] 확인란을 선택하고 [**저장(Save)**]을 선택합니다.

### 퍼블릭 공유 차단(명령줄)
<a name="block-public-access-cli"></a>

로컬 컴퓨터에서 AWS Command Line Interface(AWS CLI) 또는 AWS Tools for Windows PowerShell을 열고 다음 명령을 실행하여 SSM 문서의 퍼블릭 공유를 차단합니다.

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

```
aws ssm update-service-setting  \
    --setting-id /ssm/documents/console/public-sharing-permission \
    --setting-value Disable \
    --region 'The AWS 리전 you want to block public sharing in'
```

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

```
aws ssm update-service-setting ^
    --setting-id /ssm/documents/console/public-sharing-permission ^
    --setting-value Disable ^
    --region "The AWS 리전 you want to block public sharing in"
```

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

```
Update-SSMServiceSetting `
    -SettingId /ssm/documents/console/public-sharing-permission `
    -SettingValue Disable `
    –Region The AWS 리전 you want to block public sharing in
```

------

다음 명령을 사용하여 설정 값이 업데이트되었는지 확인합니다.

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

```
aws ssm get-service-setting   \
    --setting-id /ssm/documents/console/public-sharing-permission \
    --region The AWS 리전 you blocked public sharing in
```

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

```
aws ssm get-service-setting  ^
    --setting-id /ssm/documents/console/public-sharing-permission ^
    --region "The AWS 리전 you blocked public sharing in"
```

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

```
Get-SSMServiceSetting `
    -SettingId /ssm/documents/console/public-sharing-permission `
    -Region The AWS 리전 you blocked public sharing in
```

------

### 액세스를 제한하여 IAM과의 퍼블릭 공유 차단
<a name="block-public-access-changes-iam"></a>

사용자가 퍼블릭 공유 차단 설정을 수정하지 못하도록 제한하는 AWS Identity and Access Management(IAM) 정책을 생성할 수 있습니다. 이렇게 하면 사용자가 SSM 문서에 대한 원치 않는 액세스를 허용할 수 없습니다.

다음은 사용자가 퍼블릭 공유 차단 설정을 업데이트하지 못하도록 하는 IAM 정책의 예입니다. 이 예를 사용하려면 예제 Amazon Web Services 계정 ID를 사용자의 계정 ID로 바꿔야 합니다.

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Deny",
            "Action": "ssm:UpdateServiceSetting",
            "Resource": "arn:aws:ssm:*:444455556666:servicesetting/ssm/documents/console/public-sharing-permission"
        }
    ]
}
```

------

## SSM 문서 공유
<a name="ssm-how-to-share"></a>

Systems Manager 콘솔을 사용하여 AWS Systems Manager(SSM) 문서를 공유할 수 있습니다. 콘솔의 문서를 공유하는 경우 문서의 기본 버전만 공유할 수 있습니다. AWS Command Line Interface(AWS CLI), AWS Tools for Windows PowerShell 또는 AWS SDK를 사용하여 `ModifyDocumentPermission` API 작업을 호출하여 프로그래밍 방식으로 SSM 문서를 공유할 수도 있습니다. 문서를 공유하기 전에 먼저 공유하고자 하는 사람들의 AWS 계정 ID가 있어야 합니다. 문서를 공유할 때 이들 계정 ID를 지정해야 합니다.

### 문서 공유(콘솔)
<a name="share-using-console"></a>

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

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

1. 문서 목록에서 공유하고자 하는 문서를 선택한 후 **세부 정보 보기(View details)**를 선택합니다. [**권한(Permissions)**] 탭에서 자신이 문서의 소유자인지 확인합니다. 문서 소유자만이 문서를 공유할 수 있습니다.

1. **편집**을 선택합니다.

1. 명령을 공개적으로 공유하려면 **퍼블릭**을 선택한 후, **저장**을 선택합니다. 명령을 사적으로 공유하려면 [**프라이빗(Private)**]을 선택하고 AWS 계정 ID를 입력하고 [**권한 추가(Add permission)**]를 선택한 후 [**저장(Save)**]을 선택합니다.

### 문서 공유(명령줄)
<a name="share-using-cli"></a>

다음 절차를 수행하려면 명령줄 세션에 대해 AWS 리전을 지정해야 합니다.

1. 로컬 컴퓨터에서 AWS CLI 또는 AWS Tools for Windows PowerShell을 열고 다음 명령을 실행하여 자격 증명을 지정합니다.

   다음 명령에서 *region*을 자신의 정보로 바꿉니다. 지원되는 *리전* 값 목록은 **Amazon Web Services 일반 참조의 [Systems Manager 서비스 엔드포인트](https://docs.aws.amazon.com/general/latest/gr/ssm.html#ssm_region)에 있는 **리전** 열을 참조하세요.

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

   ```
   aws config
   
   AWS Access Key ID: [your key]
   AWS Secret Access Key: [your key]
   Default region name: region
   Default output format [None]:
   ```

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

   ```
   aws config
   
   AWS Access Key ID: [your key]
   AWS Secret Access Key: [your key]
   Default region name: region
   Default output format [None]:
   ```

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

   ```
   Set-AWSCredentials –AccessKey your key –SecretKey your key
   Set-DefaultAWSRegion -Region region
   ```

------

1. 다음 명령을 실행하여 사용 가능한 모든 SSM 문서를 나열합니다. 목록에는 자신이 생성한 문서와 자신에게 공유된 문서가 포함됩니다.

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

   ```
   aws ssm list-documents
   ```

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

   ```
   aws ssm list-documents
   ```

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

   ```
   Get-SSMDocumentList
   ```

------

1. 다음 명령을 사용하여 특정 문서를 얻습니다.

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

   ```
   aws ssm get-document \
       --name document name
   ```

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

   ```
   aws ssm get-document ^
       --name document name
   ```

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

   ```
   Get-SSMDocument `
       –Name document name
   ```

------

1. 다음 명령을 사용하여 문서에 대한 설명을 봅니다.

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

   ```
   aws ssm describe-document \
       --name document name
   ```

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

   ```
   aws ssm describe-document ^
       --name document name
   ```

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

   ```
   Get-SSMDocumentDescription `
       –Name document name
   ```

------

1. 다음 명령을 사용하여 문서에 대한 권한을 확인합니다.

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

   ```
   aws ssm describe-document-permission \
       --name document name \
       --permission-type Share
   ```

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

   ```
   aws ssm describe-document-permission ^
       --name document name ^
       --permission-type Share
   ```

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

   ```
   Get-SSMDocumentPermission `
       –Name document name `
       -PermissionType Share
   ```

------

1. 다음 명령을 사용하여 문서에 대한 권한을 수정한 후 문서를 공유합니다. 권한을 편집하기 위해서는 문서의 소유자이어야 합니다. (선택 사항) 특정 AWS 계정 ID를 사용하여 공유되는 문서의 경우 `--shared-document-version` 파라미터를 사용하여 공유하려는 문서의 버전을 지정할 수 있습니다. 버전을 지정하지 않으면 시스템에서 문서의 `Default` 버전을 공유합니다. `all`을 사용하여 문서를 공개적으로 공유하는 경우 기본적으로 지정된 문서의 모든 버전이 공유됩니다. 다음 예제 명령에서는 특정 사용자의 AWS 계정 ID에 따라 문서를 해당 사용자와 비공개로 공유합니다.

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

   ```
   aws ssm modify-document-permission \
       --name document name \
       --permission-type Share \
       --account-ids-to-add AWS 계정 ID
   ```

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

   ```
   aws ssm modify-document-permission ^
       --name document name ^
       --permission-type Share ^
       --account-ids-to-add AWS 계정 ID
   ```

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

   ```
   Edit-SSMDocumentPermission `
       –Name document name `
       -PermissionType Share `
       -AccountIdsToAdd AWS 계정 ID
   ```

------

1. 다음 명령을 사용하여 문서를 공개적으로 공유합니다.
**참고**  
`all`을 사용하여 문서를 공개적으로 공유하는 경우 기본적으로 지정된 문서의 모든 버전이 공유됩니다.

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

   ```
   aws ssm modify-document-permission \
       --name document name \
       --permission-type Share \
       --account-ids-to-add 'all'
   ```

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

   ```
   aws ssm modify-document-permission ^
       --name document name ^
       --permission-type Share ^
       --account-ids-to-add "all"
   ```

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

   ```
   Edit-SSMDocumentPermission `
       -Name document name `
       -PermissionType Share `
       -AccountIdsToAdd ('all')
   ```

------

## 공유 SSM 문서에 대한 권한 수정
<a name="modify-permissions-shared"></a>

명령을 공유하면 사용자들은 AWS Systems Manager(SSM) 문서에 대한 액세스 권한을 제거하거나 SSM 문서를 삭제할 때까지 그 명령을 보고 사용할 수 있습니다. 그러나 문서가 공유되고 있는 한 삭제는 할 수 없습니다. 먼저 공유를 중단하고 나서 삭제해야 합니다.

### 문서 공유 중지(콘솔)
<a name="unshare-using-console"></a>

**문서 공유 중단**

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

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

1. 문서 목록에서 공유를 중단하고자 하는 문서를 선택한 후 **세부 정보**를 선택합니다. **권한** 섹션에서 자신이 문서의 소유자인지 확인합니다. 문서 소유자만이 문서 공유를 중단할 수 있습니다.

1. **편집**을 선택합니다.

1. **X**를 선택하여 명령에 대한 액세스 권한이 있어서는 안 되는 AWS 계정 ID를 삭제한 다음 [**저장(Save)**]을 선택합니다.

### 문서 공유 중지(명령줄)
<a name="unshare-using-cli"></a>

로컬 컴퓨터에서 AWS CLI 또는 AWS Tools for Windows PowerShell을 열고 다음 명령을 실행하여 명령 공유를 중지합니다.

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

```
aws ssm modify-document-permission \
    --name document name \
    --permission-type Share \
    --account-ids-to-remove 'AWS 계정 ID'
```

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

```
aws ssm modify-document-permission ^
    --name document name ^
    --permission-type Share ^
    --account-ids-to-remove "AWS 계정 ID"
```

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

```
Edit-SSMDocumentPermission `
    -Name document name `
    -PermissionType Share `
    –AccountIdsToRemove AWS 계정 ID
```

------

## 공유 SSM 문서 사용
<a name="using-shared-documents"></a>

AWS Systems Manager(SSM) 문서를 공유하면 시스템은 Amazon 리소스 이름(ARN)을 생성하고 명령에 할당합니다. Systems Manager 콘솔에서 공유 문서를 선택하고 실행하면 ARN이 보이지 않습니다. 그러나 공유 SSM 문서를 Systems Manager 콘솔이 아닌 다른 방법으로 실행하고자 한다면 `DocumentName` 요청 파라미터에 대한 문서의 전체 ARN을 지정해야 합니다. 이 명령을 실행해 문서를 나열하면 SSM 문서에 대한 전체 ARN이 나타납니다.

**참고**  
AWS 퍼블릭 문서(`AWS-*`로 시작하는 문서)나 자신이 소유한 문서에 대해서는 ARN을 지정할 필요가 없습니다.

### 공유 SSM 문서 사용(명령줄)
<a name="using-shared-documents-cli"></a>

 **퍼블릭 SSM 문서를 모두 나열** 

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

```
aws ssm list-documents \
    --filters Key=Owner,Values=Public
```

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

```
aws ssm list-documents ^
    --filters Key=Owner,Values=Public
```

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

```
$filter = New-Object Amazon.SimpleSystemsManagement.Model.DocumentKeyValuesFilter
$filter.Key = "Owner"
$filter.Values = "Public"

Get-SSMDocumentList `
    -Filters @($filter)
```

------

 **자신에게 공유된 프라이빗 SSM 문서를 나열** 

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

```
aws ssm list-documents \
    --filters Key=Owner,Values=Private
```

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

```
aws ssm list-documents ^
    --filters Key=Owner,Values=Private
```

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

```
$filter = New-Object Amazon.SimpleSystemsManagement.Model.DocumentKeyValuesFilter
$filter.Key = "Owner"
$filter.Values = "Private"

Get-SSMDocumentList `
    -Filters @($filter)
```

------

 **사용할 수 있는 모든 SSM 문서를 나열** 

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

```
aws ssm list-documents
```

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

```
aws ssm list-documents
```

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

```
Get-SSMDocumentList
```

------

 **자신에게 공유된 SSM 문서에 대한 정보 확인** 

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

```
aws ssm describe-document \
    --name arn:aws:ssm:us-east-2:12345678912:document/documentName
```

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

```
aws ssm describe-document ^
    --name arn:aws:ssm:us-east-2:12345678912:document/documentName
```

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

```
Get-SSMDocumentDescription `
    –Name arn:aws:ssm:us-east-2:12345678912:document/documentName
```

------

 **공유 SSM 문서 실행** 

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

```
aws ssm send-command \
    --document-name arn:aws:ssm:us-east-2:12345678912:document/documentName \
    --instance-ids ID
```

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

```
aws ssm send-command ^
    --document-name arn:aws:ssm:us-east-2:12345678912:document/documentName ^
    --instance-ids ID
```

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

```
Send-SSMCommand `
    –DocumentName arn:aws:ssm:us-east-2:12345678912:document/documentName `
    –InstanceIds ID
```

------

# SSM 문서 검색
<a name="ssm-documents-searching"></a>

자유 텍스트 검색 또는 필터 기반 검색을 사용하여 AWS Systems Manager(SSM) 문서 저장소에서 SSM 문서를 검색할 수 있습니다. 자주 사용하는 SSM 문서를 찾는 데 도움이 되도록 문서를 즐겨찾기에 추가할 수도 있습니다. 다음 섹션에서는 이러한 기능을 사용하는 방법을 설명합니다.

## 자유 텍스트 검색 사용
<a name="ssm-documents-searching-free-text"></a>

Systems Manager [**Documents**] 페이지의 검색 상자에서 자유 텍스트 검색을 지원합니다. 자유 텍스트 검색은 입력한 검색어를 각 SSM 문서의 문서 이름과 비교합니다. 단일 검색어(예: **ansible**)를 입력하면 Systems Manager는 이 용어가 발견된 모든 SSM 문서를 반환합니다. 여러 검색어를 입력하면 Systems Manager는 `OR` 문을 사용하여 검색합니다. 예를 들어 **ansible** 및 **linux**을 지정하면 검색 시 이름에 *두 키워드 중 하나*가 포함된 모든 문서가 반환됩니다.

자유 텍스트 검색어를 입력하고 [**플랫폼 유형(Platform type)**]과 같은 검색 옵션을 선택하면 검색에 `AND` 문이 사용되고 이름에 키워드를 포함하는 지정된 플랫폼 유형의 모든 문서가 반환됩니다.

**참고**  
자유 텍스트 검색에 대한 다음 세부 정보에 유의합니다.  
자유 텍스트 검색은 대/소문자를 구분하지 *않습니다*.
검색어는 최소 3자, 최대 20자여야 합니다.
자유 텍스트 검색은 최대 5개의 검색어를 허용합니다.
검색어 사이에 공백을 입력하면 검색 시 공백이 포함됩니다.
자유 텍스트 검색을 [**문서 유형(Document type)**] 또는 [**플랫폼 유형(Platform type)**]과 같은 다른 검색 옵션과 결합할 수 있습니다.
[**문서 이름 접두사(Document Name Prefix)**] 필터와 자유 텍스트 검색은 상호 배타적이므로 함께 사용할 수 없습니다.

**SSM 문서를 검색하려면**

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

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

1. 검색 상자에 검색어를 입력하고 Enter 키를 누릅니다.

### AWS CLI를 사용하여 자유 텍스트 문서 검색 수행
<a name="ssm-documents-searching-free-text-cli"></a>

**CLI를 사용하여 자유 텍스트 문서 검색을 수행하려면**

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

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

1. 한 용어로 자유 텍스트 문서 검색을 수행하려면 다음 명령을 실행합니다. 이 명령에서 *search\$1term*을 자신의 정보로 바꿉니다.

   ```
   aws ssm list-documents --filters Key="SearchKeyword",Values="search_term"
   ```

   다음은 그 예입니다.

   ```
   aws ssm list-documents --filters Key="SearchKeyword",Values="aws-asg" --region us-east-2
   ```

   `AND` 문을 생성하는 여러 용어를 사용하여 검색하려면 다음 명령을 실행합니다. 이 명령에서 *search\$1term\$11*과 *search\$1term\$12*를 자신의 정보로 바꿉니다.

   ```
   aws ssm list-documents --filters Key="SearchKeyword",Values="search_term_1","search_term_2","search_term_3" --region us-east-2
   ```

   다음은 그 예입니다.

   ```
   aws ssm list-documents --filters Key="SearchKeyword",Values="aws-asg","aws-ec2","restart" --region us-east-2
   ```

## 필터 사용
<a name="ssm-documents-searching-filters"></a>

검색 상자를 선택하면 Systems Manager [**Documents**] 페이지에 자동으로 다음 필터가 표시됩니다.
+ 문서 이름 접두사
+ 플랫폼 유형
+ 문서 유형
+ 태그 키

![\[SSM Documents 페이지의 필터 옵션\]](http://docs.aws.amazon.com/ko_kr/systems-manager/latest/userguide/images/ssm-documents-filters-1.png)


단일 필터를 사용하여 SSM 문서를 검색할 수 있습니다. 좀 더 구체적인 SSM 문서 집합을 반환하려는 경우 여러 필터를 적용할 수 있습니다. 다음은 [**플랫폼 유형(Platform types)**] 및 [**문서 이름 접두사(Document name prefix)**] 필터를 사용하는 검색의 예입니다.

![\[SSM Documents 페이지에서 여러 필터 옵션 적용\]](http://docs.aws.amazon.com/ko_kr/systems-manager/latest/userguide/images/ssm-documents-filters-2.png)


여러 필터를 적용하는 경우 Systems Manager는 선택한 필터에 따라 다른 검색 문을 생성합니다.
+ *동일한* 필터를 여러 번 적용하는 경우(예: [**문서 이름 접두사(Document name prefix)**]) Systems Manager는 `OR` 문을 사용하여 검색합니다. 예를 들어 [**문서 이름 접두사(Document name prefix)**]=**AWS** 필터 하나와 [**문서 이름 접두사(Document name prefix)**]=**Lambda** 필터를 또 하나 지정하는 경우 검색 시 접두사 "`AWS`"가 있는 모든 문서와 접두사 "`Lambda`"가 있는 모든 문서가 반환됩니다.
+ *여러* 필터를 적용하는 경우(예: **문서 이름 접두사(Document name prefix)** 및 **플랫폼 유형(Platform types)**) Systems Manager는 `AND` 명령문을 사용하여 검색합니다. 예를 들어 **문서 이름 접두사**=**AWS** 필터와 **플랫폼 유형(Platform types)**=**Linux** 필터를 지정하면 검색 시 Linux 플랫폼에 특정한 접두사 "`AWS`"가 있는 모든 문서가 반환됩니다.

**참고**  
필터를 사용하는 검색은 대/소문자를 구분합니다.

## 즐겨찾기에 문서 추가
<a name="favorite-documents"></a>

자주 사용하는 SSM 문서를 찾는 데 도움이 되도록 문서를 즐겨찾기에 추가합니다. 문서 유형, AWS 계정 및 AWS 리전로 최대 20개의 문서를 즐겨찾기에 추가할 수 있습니다. 문서 AWS Management Console에서 즐겨찾기를 선택, 수정 및 확인할 수 있습니다. 다음 절차에서는 즐겨찾기를 선택하고 수정하고 보는 방법을 설명합니다.

**즐겨찾기에 SSM 문서 추가**

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

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

1. 즐겨찾기에 추가하려는 문서 이름 옆의 별표 아이콘을 선택합니다.

**즐겨찾기에서 SSM 문서 제거**

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

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

1. 즐겨찾기에서 제거하려는 문서 이름 옆의 별표 아이콘 선택을 취소합니다.

**문서 AWS Management Console에서 즐겨찾기 보기**

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

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

1. **즐겨찾기** 탭을 선택합니다.

# 파라미터 처리 문제 해결
<a name="parameter-troubleshooting"></a>

## 일반적인 파라미터 처리 문제
<a name="common-parameter-issues"></a>

**실행 중에 사용할 수 없는 환경 변수**  
**문제:** 환경 변수(`SSM_parameter-name`)를 찾을 수 없어 명령이 실패합니다.  
**가능한 원인:**  
+ SSM Agent 버전이 환경 변수 보간을 지원하지 않습니다.
+ `interpolationType`이 `ENV_VAR`로 설정되지 않았습니다.
+ 파라미터 이름이 예상 환경 변수 이름과 일치하지 않습니다.
**해결 방법**:  
+ SSM Agent 버전이 3.3.2746.0 이상인지 확인합니다.
+ 이전 에이전트 버전에 대한 대체 로직을 추가합니다.

  ```
  if [ -z "${SSM_parameterName+x}" ]; then
      export SSM_parameterName="{{parameterName}}"
  fi
  ```

**특수 문자가 포함된 파라미터 값**  
**문제:** 파라미터 값에 공백, 따옴표 또는 기타 특수 문자가 포함되면 명령이 실패합니다.  
**해결 방법**:  
+ 환경 변수를 참조할 때 적절한 따옴표를 사용합니다.

  ```
  # Correct
  echo "$SSM_parameter-name"
  
  # Incorrect
  echo $SSM_parameter-name
  ```
+ `allowedPattern`을 사용하여 특수 문자를 제한하는 입력 검증을 추가합니다.

**플랫폼 간 일관되지 않은 동작**  
**문제:** 파라미터 처리가 Linux 시스템과 Windows Server 시스템에서 다르게 작동합니다.  
**해결 방법**:  
+ 플랫폼별 환경 변수 구문을 사용합니다.

  ```
  # PowerShell
  $env:SSM_parameter-name
  
  # Bash
  $SSM_parameter-name
  ```
+ 문서에서 플랫폼별 사전 조건 검사를 사용합니다.

**파라미터 값이 제대로 이스케이프되지 않음**  
**문제:** 환경 변수 보간 사용에도 불구하고 명령 주입 취약성.  
**해결 방법**:  
+ 명령에 파라미터 값을 포함할 때는 항상 적절한 이스케이프를 사용합니다.

  ```
  # Correct
  mysql_command="mysql -u \"$SSM_username\" -p\"$SSM_password\""
  
  # Incorrect
  mysql_command="mysql -u $SSM_username -p$SSM_password"
  ```

## 파라미터 검증 팁
<a name="parameter-validation"></a>

다음 기법을 사용하여 파라미터 처리를 검증합니다.

1. 테스트 환경 변수 가용성:

   ```
   #!/bin/bash
   # Print all SSM_ environment variables
   env | grep ^SSM_
   
   # Test specific parameter
   if [ -n "$SSM_parameter" ]; then
       echo "Parameter is available"
   else
       echo "Parameter is not available"
   fi
   ```

1. 파라미터 패턴 확인:

   ```
   parameters:
     myParameter:
       type: String
       allowedPattern: "^[a-zA-Z0-9_-]+$"
       description: "Test this pattern with sample inputs"
   ```

1. 오류 처리 포함:

   ```
   if [[ ! "$SSM_parameter" =~ ^[a-zA-Z0-9_-]+$ ]]; then
       echo "Parameter validation failed"
       exit 1
   fi
   ```