SSM / Client / start_execution_preview
start_execution_preview#
- SSM.Client.start_execution_preview(**kwargs)#
Initiates the process of creating a preview showing the effects that running a specified Automation runbook would have on the targeted resources.
See also: AWS API Documentation
Request Syntax
response = client.start_execution_preview( DocumentName='string', DocumentVersion='string', ExecutionInputs={ 'Automation': { 'Parameters': { 'string': [ 'string', ] }, 'TargetParameterName': 'string', 'Targets': [ { 'Key': 'string', 'Values': [ 'string', ] }, ], 'TargetMaps': [ { 'string': [ 'string', ] }, ], 'TargetLocations': [ { 'Accounts': [ 'string', ], 'Regions': [ 'string', ], 'TargetLocationMaxConcurrency': 'string', 'TargetLocationMaxErrors': 'string', 'ExecutionRoleName': 'string', 'TargetLocationAlarmConfiguration': { 'IgnorePollAlarmFailure': True|False, 'Alarms': [ { 'Name': 'string' }, ] }, 'IncludeChildOrganizationUnits': True|False, 'ExcludeAccounts': [ 'string', ], 'Targets': [ { 'Key': 'string', 'Values': [ 'string', ] }, ], 'TargetsMaxConcurrency': 'string', 'TargetsMaxErrors': 'string' }, ], 'TargetLocationsURL': 'string' } } )
- Parameters:
DocumentName (string) –
[REQUIRED]
The name of the Automation runbook to run. The result of the execution preview indicates what the impact would be of running this runbook.
DocumentVersion (string) – The version of the Automation runbook to run. The default value is
$DEFAULT
.ExecutionInputs (dict) –
Information about the inputs that can be specified for the preview operation.
Note
This is a Tagged Union structure. Only one of the following top level keys can be set:
Automation
.Automation (dict) –
Information about the optional inputs that can be specified for an automation execution preview.
Parameters (dict) –
Information about parameters that can be specified for the preview operation.
(string) –
(list) –
(string) –
TargetParameterName (string) –
The name of the parameter used as the target resource for the rate-controlled execution. Required if you specify targets.
Targets (list) –
Information about the resources that would be included in the actual runbook execution, if it were to be run. Both Targets and TargetMaps can’t be specified together.
(dict) –
An array of search criteria that targets managed nodes using a key-value pair that you specify.
Note
One or more targets must be specified for maintenance window Run Command-type tasks. Depending on the task, targets are optional for other maintenance window task types (Automation, Lambda, and Step Functions). For more information about running tasks that don’t specify targets, see Registering maintenance window tasks without targets in the Amazon Web Services Systems Manager User Guide.
Supported formats include the following.
For all Systems Manager capabilities:
Key=tag-key,Values=tag-value-1,tag-value-2
For Automation and Change Manager:
Key=tag:tag-key,Values=tag-value
Key=ResourceGroup,Values=resource-group-name
Key=ParameterValues,Values=value-1,value-2,value-3
To target all instances in the Amazon Web Services Region:
Key=AWS::EC2::Instance,Values=*
Key=InstanceIds,Values=*
For Run Command and Maintenance Windows:
Key=InstanceIds,Values=instance-id-1,instance-id-2,instance-id-3
Key=tag:tag-key,Values=tag-value-1,tag-value-2
Key=resource-groups:Name,Values=resource-group-name
Additionally, Maintenance Windows support targeting resource types:
Key=resource-groups:ResourceTypeFilters,Values=resource-type-1,resource-type-2
For State Manager:
Key=InstanceIds,Values=instance-id-1,instance-id-2,instance-id-3
Key=tag:tag-key,Values=tag-value-1,tag-value-2
To target all instances in the Amazon Web Services Region:
Key=InstanceIds,Values=*
For more information about how to send commands that target managed nodes using
Key,Value
parameters, see Targeting multiple managed nodes in the Amazon Web Services Systems Manager User Guide.Key (string) –
User-defined criteria for sending commands that target managed nodes that meet the criteria.
Values (list) –
User-defined criteria that maps to
Key
. For example, if you specifiedtag:ServerRole
, you could specifyvalue:WebServer
to run a command on instances that include EC2 tags ofServerRole,WebServer
.Depending on the type of target, the maximum number of values for a key might be lower than the global maximum of 50.
(string) –
TargetMaps (list) –
A key-value mapping of document parameters to target resources. Both Targets and TargetMaps can’t be specified together.
(dict) –
(string) –
(list) –
(string) –
TargetLocations (list) –
Information about the Amazon Web Services Regions and Amazon Web Services accounts targeted by the Automation execution preview operation.
(dict) –
The combination of Amazon Web Services Regions and Amazon Web Services accounts targeted by the current Automation execution.
Accounts (list) –
The Amazon Web Services accounts targeted by the current Automation execution.
(string) –
Regions (list) –
The Amazon Web Services Regions targeted by the current Automation execution.
(string) –
TargetLocationMaxConcurrency (string) –
The maximum number of Amazon Web Services Regions and Amazon Web Services accounts allowed to run the Automation concurrently.
TargetLocationMaxErrors (string) –
The maximum number of errors allowed before the system stops queueing additional Automation executions for the currently running Automation.
ExecutionRoleName (string) –
The Automation execution role used by the currently running Automation. If not specified, the default value is
AWS-SystemsManager-AutomationExecutionRole
.TargetLocationAlarmConfiguration (dict) –
The details for the CloudWatch alarm you want to apply to an automation or command.
IgnorePollAlarmFailure (boolean) –
When this value is true, your automation or command continues to run in cases where we can’t retrieve alarm status information from CloudWatch. In cases where we successfully retrieve an alarm status of OK or INSUFFICIENT_DATA, the automation or command continues to run, regardless of this value. Default is false.
Alarms (list) – [REQUIRED]
The name of the CloudWatch alarm specified in the configuration.
(dict) –
A CloudWatch alarm you apply to an automation or command.
Name (string) – [REQUIRED]
The name of your CloudWatch alarm.
IncludeChildOrganizationUnits (boolean) –
Indicates whether to include child organizational units (OUs) that are children of the targeted OUs. The default is
false
.ExcludeAccounts (list) –
Amazon Web Services accounts or organizational units to exclude as expanded targets.
(string) –
Targets (list) –
A list of key-value mappings to target resources. If you specify values for this data type, you must also specify a value for
TargetParameterName
.This
Targets
parameter takes precedence over theStartAutomationExecution:Targets
parameter if both are supplied.(dict) –
An array of search criteria that targets managed nodes using a key-value pair that you specify.
Note
One or more targets must be specified for maintenance window Run Command-type tasks. Depending on the task, targets are optional for other maintenance window task types (Automation, Lambda, and Step Functions). For more information about running tasks that don’t specify targets, see Registering maintenance window tasks without targets in the Amazon Web Services Systems Manager User Guide.
Supported formats include the following.
For all Systems Manager capabilities:
Key=tag-key,Values=tag-value-1,tag-value-2
For Automation and Change Manager:
Key=tag:tag-key,Values=tag-value
Key=ResourceGroup,Values=resource-group-name
Key=ParameterValues,Values=value-1,value-2,value-3
To target all instances in the Amazon Web Services Region:
Key=AWS::EC2::Instance,Values=*
Key=InstanceIds,Values=*
For Run Command and Maintenance Windows:
Key=InstanceIds,Values=instance-id-1,instance-id-2,instance-id-3
Key=tag:tag-key,Values=tag-value-1,tag-value-2
Key=resource-groups:Name,Values=resource-group-name
Additionally, Maintenance Windows support targeting resource types:
Key=resource-groups:ResourceTypeFilters,Values=resource-type-1,resource-type-2
For State Manager:
Key=InstanceIds,Values=instance-id-1,instance-id-2,instance-id-3
Key=tag:tag-key,Values=tag-value-1,tag-value-2
To target all instances in the Amazon Web Services Region:
Key=InstanceIds,Values=*
For more information about how to send commands that target managed nodes using
Key,Value
parameters, see Targeting multiple managed nodes in the Amazon Web Services Systems Manager User Guide.Key (string) –
User-defined criteria for sending commands that target managed nodes that meet the criteria.
Values (list) –
User-defined criteria that maps to
Key
. For example, if you specifiedtag:ServerRole
, you could specifyvalue:WebServer
to run a command on instances that include EC2 tags ofServerRole,WebServer
.Depending on the type of target, the maximum number of values for a key might be lower than the global maximum of 50.
(string) –
TargetsMaxConcurrency (string) –
The maximum number of targets allowed to run this task in parallel. This
TargetsMaxConcurrency
takes precedence over theStartAutomationExecution:MaxConcurrency
parameter if both are supplied.TargetsMaxErrors (string) –
The maximum number of errors that are allowed before the system stops running the automation on additional targets. This
TargetsMaxErrors
parameter takes precedence over theStartAutomationExecution:MaxErrors
parameter if both are supplied.
TargetLocationsURL (string) –
A publicly accessible URL for a file that contains the
TargetLocations
body. Currently, only files in presigned Amazon S3 buckets are supported.
- Return type:
dict
- Returns:
Response Syntax
{ 'ExecutionPreviewId': 'string' }
Response Structure
(dict) –
ExecutionPreviewId (string) –
The ID of the execution preview generated by the system.
Exceptions
SSM.Client.exceptions.InternalServerError
SSM.Client.exceptions.ValidationException