SSM.Client.
list_command_invocations
(**kwargs)¶An invocation is 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. ListCommandInvocations
provide status about command execution.
See also: AWS API Documentation
Request Syntax
response = client.list_command_invocations(
CommandId='string',
InstanceId='string',
MaxResults=123,
NextToken='string',
Filters=[
{
'key': 'InvokedAfter'|'InvokedBefore'|'Status'|'ExecutionStage'|'DocumentName',
'value': 'string'
},
],
Details=True|False
)
(Optional) One or more filters. Use a filter to return a more specific list of results.
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.
The name of the filter.
Note
The ExecutionStage
filter can't be used with the ListCommandInvocations
operation, only with ListCommands
.
The filter value. Valid values for each filter key are as follows:
2021-07-07T00:00:00Z
to see a list of command executions occurring July 7, 2021, and later.2021-07-07T00:00:00Z
to see a list of command executions from before July 7, 2021.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
AWS-RunPatchBaseline
to see command executions that used this SSM document to perform security patching operations on managed nodes.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.false
.dict
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
}
},
],
'NextToken': 'string'
}
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:
MaxErrors
limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.MaxErrors
limit of the parent command. This is a terminal state.MaxErrors
limit of the parent command. This is a terminal state.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:
MaxErrors
limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.MaxErrors
limit of the parent command. 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 .
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.
NextToken (string) --
(Optional) The token for the next set of items to return. (You received this token from a previous call.)
Exceptions
SSM.Client.exceptions.InternalServerError
SSM.Client.exceptions.InvalidCommandId
SSM.Client.exceptions.InvalidInstanceId
SSM.Client.exceptions.InvalidFilterKey
SSM.Client.exceptions.InvalidNextToken