StartAutomationExecution - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

StartAutomationExecution

Initiates execution of an Automation runbook.

Request Syntax

{ "AlarmConfiguration": { "Alarms": [ { "Name": "string" } ], "IgnorePollAlarmFailure": boolean }, "ClientToken": "string", "DocumentName": "string", "DocumentVersion": "string", "MaxConcurrency": "string", "MaxErrors": "string", "Mode": "string", "Parameters": { "string" : [ "string" ] }, "Tags": [ { "Key": "string", "Value": "string" } ], "TargetLocations": [ { "Accounts": [ "string" ], "ExecutionRoleName": "string", "Regions": [ "string" ], "TargetLocationAlarmConfiguration": { "Alarms": [ { "Name": "string" } ], "IgnorePollAlarmFailure": boolean }, "TargetLocationMaxConcurrency": "string", "TargetLocationMaxErrors": "string" } ], "TargetMaps": [ { "string" : [ "string" ] } ], "TargetParameterName": "string", "Targets": [ { "Key": "string", "Values": [ "string" ] } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

AlarmConfiguration

The CloudWatch alarm you want to apply to your automation.

Type: AlarmConfiguration object

Required: No

ClientToken

User-provided idempotency token. The token must be unique, is case insensitive, enforces the UUID format, and can't be reused.

Type: String

Length Constraints: Fixed length of 36.

Pattern: [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}

Required: No

DocumentName

The name of the SSM document to run. This can be a public document or a custom document. To run a shared document belonging to another account, specify the document ARN. For more information about how to use shared documents, see Sharing SSM documents in the Amazon Systems Manager User Guide.

Type: String

Pattern: ^[a-zA-Z0-9_\-.:/]{3,128}$

Required: Yes

DocumentVersion

The version of the Automation runbook to use for this execution.

Type: String

Pattern: ([$]LATEST|[$]DEFAULT|^[1-9][0-9]*$)

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%. The default value is 10.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 7.

Pattern: ^([1-9][0-9]*|[1-9][0-9]%|[1-9]%|100%)$

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 max-errors to 10%, then the system stops running the automation on additional targets when the sixth error is received.

Executions that are already running an automation when max-errors is reached are allowed to complete, but some of these executions may fail as well. If you need to ensure that there won't be more than max-errors failed executions, set max-concurrency to 1 so the executions proceed one at a time.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 7.

Pattern: ^([1-9][0-9]*|[0]|[1-9][0-9]%|[0-9]%|100%)$

Required: No

Mode

The execution mode of the automation. Valid modes include the following: Auto and Interactive. The default mode is Auto.

Type: String

Valid Values: Auto | Interactive

Required: No

Parameters

A key-value map of execution parameters, which match the declared parameters in the Automation runbook.

Type: String to array of strings map

Map Entries: Maximum number of 200 items.

Key Length Constraints: Minimum length of 1. Maximum length of 50.

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Length Constraints: Minimum length of 1. Maximum length of 512.

Required: No

Tags

Optional metadata that you assign to a resource. You can specify a maximum of five tags for an automation. Tags enable you to categorize a resource in different ways, such as by purpose, owner, or environment. For example, you might want to tag an automation to identify an environment or operating system. In this case, you could specify the following key-value pairs:

  • Key=environment,Value=test

  • Key=OS,Value=Windows

Note

To add tags to an existing automation, use the AddTagsToResource operation.

Type: Array of Tag objects

Array Members: Maximum number of 1000 items.

Required: No

TargetLocations

A location is a combination of Amazon Web Services Regions and/or Amazon Web Services accounts where you want to run the automation. Use this operation to start an automation in multiple Amazon Web Services Regions and multiple Amazon Web Services accounts. For more information, see Running Automation workflows in multiple Amazon Web Services Regions and Amazon Web Services accounts in the Amazon Systems Manager User Guide.

Type: Array of TargetLocation objects

Array Members: Minimum number of 1 item. Maximum number of 100 items.

Required: No

TargetMaps

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

Type: Array of string to array of strings maps

Array Members: Minimum number of 0 items. Maximum number of 300 items.

Map Entries: Maximum number of 20 items.

Key Length Constraints: Minimum length of 1. Maximum length of 50.

Array Members: Minimum number of 0 items. Maximum number of 25 items.

Length Constraints: Minimum length of 1. Maximum length of 50.

Required: No

TargetParameterName

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

Type: String

Length Constraints: Minimum length of 1. Maximum length of 50.

Required: No

Targets

A key-value mapping to target resources. Required if you specify TargetParameterName.

Type: Array of Target objects

Array Members: Minimum number of 0 items. Maximum number of 5 items.

Required: No

Response Syntax

{ "AutomationExecutionId": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

AutomationExecutionId

The unique ID of a newly scheduled automation execution.

Type: String

Length Constraints: Fixed length of 36.

Errors

For information about the errors that are common to all actions, see Common Errors.

AutomationDefinitionNotFoundException

An Automation runbook with the specified name couldn't be found.

HTTP Status Code: 400

AutomationDefinitionVersionNotFoundException

An Automation runbook with the specified name and version couldn't be found.

HTTP Status Code: 400

AutomationExecutionLimitExceededException

The number of simultaneously running Automation executions exceeded the allowable limit.

HTTP Status Code: 400

IdempotentParameterMismatch

Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token.

HTTP Status Code: 400

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

InvalidAutomationExecutionParametersException

The supplied parameters for invoking the specified Automation runbook are incorrect. For example, they may not match the set of parameters permitted for the specified Automation document.

HTTP Status Code: 400

InvalidTarget

The target isn't valid or doesn't exist. It might not be configured for Systems Manager or you might not have permission to perform the operation.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of StartAutomationExecution.

Sample Request

POST / HTTP/1.1 Host: ssm.us-east-2.amazonaws.com Accept-Encoding: identity X-Amz-Target: AmazonSSM.StartAutomationExecution Content-Type: application/x-amz-json-1.1 User-Agent: aws-cli/1.17.12 Python/3.6.8 Darwin/18.7.0 botocore/1.14.12 X-Amz-Date: 20200325T162110Z Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20200325/us-east-2/ssm/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=39c3b3042cd2aEXAMPLE Content-Length: 86 { "DocumentName": "Example", "Parameters": { "InstanceId": [ "i-02573cafcfEXAMPLE" ] } }

Sample Response

{ "AutomationExecutionId": "832a6fba-f4f0-4b2a-ab85-587adEXAMPLE" }

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: