SSM / Paginator / ListCommandInvocations

ListCommandInvocations#

class SSM.Paginator.ListCommandInvocations#
paginator = client.get_paginator('list_command_invocations')
paginate(**kwargs)#

Creates an iterator that will paginate through responses from SSM.Client.list_command_invocations().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    CommandId='string',
    InstanceId='string',
    Filters=[
        {
            'key': 'InvokedAfter'|'InvokedBefore'|'Status'|'ExecutionStage'|'DocumentName',
            'value': 'string'
        },
    ],
    Details=True|False,
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters:
  • CommandId (string) – (Optional) The invocations for a specific command ID.

  • InstanceId (string) – (Optional) The command execution details for a specific managed node ID.

  • Filters (list) –

    (Optional) One or more filters. Use a filter to return a more specific list of results.

    • (dict) –

      Describes a command filter.

      Note

      A managed node ID can’t be specified when a command status is Pending because the command hasn’t run on the node yet.

      • key (string) – [REQUIRED]

        The name of the filter.

        Note

        The ExecutionStage filter can’t be used with the ListCommandInvocations operation, only with ListCommands.

      • value (string) – [REQUIRED]

        The filter value. Valid values for each filter key are as follows:

        • InvokedAfter: Specify a timestamp to limit your results. For example, specify 2021-07-07T00:00:00Z to see a list of command executions occurring July 7, 2021, and later.

        • InvokedBefore: Specify a timestamp to limit your results. For example, specify 2021-07-07T00:00:00Z to see a list of command executions from before July 7, 2021.

        • Status: Specify a valid command status to see a list of all command executions with that status. The status choices depend on the API you call. The status values you can specify for ListCommands are:

          • Pending

          • InProgress

          • Success

          • Cancelled

          • Failed

          • TimedOut (this includes both Delivery and Execution time outs)

          • AccessDenied

          • DeliveryTimedOut

          • ExecutionTimedOut

          • Incomplete

          • NoInstancesInTag

          • LimitExceeded

        The status values you can specify for ListCommandInvocations are:

        • Pending

        • InProgress

        • Delayed

        • Success

        • Cancelled

        • Failed

        • TimedOut (this includes both Delivery and Execution time outs)

        • AccessDenied

        • DeliveryTimedOut

        • ExecutionTimedOut

        • Undeliverable

        • InvalidPlatform

        • Terminated

        • DocumentName: Specify name of the Amazon Web Services Systems Manager document (SSM document) for which you want to see command execution results. For example, specify AWS-RunPatchBaseline to see command executions that used this SSM document to perform security patching operations on managed nodes.

        • ExecutionStage: Specify one of the following values ( ListCommands operations only):

          • Executing: Returns a list of command executions that are currently still running.

          • Complete: Returns a list of command executions that have already completed.

  • Details (boolean) – (Optional) If set this returns the response of the command executions and any command output. The default value is false.

  • PaginationConfig (dict) –

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) –

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) –

      The size of each page.

    • StartingToken (string) –

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type:

dict

Returns:

Response Syntax

{
    'CommandInvocations': [
        {
            'CommandId': 'string',
            'InstanceId': 'string',
            'InstanceName': 'string',
            'Comment': 'string',
            'DocumentName': 'string',
            'DocumentVersion': 'string',
            'RequestedDateTime': datetime(2015, 1, 1),
            'Status': 'Pending'|'InProgress'|'Delayed'|'Success'|'Cancelled'|'TimedOut'|'Failed'|'Cancelling',
            'StatusDetails': 'string',
            'TraceOutput': 'string',
            'StandardOutputUrl': 'string',
            'StandardErrorUrl': 'string',
            'CommandPlugins': [
                {
                    'Name': 'string',
                    'Status': 'Pending'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
                    'StatusDetails': 'string',
                    'ResponseCode': 123,
                    'ResponseStartDateTime': datetime(2015, 1, 1),
                    'ResponseFinishDateTime': datetime(2015, 1, 1),
                    'Output': 'string',
                    'StandardOutputUrl': 'string',
                    'StandardErrorUrl': 'string',
                    'OutputS3Region': 'string',
                    'OutputS3BucketName': 'string',
                    'OutputS3KeyPrefix': 'string'
                },
            ],
            'ServiceRole': 'string',
            'NotificationConfig': {
                'NotificationArn': 'string',
                'NotificationEvents': [
                    'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
                ],
                'NotificationType': 'Command'|'Invocation'
            },
            'CloudWatchOutputConfig': {
                'CloudWatchLogGroupName': 'string',
                'CloudWatchOutputEnabled': True|False
            }
        },
    ],

}

Response Structure

  • (dict) –

    • CommandInvocations (list) –

      (Optional) A list of all invocations.

      • (dict) –

        An invocation is a copy of a command sent to a specific managed node. A command can apply to one or more managed nodes. A command invocation applies to one managed node. For example, if a user runs SendCommand against three managed nodes, then a command invocation is created for each requested managed node ID. A command invocation returns status and detail information about a command you ran.

        • CommandId (string) –

          The command against which this invocation was requested.

        • InstanceId (string) –

          The managed node ID in which this invocation was requested.

        • InstanceName (string) –

          The fully qualified host name of the managed node.

        • Comment (string) –

          User-specified information about the command, such as a brief description of what the command should do.

        • DocumentName (string) –

          The document name that was requested for execution.

        • DocumentVersion (string) –

          The Systems Manager document (SSM document) version.

        • RequestedDateTime (datetime) –

          The time and date the request was sent to this managed node.

        • Status (string) –

          Whether or not the invocation succeeded, failed, or is pending.

        • StatusDetails (string) –

          A detailed status of the command execution for each invocation (each managed node targeted by the command). StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Understanding command statuses in the Amazon Web Services Systems Manager User Guide. StatusDetails can be one of the following values:

          • Pending: The command hasn’t been sent to the managed node.

          • In Progress: The command has been sent to the managed node but hasn’t reached a terminal state.

          • Success: The execution of the command or plugin was successfully completed. This is a terminal state.

          • Delivery Timed Out: The command wasn’t delivered to the managed node before the delivery timeout expired. Delivery timeouts don’t count against the parent command’s MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

          • Execution Timed Out: Command execution started on the managed node, but the execution wasn’t complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

          • Failed: The command wasn’t successful on the managed node. For a plugin, this indicates that the result code wasn’t zero. For a command invocation, this indicates that the result code for one or more plugins wasn’t zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

          • Cancelled: The command was terminated before it was completed. This is a terminal state.

          • Undeliverable: The command can’t be delivered to the managed node. The managed node might not exist or might not be responding. Undeliverable invocations don’t count against the parent command’s MaxErrors limit and don’t contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

          • Terminated: The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

          • Delayed: The system attempted to send the command to the managed node but wasn’t successful. The system retries again.

        • TraceOutput (string) –

          Gets the trace output sent by the agent.

        • StandardOutputUrl (string) –

          The URL to the plugin’s StdOut file in Amazon Simple Storage Service (Amazon S3), if the S3 bucket was defined for the parent command. For an invocation, StandardOutputUrl is populated if there is just one plugin defined for the command, and the S3 bucket was defined for the command.

        • StandardErrorUrl (string) –

          The URL to the plugin’s StdErr file in Amazon Simple Storage Service (Amazon S3), if the S3 bucket was defined for the parent command. For an invocation, StandardErrorUrl is populated if there is just one plugin defined for the command, and the S3 bucket was defined for the command.

        • CommandPlugins (list) –

          Plugins processed by the command.

          • (dict) –

            Describes plugin details.

            • Name (string) –

              The name of the plugin. Must be one of the following: aws:updateAgent, aws:domainjoin, aws:applications, aws:runPowerShellScript, aws:psmodule, aws:cloudWatch, aws:runShellScript, or aws:updateSSMAgent.

            • Status (string) –

              The status of this plugin. You can run a document with multiple plugins.

            • StatusDetails (string) –

              A detailed status of the plugin execution. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Understanding command statuses in the Amazon Web Services Systems Manager User Guide. StatusDetails can be one of the following values:

              • Pending: The command hasn’t been sent to the managed node.

              • In Progress: The command has been sent to the managed node but hasn’t reached a terminal state.

              • Success: The execution of the command or plugin was successfully completed. This is a terminal state.

              • Delivery Timed Out: The command wasn’t delivered to the managed node before the delivery timeout expired. Delivery timeouts don’t count against the parent command’s MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

              • Execution Timed Out: Command execution started on the managed node, but the execution wasn’t complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

              • Failed: The command wasn’t successful on the managed node. For a plugin, this indicates that the result code wasn’t zero. For a command invocation, this indicates that the result code for one or more plugins wasn’t zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

              • Cancelled: The command was terminated before it was completed. This is a terminal state.

              • Undeliverable: The command can’t be delivered to the managed node. The managed node might not exist, or it might not be responding. Undeliverable invocations don’t count against the parent command’s MaxErrors limit, and they don’t contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

              • Terminated: The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

            • ResponseCode (integer) –

              A numeric response code generated after running the plugin.

            • ResponseStartDateTime (datetime) –

              The time the plugin started running.

            • ResponseFinishDateTime (datetime) –

              The time the plugin stopped running. Could stop prematurely if, for example, a cancel command was sent.

            • Output (string) –

              Output of the plugin execution.

            • StandardOutputUrl (string) –

              The URL for the complete text written by the plugin to stdout in Amazon S3. If the S3 bucket for the command wasn’t specified, then this string is empty.

            • StandardErrorUrl (string) –

              The URL for the complete text written by the plugin to stderr. If execution isn’t yet complete, then this string is empty.

            • OutputS3Region (string) –

              (Deprecated) You can no longer specify this parameter. The system ignores it. Instead, Amazon Web Services Systems Manager automatically determines the S3 bucket region.

            • OutputS3BucketName (string) –

              The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

              doc-example-bucket/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-02573cafcfEXAMPLE/awsrunShellScript

              doc-example-bucket is the name of the S3 bucket;

              ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

              i-02573cafcfEXAMPLE is the managed node ID;

              awsrunShellScript is the name of the plugin.

            • OutputS3KeyPrefix (string) –

              The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

              doc-example-bucket/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-02573cafcfEXAMPLE/awsrunShellScript

              doc-example-bucket is the name of the S3 bucket;

              ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

              i-02573cafcfEXAMPLE is the managed node ID;

              awsrunShellScript is the name of the plugin.

        • ServiceRole (string) –

          The Identity and Access Management (IAM) service role that Run Command, a capability of Amazon Web Services Systems Manager, uses to act on your behalf when sending notifications about command status changes on a per managed node basis.

        • NotificationConfig (dict) –

          Configurations for sending notifications about command status changes on a per managed node basis.

          • NotificationArn (string) –

            An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes notifications about command status changes to this topic.

          • NotificationEvents (list) –

            The different events for which you can receive notifications. To learn more about these events, see Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager User Guide.

            • (string) –

          • NotificationType (string) –

            The type of notification.

            • Command: Receive notification when the status of a command changes.

            • Invocation: For commands sent to multiple managed nodes, receive notification on a per-node basis when the status of a command changes.

        • CloudWatchOutputConfig (dict) –

          Amazon CloudWatch Logs information where you want Amazon Web Services Systems Manager to send the command output.

          • CloudWatchLogGroupName (string) –

            The name of the CloudWatch Logs log group where you want to send command output. If you don’t specify a group name, Amazon Web Services Systems Manager automatically creates a log group for you. The log group uses the following naming format:

            aws/ssm/SystemsManagerDocumentName

          • CloudWatchOutputEnabled (boolean) –

            Enables Systems Manager to send command output to CloudWatch Logs.