ListCommandInvocationsCommand

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.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { SSMClient, ListCommandInvocationsCommand } from "@aws-sdk/client-ssm"; // ES Modules import
// const { SSMClient, ListCommandInvocationsCommand } = require("@aws-sdk/client-ssm"); // CommonJS import
const client = new SSMClient(config);
const input = { // ListCommandInvocationsRequest
  CommandId: "STRING_VALUE",
  InstanceId: "STRING_VALUE",
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
  Filters: [ // CommandFilterList
    { // CommandFilter
      key: "InvokedAfter" || "InvokedBefore" || "Status" || "ExecutionStage" || "DocumentName", // required
      value: "STRING_VALUE", // required
    },
  ],
  Details: true || false,
};
const command = new ListCommandInvocationsCommand(input);
const response = await client.send(command);
// { // ListCommandInvocationsResult
//   CommandInvocations: [ // CommandInvocationList
//     { // CommandInvocation
//       CommandId: "STRING_VALUE",
//       InstanceId: "STRING_VALUE",
//       InstanceName: "STRING_VALUE",
//       Comment: "STRING_VALUE",
//       DocumentName: "STRING_VALUE",
//       DocumentVersion: "STRING_VALUE",
//       RequestedDateTime: new Date("TIMESTAMP"),
//       Status: "Pending" || "InProgress" || "Delayed" || "Success" || "Cancelled" || "TimedOut" || "Failed" || "Cancelling",
//       StatusDetails: "STRING_VALUE",
//       TraceOutput: "STRING_VALUE",
//       StandardOutputUrl: "STRING_VALUE",
//       StandardErrorUrl: "STRING_VALUE",
//       CommandPlugins: [ // CommandPluginList
//         { // CommandPlugin
//           Name: "STRING_VALUE",
//           Status: "Pending" || "InProgress" || "Success" || "TimedOut" || "Cancelled" || "Failed",
//           StatusDetails: "STRING_VALUE",
//           ResponseCode: Number("int"),
//           ResponseStartDateTime: new Date("TIMESTAMP"),
//           ResponseFinishDateTime: new Date("TIMESTAMP"),
//           Output: "STRING_VALUE",
//           StandardOutputUrl: "STRING_VALUE",
//           StandardErrorUrl: "STRING_VALUE",
//           OutputS3Region: "STRING_VALUE",
//           OutputS3BucketName: "STRING_VALUE",
//           OutputS3KeyPrefix: "STRING_VALUE",
//         },
//       ],
//       ServiceRole: "STRING_VALUE",
//       NotificationConfig: { // NotificationConfig
//         NotificationArn: "STRING_VALUE",
//         NotificationEvents: [ // NotificationEventList
//           "All" || "InProgress" || "Success" || "TimedOut" || "Cancelled" || "Failed",
//         ],
//         NotificationType: "Command" || "Invocation",
//       },
//       CloudWatchOutputConfig: { // CloudWatchOutputConfig
//         CloudWatchLogGroupName: "STRING_VALUE",
//         CloudWatchOutputEnabled: true || false,
//       },
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

ListCommandInvocationsCommand Input

Parameter
Type
Description
CommandId
string | undefined

(Optional) The invocations for a specific command ID.

Details
boolean | undefined

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

Filters
CommandFilter[] | undefined

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

InstanceId
string | undefined

(Optional) The command execution details for a specific managed node ID.

MaxResults
number | undefined

(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.

NextToken
string | undefined

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

ListCommandInvocationsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CommandInvocations
CommandInvocation[] | undefined

(Optional) A list of all invocations.

NextToken
string | undefined

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

Throws

Name
Fault
Details
InternalServerError
server

An error occurred on the server side.

InvalidCommandId
client

The specified command ID isn't valid. Verify the ID and try again.

InvalidFilterKey
client

The specified key isn't valid.

InvalidInstanceId
client

The following problems can cause this exception:

  • You don't have permission to access the managed node.

  • Amazon Web Services Systems Manager Agent (SSM Agent) isn't running. Verify that SSM Agent is running.

  • SSM Agent isn't registered with the SSM endpoint. Try reinstalling SSM Agent.

  • The managed node isn't in a valid state. Valid states are: Running, Pending, Stopped, and Stopping. Invalid states are: Shutting-down and Terminated.

InvalidNextToken
client

The specified token isn't valid.

SSMServiceException
Base exception class for all service exceptions from SSM service.