Amazon Simple Systems Manager (SSM)

2019/12/19 - Amazon Simple Systems Manager (SSM) - 2 updated api methods

Changes  This release allows customers to add tags to Automation execution, enabling them to sort and filter executions in different ways, such as by resource, purpose, owner, or environment.

DescribeAutomationExecutions (updated) Link ¶
Changes (request)
{'Filters': {'Key': ['TagKey']}}

Provides details about all active and terminated Automation executions.

See also: AWS API Documentation

Request Syntax

client.describe_automation_executions(
    Filters=[
        {
            'Key': 'DocumentNamePrefix'|'ExecutionStatus'|'ExecutionId'|'ParentExecutionId'|'CurrentAction'|'StartTimeBefore'|'StartTimeAfter'|'AutomationType'|'TagKey',
            'Values': [
                'string',
            ]
        },
    ],
    MaxResults=123,
    NextToken='string'
)
type Filters

list

param Filters

Filters used to limit the scope of executions that are requested.

  • (dict) --

    A filter used to match specific automation executions. This is used to limit the scope of Automation execution information returned.

    • Key (string) -- [REQUIRED]

      One or more keys to limit the results. Valid filter keys include the following: DocumentNamePrefix, ExecutionStatus, ExecutionId, ParentExecutionId, CurrentAction, StartTimeBefore, StartTimeAfter.

    • Values (list) -- [REQUIRED]

      The values used to limit the execution information associated with the filter's key.

      • (string) --

type MaxResults

integer

param MaxResults

The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

type NextToken

string

param NextToken

The token for the next set of items to return. (You received this token from a previous call.)

rtype

dict

returns

Response Syntax

{
    'AutomationExecutionMetadataList': [
        {
            'AutomationExecutionId': 'string',
            'DocumentName': 'string',
            'DocumentVersion': 'string',
            'AutomationExecutionStatus': 'Pending'|'InProgress'|'Waiting'|'Success'|'TimedOut'|'Cancelling'|'Cancelled'|'Failed',
            'ExecutionStartTime': datetime(2015, 1, 1),
            'ExecutionEndTime': datetime(2015, 1, 1),
            'ExecutedBy': 'string',
            'LogFile': 'string',
            'Outputs': {
                'string': [
                    'string',
                ]
            },
            'Mode': 'Auto'|'Interactive',
            'ParentAutomationExecutionId': 'string',
            'CurrentStepName': 'string',
            'CurrentAction': 'string',
            'FailureMessage': 'string',
            'TargetParameterName': 'string',
            'Targets': [
                {
                    'Key': 'string',
                    'Values': [
                        'string',
                    ]
                },
            ],
            'TargetMaps': [
                {
                    'string': [
                        'string',
                    ]
                },
            ],
            'ResolvedTargets': {
                'ParameterValues': [
                    'string',
                ],
                'Truncated': True|False
            },
            'MaxConcurrency': 'string',
            'MaxErrors': 'string',
            'Target': 'string',
            'AutomationType': 'CrossAccount'|'Local'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • AutomationExecutionMetadataList (list) --

      The list of details about each automation execution which has occurred which matches the filter specification, if any.

      • (dict) --

        Details about a specific Automation execution.

        • AutomationExecutionId (string) --

          The execution ID.

        • DocumentName (string) --

          The name of the Automation document used during execution.

        • DocumentVersion (string) --

          The document version used during the execution.

        • AutomationExecutionStatus (string) --

          The status of the execution. Valid values include: Running, Succeeded, Failed, Timed out, or Cancelled.

        • ExecutionStartTime (datetime) --

          The time the execution started.>

        • ExecutionEndTime (datetime) --

          The time the execution finished. This is not populated if the execution is still in progress.

        • ExecutedBy (string) --

          The IAM role ARN of the user who ran the Automation.

        • LogFile (string) --

          An Amazon S3 bucket where execution information is stored.

        • Outputs (dict) --

          The list of execution outputs as defined in the Automation document.

          • (string) --

            • (list) --

              • (string) --

        • Mode (string) --

          The Automation execution mode.

        • ParentAutomationExecutionId (string) --

          The ExecutionId of the parent Automation.

        • CurrentStepName (string) --

          The name of the step that is currently running.

        • CurrentAction (string) --

          The action of the step that is currently running.

        • FailureMessage (string) --

          The list of execution outputs as defined in the Automation document.

        • TargetParameterName (string) --

          The list of execution outputs as defined in the Automation document.

        • Targets (list) --

          The targets defined by the user when starting the Automation.

          • (dict) --

            An array of search criteria that targets instances using a Key,Value combination that you specify.

            Supported formats include the following.

            • ``Key=InstanceIds,Values=*instance-id-1* ,*instance-id-2* ,*instance-id-3* ``

            • ``Key=tag:my-tag-key ,Values=*my-tag-value-1* ,*my-tag-value-2* ``

            • ``Key=tag-key,Values=*my-tag-key-1* ,*my-tag-key-2* ``

            • (Maintenance window targets only) ``Key=resource-groups:Name,Values=*resource-group-name* ``

            • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*resource-type-1* ,*resource-type-2* ``

            For example:

            • Key=InstanceIds,Values=i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE,i-07782c72faEXAMPLE

            • Key=tag:CostCenter,Values=CostCenter1,CostCenter2,CostCenter3

            • Key=tag-key,Values=Name,Instance-Type,CostCenter

            • (Maintenance window targets only) Key=resource-groups:Name,Values=ProductionResourceGroup This example demonstrates how to target all resources in the resource group ProductionResourceGroup in your maintenance window.

            • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*AWS::EC2::INSTANCE* ,*AWS::EC2::VPC* `` This example demonstrates how to target only Amazon EC2 instances and VPCs in your maintenance window.

            • (State Manager association targets only) Key=InstanceIds,Values=* This example demonstrates how to target all managed instances in the AWS Region where the association was created.

            For information about how to send commands that target instances using Key,Value parameters, see Using Targets and Rate Controls to Send Commands to a Fleet in the AWS Systems Manager User Guide .

            • Key (string) --

              User-defined criteria for sending commands that target instances that meet the criteria.

            • Values (list) --

              User-defined criteria that maps to Key . For example, if you specified tag:ServerRole , you could specify value:WebServer to run a command on instances that include Amazon EC2 tags of ServerRole,WebServer .

              • (string) --

        • TargetMaps (list) --

          The specified key-value mapping of document parameters to target resources.

          • (dict) --

            • (string) --

              • (list) --

                • (string) --

        • ResolvedTargets (dict) --

          A list of targets that resolved during the execution.

          • ParameterValues (list) --

            A list of parameter values sent to targets that resolved during the Automation execution.

            • (string) --

          • Truncated (boolean) --

            A boolean value indicating whether the resolved target list is truncated.

        • MaxConcurrency (string) --

          The MaxConcurrency value specified by the user when starting the Automation.

        • MaxErrors (string) --

          The MaxErrors value specified by the user when starting the Automation.

        • Target (string) --

          The list of execution outputs as defined in the Automation document.

        • AutomationType (string) --

          Use this filter with DescribeAutomationExecutions . Specify either Local or CrossAccount. CrossAccount is an Automation that runs in multiple AWS Regions and accounts. For more information, see Executing Automations in Multiple AWS Regions and Accounts in the AWS Systems Manager User Guide .

    • NextToken (string) --

      The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.

StartAutomationExecution (updated) Link ¶
Changes (request)
{'Tags': [{'Key': 'string', 'Value': 'string'}]}

Initiates execution of an Automation document.

See also: AWS API Documentation

Request Syntax

client.start_automation_execution(
    DocumentName='string',
    DocumentVersion='string',
    Parameters={
        'string': [
            'string',
        ]
    },
    ClientToken='string',
    Mode='Auto'|'Interactive',
    TargetParameterName='string',
    Targets=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ]
        },
    ],
    TargetMaps=[
        {
            'string': [
                'string',
            ]
        },
    ],
    MaxConcurrency='string',
    MaxErrors='string',
    TargetLocations=[
        {
            'Accounts': [
                'string',
            ],
            'Regions': [
                'string',
            ],
            'TargetLocationMaxConcurrency': 'string',
            'TargetLocationMaxErrors': 'string',
            'ExecutionRoleName': 'string'
        },
    ],
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ]
)
type DocumentName

string

param DocumentName

[REQUIRED]

The name of the Automation document to use for this execution.

type DocumentVersion

string

param DocumentVersion

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

type Parameters

dict

param Parameters

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

  • (string) --

    • (list) --

      • (string) --

type ClientToken

string

param ClientToken

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

type Mode

string

param Mode

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

type TargetParameterName

string

param TargetParameterName

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

type Targets

list

param Targets

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

  • (dict) --

    An array of search criteria that targets instances using a Key,Value combination that you specify.

    Supported formats include the following.

    • ``Key=InstanceIds,Values=*instance-id-1* ,*instance-id-2* ,*instance-id-3* ``

    • ``Key=tag:my-tag-key ,Values=*my-tag-value-1* ,*my-tag-value-2* ``

    • ``Key=tag-key,Values=*my-tag-key-1* ,*my-tag-key-2* ``

    • (Maintenance window targets only) ``Key=resource-groups:Name,Values=*resource-group-name* ``

    • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*resource-type-1* ,*resource-type-2* ``

    For example:

    • Key=InstanceIds,Values=i-02573cafcfEXAMPLE,i-0471e04240EXAMPLE,i-07782c72faEXAMPLE

    • Key=tag:CostCenter,Values=CostCenter1,CostCenter2,CostCenter3

    • Key=tag-key,Values=Name,Instance-Type,CostCenter

    • (Maintenance window targets only) Key=resource-groups:Name,Values=ProductionResourceGroup This example demonstrates how to target all resources in the resource group ProductionResourceGroup in your maintenance window.

    • (Maintenance window targets only) ``Key=resource-groups:ResourceTypeFilters,Values=*AWS::EC2::INSTANCE* ,*AWS::EC2::VPC* `` This example demonstrates how to target only Amazon EC2 instances and VPCs in your maintenance window.

    • (State Manager association targets only) Key=InstanceIds,Values=* This example demonstrates how to target all managed instances in the AWS Region where the association was created.

    For information about how to send commands that target instances using Key,Value parameters, see Using Targets and Rate Controls to Send Commands to a Fleet in the AWS Systems Manager User Guide .

    • Key (string) --

      User-defined criteria for sending commands that target instances that meet the criteria.

    • Values (list) --

      User-defined criteria that maps to Key . For example, if you specified tag:ServerRole , you could specify value:WebServer to run a command on instances that include Amazon EC2 tags of ServerRole,WebServer .

      • (string) --

type TargetMaps

list

param TargetMaps

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

  • (dict) --

    • (string) --

      • (list) --

        • (string) --

type MaxConcurrency

string

param 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 MaxErrors

string

param 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 TargetLocations

list

param TargetLocations

A location is a combination of AWS Regions and/or AWS accounts where you want to run the Automation. Use this action to start an Automation in multiple Regions and multiple accounts. For more information, see Executing Automations in Multiple AWS Regions and Accounts in the AWS Systems Manager User Guide .

  • (dict) --

    The combination of AWS Regions and accounts targeted by the current Automation execution.

    • Accounts (list) --

      The AWS accounts targeted by the current Automation execution.

      • (string) --

    • Regions (list) --

      The AWS Regions targeted by the current Automation execution.

      • (string) --

    • TargetLocationMaxConcurrency (string) --

      The maximum number of AWS accounts and AWS regions 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.

type Tags

list

param 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 name/value pairs:

  • Key=environment,Value=test

  • Key=OS,Value=Windows

Note

To add tags to an existing patch baseline, use the AddTagsToResource action.

  • (dict) --

    Metadata that you assign to your AWS resources. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment. In Systems Manager, you can apply tags to documents, managed instances, maintenance windows, Parameter Store parameters, and patch baselines.

    • Key (string) -- [REQUIRED]

      The name of the tag.

    • Value (string) -- [REQUIRED]

      The value of the tag.

rtype

dict

returns

Response Syntax

{
    'AutomationExecutionId': 'string'
}

Response Structure

  • (dict) --

    • AutomationExecutionId (string) --

      The unique ID of a newly scheduled automation execution.