SSM.Paginator.
ListCommands
¶paginator = client.get_paginator('list_commands')
paginate
(**kwargs)¶Creates an iterator that will paginate through responses from SSM.Client.list_commands()
.
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
CommandId='string',
InstanceId='string',
Filters=[
{
'key': 'InvokedAfter'|'InvokedBefore'|'Status'|'ExecutionStage'|'DocumentName',
'value': 'string'
},
],
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
(Optional) Lists commands issued against this managed node ID.
Note
You can't specify a managed node ID in the same command that you specify Status
= Pending
. This is because the command hasn't reached the managed node yet.
(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.A dictionary that provides parameters to control pagination.
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.
The size of each page.
A token to specify where to start paginating. This is the NextToken
from a previous response.
dict
Response Syntax
{
'Commands': [
{
'CommandId': 'string',
'DocumentName': 'string',
'DocumentVersion': 'string',
'Comment': 'string',
'ExpiresAfter': datetime(2015, 1, 1),
'Parameters': {
'string': [
'string',
]
},
'InstanceIds': [
'string',
],
'Targets': [
{
'Key': 'string',
'Values': [
'string',
]
},
],
'RequestedDateTime': datetime(2015, 1, 1),
'Status': 'Pending'|'InProgress'|'Success'|'Cancelled'|'Failed'|'TimedOut'|'Cancelling',
'StatusDetails': 'string',
'OutputS3Region': 'string',
'OutputS3BucketName': 'string',
'OutputS3KeyPrefix': 'string',
'MaxConcurrency': 'string',
'MaxErrors': 'string',
'TargetCount': 123,
'CompletedCount': 123,
'ErrorCount': 123,
'DeliveryTimedOutCount': 123,
'ServiceRole': 'string',
'NotificationConfig': {
'NotificationArn': 'string',
'NotificationEvents': [
'All'|'InProgress'|'Success'|'TimedOut'|'Cancelled'|'Failed',
],
'NotificationType': 'Command'|'Invocation'
},
'CloudWatchOutputConfig': {
'CloudWatchLogGroupName': 'string',
'CloudWatchOutputEnabled': True|False
},
'TimeoutSeconds': 123,
'AlarmConfiguration': {
'IgnorePollAlarmFailure': True|False,
'Alarms': [
{
'Name': 'string'
},
]
},
'TriggeredAlarms': [
{
'Name': 'string',
'State': 'UNKNOWN'|'ALARM'
},
]
},
],
}
Response Structure
(dict) --
Commands (list) --
(Optional) The list of commands requested by the user.
(dict) --
Describes a command request.
CommandId (string) --
A unique identifier for this command.
DocumentName (string) --
The name of the document requested for execution.
DocumentVersion (string) --
The Systems Manager document (SSM document) version.
Comment (string) --
User-specified information about the command, such as a brief description of what the command should do.
ExpiresAfter (datetime) --
If a command expires, it changes status to DeliveryTimedOut
for all invocations that have the status InProgress
, Pending
, or Delayed
. ExpiresAfter
is calculated based on the total timeout for the overall command. For more information, see Understanding command timeout values in the Amazon Web Services Systems Manager User Guide .
Parameters (dict) --
The parameter values to be inserted in the document when running the command.
InstanceIds (list) --
The managed node IDs against which this command was requested.
Targets (list) --
An array of search criteria that targets managed nodes using a Key,Value combination that you specify. Targets is required if you don't provide one or more managed node IDs in the call.
(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.
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>
Key=resource-groups:Name,Values=<resource-group-name>
Key=resource-groups:ResourceTypeFilters,Values=<resource-type-1>,<resource-type-2>
Key=ResourceGroup;Values=<resource-group-name>
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
Key=resource-groups:Name,Values=ProductionResourceGroup
This example demonstrates how to target all resources in the resource group ProductionResourceGroup in your maintenance window.Key=resource-groups:ResourceTypeFilters,Values=AWS::EC2::INSTANCE,AWS::EC2::VPC
This example demonstrates how to target only Amazon Elastic Compute Cloud (Amazon EC2) instances and VPCs in your maintenance window.Key=ResourceGroup,Values=MyResourceGroup
Key=InstanceIds,Values=*
This example demonstrates how to target all managed instances in the Amazon Web Services Region where the association was created.For more information about how to send commands that target managed nodes using Key,Value
parameters, see Targeting multiple instances 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 specified tag:ServerRole
, you could specify value:WebServer
to run a command on instances that include EC2 tags of ServerRole,WebServer
.
Depending on the type of target, the maximum number of values for a key might be lower than the global maximum of 50.
RequestedDateTime (datetime) --
The date and time the command was requested.
Status (string) --
The status of the command.
StatusDetails (string) --
A detailed status of the command 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:
OutputS3Region (string) --
(Deprecated) You can no longer specify this parameter. The system ignores it. Instead, Systems Manager automatically determines the Amazon Web Services Region of the S3 bucket.
OutputS3BucketName (string) --
The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command.
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.
MaxConcurrency (string) --
The maximum number of managed nodes that are allowed to run the command at the same time. You can specify a number of managed nodes, such as 10, or a percentage of nodes, such as 10%. The default value is 50. For more information about how to use MaxConcurrency
, see Running commands using Systems Manager Run Command in the Amazon Web Services Systems Manager User Guide .
MaxErrors (string) --
The maximum number of errors allowed before the system stops sending the command to additional targets. You can specify a number of errors, such as 10, or a percentage or errors, such as 10%. The default value is 0
. For more information about how to use MaxErrors
, see Running commands using Systems Manager Run Command in the Amazon Web Services Systems Manager User Guide .
TargetCount (integer) --
The number of targets for the command.
CompletedCount (integer) --
The number of targets for which the command invocation reached a terminal state. Terminal states include the following: Success, Failed, Execution Timed Out, Delivery Timed Out, Cancelled, Terminated, or Undeliverable.
ErrorCount (integer) --
The number of targets for which the status is Failed or Execution Timed Out.
DeliveryTimedOutCount (integer) --
The number of targets for which the status is Delivery Timed Out.
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.
NotificationConfig (dict) --
Configurations for sending notifications about command status changes.
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.
TimeoutSeconds (integer) --
The TimeoutSeconds
value specified for a command.
AlarmConfiguration (dict) --
The details for the CloudWatch alarm applied to your 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) --
The name of the CloudWatch alarm specified in the configuration.
(dict) --
A CloudWatch alarm you apply to an automation or command.
Name (string) --
The name of your CloudWatch alarm.
TriggeredAlarms (list) --
The CloudWatch alarm that was invoked by the command.
(dict) --
The details about the state of your CloudWatch alarm.
Name (string) --
The name of your CloudWatch alarm.
State (string) --
The state of your CloudWatch alarm.