

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

# Systems Manager Automation 작업 참조
<a name="automation-actions"></a>

이 참조는 Automation 실행서에서 지정할 수 있는 Automation 작업을 설명합니다. Automation은 AWS Systems Manager의 도구입니다. 이러한 작업은 다른 유형의 Systems Manager(SSM) 문서에는 사용할 수 없습니다. 다른 유형의 SSM 문서용 플러그인에 대한 자세한 내용은 [Command 문서 플러그인 참조](documents-command-ssm-plugin-reference.md) 섹션을 참조하세요.

Systems Manager Automation은 Automation 실행서에 정의된 단계를 실행합니다. 각 단계는 특정 작업과 관련되어 있습니다. 작업은 해당 단계의 입력, 동작 및 출력을 결정합니다. 단계는 실행서의 `mainSteps` 섹션에 정의됩니다.

작업 또는 단계의 출력은 지정할 필요가 없습니다. 출력은 단계와 관련된 작업에 의해 미리 결정되어 있습니다. 실행서에 단계 입력을 지정할 때 이전 단계로부터 하나 이상의 출력을 참조할 수 있습니다. 예를 들어 후속 `aws:runCommand` 작업에 `aws:runInstances` 출력을 사용 가능하게 할 수 있습니다. 또한 실행서의 `Output` 섹션에서 이전 단계의 출력을 참조할 수도 있습니다.

**중요**  
AWS Identity and Access Management(IAM) 서비스 역할을 사용하여 다른 서비스를 호출하는 자동화 워크플로를 실행하는 경우 해당 서비스 역할이 다른 서비스를 호출할 권한이 있도록 구성되어야 합니다. 이 요구 사항은 `AWS-ConfigureS3BucketLogging`, `AWS-CreateDynamoDBBackup`, `AWS-RestartEC2Instance` 실행서 등의 모든 AWS Automation 실행서(`AWS-*` 실행서)에 적용됩니다. 또한 다른 서비스를 호출하는 작업을 사용하여 다른 AWS 서비스을(를) 호출하는 사용자 정의 Automation 실행서를 생성하는 경우에도 이 요구 사항이 항상 적용됩니다. 예를 들어 `aws:executeAwsApi`, `aws:createStack` 또는 `aws:copyImage` 작업을 사용하는 경우 이러한 서비스를 호출할 수 있는 권한을 포함하여 서비스 역할을 구성합니다. 역할에 IAM 인라인 정책을 추가하여 다른 AWS 서비스에 대한 권한을 부여할 수 있습니다. 자세한 내용은 [(선택 사항) 다른 AWS 서비스를 간접적으로 호출할 Automation 인라인 정책과 고객 관리형 정책 추가](automation-setup-iam.md#add-inline-policy) 섹션을 참조하세요.

**Topics**
+ [모든 작업에서 공유하는 속성](#automation-common)
+ [`aws:approve` - 수동 승인을 위해 자동화 일시 중지](automation-action-approve.md)
+ [`aws:assertAwsResourceProperty` - AWS 리소스 상태 또는 이벤트 상태 어설션](automation-action-assertAwsResourceProperty.md)
+ [`aws:branch` - 조건부 자동화 단계 실행](automation-action-branch.md)
+ [`aws:changeInstanceState` - 인스턴스 상태 변경 또는 어설션](automation-action-changestate.md)
+ [`aws:copyImage` - Amazon Machine Image 복사 또는 암호화](automation-action-copyimage.md)
+ [`aws:createImage` - Amazon Machine Image 생성](automation-action-create.md)
+ [`aws:createStack` - CloudFormation 스택 생성](automation-action-createstack.md)
+ [`aws:createTags` - AWS 리소스에 대한 태그 생성](automation-action-createtag.md)
+ [`aws:deleteImage` - Amazon Machine Image 삭제](automation-action-delete.md)
+ [`aws:deleteStack` - CloudFormation 스택 삭제](automation-action-deletestack.md)
+ [`aws:executeAutomation` - 또 다른 자동화 실행](automation-action-executeAutomation.md)
+ [`aws:executeAwsApi` - AWS API 작업 호출 및 실행](automation-action-executeAwsApi.md)
+ [`aws:executeScript` - 스크립트 실행](automation-action-executeScript.md)
+ [`aws:executeStateMachine` - AWS Step Functions 상태 시스템을 실행합니다.](automation-action-executeStateMachine.md)
+ [`aws:invokeWebhook` - Automation 웹후크 통합 호출](invoke-webhook.md)
+ [`aws:invokeLambdaFunction` - AWS Lambda 함수 호출](automation-action-lamb.md)
+ [`aws:loop`- 자동화의 여러 단계를 반복](automation-action-loop.md)
+ [`aws:pause` - 자동화 일시 중지](automation-action-pause.md)
+ [`aws:runCommand` - 관리형 인스턴스에서 명령 실행](automation-action-runcommand.md)
+ [`aws:runInstances` - Amazon EC2 인스턴스 시작](automation-action-runinstance.md)
+ [`aws:sleep` - 자동화 지연](automation-action-sleep.md)
+ [`aws:updateVariable` - 런북 변수 값을 업데이트](automation-action-update-variable.md)
+ [`aws:waitForAwsResourceProperty` - AWS 리소스 속성 대기](automation-action-waitForAwsResourceProperty.md)
+ [Automation 시스템 변수](automation-variables.md)

## 모든 작업에서 공유하는 속성
<a name="automation-common"></a>

공통 속성은 모든 작업에서 발견되는 파라미터 또는 옵션입니다. 일부 옵션은 단계가 완료될 때까지 기다리는 시간, 단계가 실패할 경우 수행할 작업 등과 같은 단계에 대한 동작을 정의합니다. 다음은 모든 작업에 공통적인 속성입니다.

[description](#descriptProp)  
런북 또는 단계의 용도를 설명하려고 제공하는 정보입니다.  
유형: 문자열  
필수 여부: 아니요

[name](#nameProp)  
실행서에 있는 모든 단계 이름을 통틀어 고유해야 하는 식별자.  
유형: 문자열  
허용 패턴: [a-zA-Z0-9\_]\+$  
필수 여부: 예

[action](#actProp)  
이 단계에서 실행해야 할 작업의 이름입니다. [`aws:runCommand` - 관리형 인스턴스에서 명령 실행](automation-action-runcommand.md)는 여기에서 지정할 수 있는 작업의 예입니다. 이 문서는 사용 가능한 모든 작업에 대한 세부 정보를 제공합니다.  
유형: 문자열  
필수 항목 여부: 예

[maxAttempts](#maxProp)  
단계가 실패할 경우 재시도해야 하는 횟수. 지정된 값이 1보다 크면 모든 재시도가 실패할 때까지 해당 단계는 실패한 것으로 간주되지 않습니다. 기본값은 1입니다.  
유형: 정수  
필수 여부: 아니요

[timeoutSeconds](#timeProp)  
단계에 대한 시간 제한 값. 시간 제한에 도달했지만 `maxAttempts` 값이 1보다 큰 경우 단계는 모든 재시도 횟수가 시도될 때까지 시간 초과된 것으로 간주되지 않습니다.  
유형: 정수  
필수 여부: 아니요

[onFailure](#failProp)  
실패 시 자동화가 중지되어야 하는지, 계속되어야 하는지 또는 다른 단계로 이동해야 하는지를 나타냅니다. 이 옵션의 기본값은 중단입니다.  
유형: 문자열  
유효 값: 중단 \| 계속 \| 단계:{{step\_name}}  
필수 여부: 아니요

[onCancel](#canProp)  
사용자가 자동화를 취소하는 경우 자동화가 이동해야 하는 단계를 나타냅니다. Automation은 최대 2분 동안 취소 워크플로를 실행합니다.  
유형: 문자열  
유효 값: 중단 \| 단계:{{step\_name}}  
필수 여부: 아니요  
`onCancel` 속성은 다음 작업으로 이동을 지원하지 않습니다.  
+ `aws:approve`
+ `aws:copyImage`
+ `aws:createImage`
+ `aws:createStack`
+ `aws:createTags`
+ `aws:loop`
+ `aws:pause`
+ `aws:runInstances`
+ `aws:sleep`

[isEnd](#endProp)  
이 옵션은 특정 단계 종료 시 자동화를 중지합니다. 단계가 실패하거나 성공한 경우 자동화가 중지됩니다. 기본값은 false입니다.  
유형: Boolean  
유효한 값: true \| false  
필수 여부: 아니요

[nextStep](#nextProp)  
한 단계를 성공적으로 완료한 후 다음에 처리할 자동화의 단계를 지정합니다.  
유형: 문자열  
필수 여부: 아니요

[isCritical](#critProp)  
자동화의 성공적 완료에 대해 단계를 심각으로 지정합니다. 이 지정이 있는 단계가 실패하면 자동화는 자동화의 최종 상태를 실패로 보고합니다. 이 속성은 단계에서 명시적으로 정의하는 경우에만 평가됩니다. 단계에서 `onFailure` 속성이 `Continue`로 설정되면 기본값은 false입니다. 그렇지 않으면 이 옵션의 기본값은 true입니다.  
유형: 부울  
유효한 값: true \| false  
필수 여부: 아니요

[inputs](#inProp)  
작업에 특정한 속성.  
유형: 맵  
필수 여부: 예

### 예제
<a name="automation-demo"></a>

```
---
description: "Custom Automation Example"
schemaVersion: '0.3'
assumeRole: "{{ AutomationAssumeRole }}"
parameters:
  AutomationAssumeRole:
    type: String
    description: "(Required) The ARN of the role that allows Automation to perform
      the actions on your behalf. If no role is specified, Systems Manager Automation
      uses your IAM permissions to run this runbook."
    default: ''
  InstanceId:
      type: String
      description: "(Required) The Instance Id whose root EBS volume you want to restore the latest Snapshot."
      default: ''
mainSteps:
- name: getInstanceDetails
  action: aws:executeAwsApi
  onFailure: Abort
  inputs:
    Service: ec2
    Api: DescribeInstances
    InstanceIds:
    - "{{ InstanceId }}"
  outputs:
    - Name: availabilityZone
      Selector: "$.Reservations[0].Instances[0].Placement.AvailabilityZone"
      Type: String
    - Name: rootDeviceName
      Selector: "$.Reservations[0].Instances[0].RootDeviceName"
      Type: String
  nextStep: getRootVolumeId
- name: getRootVolumeId
  action: aws:executeAwsApi
  maxAttempts: 3
  onFailure: Abort
  inputs:
    Service: ec2
    Api: DescribeVolumes
    Filters:
    -  Name: attachment.device
       Values: ["{{ getInstanceDetails.rootDeviceName }}"]
    -  Name: attachment.instance-id
       Values: ["{{ InstanceId }}"]
  outputs:
    - Name: rootVolumeId
      Selector: "$.Volumes[0].VolumeId"
      Type: String
  nextStep: getSnapshotsByStartTime
- name: getSnapshotsByStartTime
  action: aws:executeScript
  timeoutSeconds: 45
  onFailure: Abort
  inputs:
    Runtime: python3.8
    Handler: getSnapshotsByStartTime
    InputPayload:
      rootVolumeId : "{{ getRootVolumeId.rootVolumeId }}"
    Script: |-
      def getSnapshotsByStartTime(events,context):
        import boto3

        #Initialize client
        ec2 = boto3.client('ec2')
        rootVolumeId = events['rootVolumeId']
        snapshotsQuery = ec2.describe_snapshots(
          Filters=[
            {
              "Name": "volume-id",
              "Values": [rootVolumeId]
            }
          ]
        )
        if not snapshotsQuery['Snapshots']:
          noSnapshotFoundString = "NoSnapshotFound"
          return { 'noSnapshotFound' : noSnapshotFoundString }
        else:
          jsonSnapshots = snapshotsQuery['Snapshots']
          sortedSnapshots = sorted(jsonSnapshots, key=lambda k: k['StartTime'], reverse=True)
          latestSortedSnapshotId = sortedSnapshots[0]['SnapshotId']
          return { 'latestSnapshotId' : latestSortedSnapshotId }
  outputs:
  - Name: Payload
    Selector: $.Payload
    Type: StringMap
  - Name: latestSnapshotId
    Selector: $.Payload.latestSnapshotId
    Type: String
  - Name: noSnapshotFound
    Selector: $.Payload.noSnapshotFound
    Type: String 
  nextStep: branchFromResults
- name: branchFromResults
  action: aws:branch
  onFailure: Abort
  onCancel: step:startInstance
  inputs:
    Choices:
    - NextStep: createNewRootVolumeFromSnapshot
      Not:
        Variable: "{{ getSnapshotsByStartTime.noSnapshotFound }}"
        StringEquals: "NoSnapshotFound"
  isEnd: true
- name: createNewRootVolumeFromSnapshot
  action: aws:executeAwsApi
  onFailure: Abort
  inputs:
    Service: ec2
    Api: CreateVolume
    AvailabilityZone: "{{ getInstanceDetails.availabilityZone }}"
    SnapshotId: "{{ getSnapshotsByStartTime.latestSnapshotId }}"
  outputs:
    - Name: newRootVolumeId
      Selector: "$.VolumeId"
      Type: String
  nextStep: stopInstance
- name: stopInstance
  action: aws:executeAwsApi
  onFailure: Abort
  inputs:
    Service: ec2
    Api: StopInstances
    InstanceIds:
    - "{{ InstanceId }}"
  nextStep: verifyVolumeAvailability
- name: verifyVolumeAvailability
  action: aws:waitForAwsResourceProperty
  timeoutSeconds: 120
  inputs:
    Service: ec2
    Api: DescribeVolumes
    VolumeIds:
    - "{{ createNewRootVolumeFromSnapshot.newRootVolumeId }}"
    PropertySelector: "$.Volumes[0].State"
    DesiredValues:
    - "available"
  nextStep: verifyInstanceStopped
- name: verifyInstanceStopped
  action: aws:waitForAwsResourceProperty
  timeoutSeconds: 120
  inputs:
    Service: ec2
    Api: DescribeInstances
    InstanceIds:
    - "{{ InstanceId }}"
    PropertySelector: "$.Reservations[0].Instances[0].State.Name"
    DesiredValues:
    - "stopped"
  nextStep: detachRootVolume
- name: detachRootVolume
  action: aws:executeAwsApi
  onFailure: Abort
  isCritical: true
  inputs:
    Service: ec2
    Api: DetachVolume
    VolumeId: "{{ getRootVolumeId.rootVolumeId }}"
  nextStep: verifyRootVolumeDetached
- name: verifyRootVolumeDetached
  action: aws:waitForAwsResourceProperty
  timeoutSeconds: 30
  inputs:
    Service: ec2
    Api: DescribeVolumes
    VolumeIds:
    - "{{ getRootVolumeId.rootVolumeId }}"
    PropertySelector: "$.Volumes[0].State"
    DesiredValues:
    - "available"
  nextStep: attachNewRootVolume
- name: attachNewRootVolume
  action: aws:executeAwsApi
  onFailure: Abort
  inputs:
    Service: ec2
    Api: AttachVolume
    Device: "{{ getInstanceDetails.rootDeviceName }}"
    InstanceId: "{{ InstanceId }}"
    VolumeId: "{{ createNewRootVolumeFromSnapshot.newRootVolumeId }}"
  nextStep: verifyNewRootVolumeAttached
- name: verifyNewRootVolumeAttached
  action: aws:waitForAwsResourceProperty
  timeoutSeconds: 30
  inputs:
    Service: ec2
    Api: DescribeVolumes
    VolumeIds:
    - "{{ createNewRootVolumeFromSnapshot.newRootVolumeId }}"
    PropertySelector: "$.Volumes[0].Attachments[0].State"
    DesiredValues:
    - "attached"
  nextStep: startInstance
- name: startInstance
  action: aws:executeAwsApi
  onFailure: Abort
  inputs:
    Service: ec2
    Api: StartInstances
    InstanceIds:
    - "{{ InstanceId }}"
```