AWS Systems Manager
API Reference (API Version 2014-11-06)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

ListCommands

Lists the commands requested by users of the AWS account.

Request Syntax

{ "CommandId": "string", "Filters": [ { "key": "string", "value": "string" } ], "InstanceId": "string", "MaxResults": number, "NextToken": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

CommandId

(Optional) If provided, lists only the specified command.

Type: String

Length Constraints: Fixed length of 36.

Required: No

Filters

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

Type: Array of CommandFilter objects

Array Members: Minimum number of 1 item. Maximum number of 5 items.

Required: No

InstanceId

(Optional) Lists commands issued against this instance ID.

Type: String

Pattern: (^i-(\w{8}|\w{17})$)|(^mi-\w{17}$)

Required: No

MaxResults

(Optional) 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: Integer

Valid Range: Minimum value of 1. Maximum value of 50.

Required: No

NextToken

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

Type: String

Required: No

Response Syntax

{ "Commands": [ { "CloudWatchOutputConfig": { "CloudWatchLogGroupName": "string", "CloudWatchOutputEnabled": boolean }, "CommandId": "string", "Comment": "string", "CompletedCount": number, "DeliveryTimedOutCount": number, "DocumentName": "string", "DocumentVersion": "string", "ErrorCount": number, "ExpiresAfter": number, "InstanceIds": [ "string" ], "MaxConcurrency": "string", "MaxErrors": "string", "NotificationConfig": { "NotificationArn": "string", "NotificationEvents": [ "string" ], "NotificationType": "string" }, "OutputS3BucketName": "string", "OutputS3KeyPrefix": "string", "OutputS3Region": "string", "Parameters": { "string" : [ "string" ] }, "RequestedDateTime": number, "ServiceRole": "string", "Status": "string", "StatusDetails": "string", "TargetCount": number, "Targets": [ { "Key": "string", "Values": [ "string" ] } ] } ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Commands

(Optional) The list of commands requested by the user.

Type: Array of Command objects

NextToken

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

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

InvalidCommandId

HTTP Status Code: 400

InvalidFilterKey

The specified key is not valid.

HTTP Status Code: 400

InvalidInstanceId

The following problems can cause this exception:

You do not have permission to access the instance.

SSM Agent is not running. Verify that SSM Agent is running.

SSM Agent is not registered with the SSM endpoint. Try reinstalling SSM Agent.

The instance is not in valid state. Valid states are: Running, Pending, Stopped, Stopping. Invalid states are: Shutting-down and Terminated.

HTTP Status Code: 400

InvalidNextToken

The specified token is not valid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: