aws:executeAutomation – Run another automation - AWS Systems Manager

aws:executeAutomation – Run another automation

Runs a secondary automation by calling a secondary runbook. With this action, you can create runbooks for your most common operations, and reference those runbooks during an automation. This action can simplify your runbooks by removing the need to duplicate steps across similar runbooks.

The secondary automation runs in the context of the user who initiated the primary automation. This means that the secondary automation uses the same AWS Identity and Access Management (IAM) role or user account as the user who started the first automation.

Important

If you specify parameters in a secondary automation that use an assume role (a role that uses the iam:passRole policy), then the user or role that initiated the primary automation must have permission to pass the assume role specified in the secondary automation. For more information about setting up an assume role for Automation, see Method 2: Use IAM to configure roles for Automation.

Input

YAML
name: Secondary_Automation action: aws:executeAutomation maxAttempts: 3 timeoutSeconds: 3600 onFailure: Abort inputs: DocumentName: secondaryAutomation RuntimeParameters: instanceIds: - i-1234567890abcdef0
JSON
{ "name":"Secondary_Automation", "action":"aws:executeAutomation", "maxAttempts":3, "timeoutSeconds":3600, "onFailure":"Abort", "inputs":{ "DocumentName":"secondaryAutomation", "RuntimeParameters":{ "instanceIds":[ "i-1234567890abcdef0" ] } } }
DocumentName

The name of the secondary runbook to run during the step. For runbooks in the same AWS account, specify the runbook name. For runbooks shared from a different AWS account, specify the Amazon Resource Name (ARN) of the runbook. For information about using shared runbooks, see Using shared SSM documents.

Type: String

Required: Yes

DocumentVersion

The version of the secondary runbook to run. If not specified, Automation runs the default runbook version.

Type: String

Required: No

MaxConcurrency

The maximum number of targets allowed to run this task in parallel. You can specify a number, such as 10, or a percentage, such as 10%.

Type: String

Required: No

MaxErrors

The number of errors that are allowed before the system stops running the automation on additional targets. You can specify either an absolute number of errors, for example 10, or a percentage of the target set, for example 10%. If you specify 3, for example, the system stops running the automation when the fourth error is received. If you specify 0, then the system stops running the automation on additional targets after the first error result is returned. If you run an automation on 50 resources and set MaxErrors to 10%, then the system stops running the automation on additional targets when the sixth error is received.

Automations that are already running when the MaxErrors threshold is reached are allowed to complete, but some of these automations may fail as well. If you need to ensure that there won't be more failed automations than the specified MaxErrors, set MaxConcurrency to 1 so the automations proceed one at a time.

Type: String

Required: No

RuntimeParameters

Required parameters for the secondary runbook. The mapping uses the following format: {"parameter1" : "value1", "parameter2" : "value2" }

Type: Map

Required: No

Tags

Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation.

Type: MapList

Required: No

TargetLocations

A location is a combination of AWS Regions and/or AWS accounts where you want to run the automation. A minimum number of 1 item must be specified and a maximum number of 100 items can be specified.

Type: MapList

Required: No

TargetMaps

A list of key-value mappings of document parameters to target resources. Both Targets and TargetMaps can't be specified together.

Type: MapList

Required: No

TargetParameterName

The name of the parameter used as the target resource for the rate-controlled automation. Required if you specify Targets.

Type: String

Required: No

Targets

A list of key-value mappings to target resources. Required if you specify TargetParameterName.

Type: MapList

Required: No

Output

Output

The output generated by the secondary automation. You can reference the output by using the following format: Secondary_Automation_Step_Name.Output

Type: StringList

Here is an example:

- name: launchNewWindowsInstance action: 'aws:executeAutomation' onFailure: Abort inputs: DocumentName: launchWindowsInstance nextStep: getNewInstanceRootVolume - name: getNewInstanceRootVolume action: 'aws:executeAwsApi' onFailure: Abort inputs: Service: ec2 Api: DescribeVolumes Filters: - Name: attachment.device Values: - /dev/sda1 - Name: attachment.instance-id Values: - '{{launchNewWindowsInstance.Output}}' outputs: - Name: rootVolumeId Selector: '$.Volumes[0].VolumeId' Type: String nextStep: snapshotRootVolume - name: snapshotRootVolume action: 'aws:executeAutomation' onFailure: Abort inputs: DocumentName: AWS-CreateSnapshot RuntimeParameters: VolumeId: - '{{getNewInstanceRootVolume.rootVolumeId}}' Description: - 'Initial root snapshot for {{launchNewWindowsInstance.Output}}'
ExecutionId

The ID of the secondary automation.

Type: String

Status

The status of the secondary automation.

Type: String