DescribeInstanceInformationCommand

Provides information about one or more of your managed nodes, including the operating system platform, SSM Agent version, association status, and IP address. This operation does not return information for nodes that are either Stopped or Terminated.

If you specify one or more node IDs, the operation returns information for those managed nodes. If you don't specify node IDs, it returns information for all your managed nodes. If you specify a node ID that isn't valid or a node that you don't own, you receive an error.

The IamRole field returned for this API operation is the role assigned to an Amazon EC2 instance configured with a Systems Manager Quick Setup host management configuration or the role assigned to an on-premises managed node.

Example Syntax

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

import { SSMClient, DescribeInstanceInformationCommand } from "@aws-sdk/client-ssm"; // ES Modules import
// const { SSMClient, DescribeInstanceInformationCommand } = require("@aws-sdk/client-ssm"); // CommonJS import
const client = new SSMClient(config);
const input = { // DescribeInstanceInformationRequest
  InstanceInformationFilterList: [ // InstanceInformationFilterList
    { // InstanceInformationFilter
      key: "InstanceIds" || "AgentVersion" || "PingStatus" || "PlatformTypes" || "ActivationIds" || "IamRole" || "ResourceType" || "AssociationStatus", // required
      valueSet: [ // InstanceInformationFilterValueSet // required
        "STRING_VALUE",
      ],
    },
  ],
  Filters: [ // InstanceInformationStringFilterList
    { // InstanceInformationStringFilter
      Key: "STRING_VALUE", // required
      Values: [ // required
        "STRING_VALUE",
      ],
    },
  ],
  MaxResults: Number("int"),
  NextToken: "STRING_VALUE",
};
const command = new DescribeInstanceInformationCommand(input);
const response = await client.send(command);
// { // DescribeInstanceInformationResult
//   InstanceInformationList: [ // InstanceInformationList
//     { // InstanceInformation
//       InstanceId: "STRING_VALUE",
//       PingStatus: "Online" || "ConnectionLost" || "Inactive",
//       LastPingDateTime: new Date("TIMESTAMP"),
//       AgentVersion: "STRING_VALUE",
//       IsLatestVersion: true || false,
//       PlatformType: "Windows" || "Linux" || "MacOS",
//       PlatformName: "STRING_VALUE",
//       PlatformVersion: "STRING_VALUE",
//       ActivationId: "STRING_VALUE",
//       IamRole: "STRING_VALUE",
//       RegistrationDate: new Date("TIMESTAMP"),
//       ResourceType: "ManagedInstance" || "EC2Instance",
//       Name: "STRING_VALUE",
//       IPAddress: "STRING_VALUE",
//       ComputerName: "STRING_VALUE",
//       AssociationStatus: "STRING_VALUE",
//       LastAssociationExecutionDate: new Date("TIMESTAMP"),
//       LastSuccessfulAssociationExecutionDate: new Date("TIMESTAMP"),
//       AssociationOverview: { // InstanceAggregatedAssociationOverview
//         DetailedStatus: "STRING_VALUE",
//         InstanceAssociationStatusAggregatedCount: { // InstanceAssociationStatusAggregatedCount
//           "<keys>": Number("int"),
//         },
//       },
//       SourceId: "STRING_VALUE",
//       SourceType: "AWS::EC2::Instance" || "AWS::IoT::Thing" || "AWS::SSM::ManagedInstance",
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

DescribeInstanceInformationCommand Input

Parameter
Type
Description
Filters
InstanceInformationStringFilter[] | undefined

One or more filters. Use a filter to return a more specific list of managed nodes. You can filter based on tags applied to your managed nodes. Tag filters can't be combined with other filter types. Use this Filters data type instead of InstanceInformationFilterList, which is deprecated.

InstanceInformationFilterList
InstanceInformationFilter[] | undefined

This is a legacy method. We recommend that you don't use this method. Instead, use the Filters data type. Filters enables you to return node information by filtering based on tags applied to managed nodes.

Attempting to use InstanceInformationFilterList and Filters leads to an exception error.

MaxResults
number | undefined

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. The default value is 10 items.

NextToken
string | undefined

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

DescribeInstanceInformationCommand Output

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

The managed node information list.

NextToken
string | undefined

The token to use when requesting the next set of items. If there are no additional items to return, the string is empty.

Throws

Name
Fault
Details
InternalServerError
server

An error occurred on the server side.

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.

InvalidInstanceInformationFilterValue
client

The specified filter value isn't valid.

InvalidNextToken
client

The specified token isn't valid.

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