SSM / Client / get_inventory

get_inventory#

SSM.Client.get_inventory(**kwargs)#

Query inventory information. This includes managed node status, such as Stopped or Terminated.

See also: AWS API Documentation

Request Syntax

response = client.get_inventory(
    Filters=[
        {
            'Key': 'string',
            'Values': [
                'string',
            ],
            'Type': 'Equal'|'NotEqual'|'BeginWith'|'LessThan'|'GreaterThan'|'Exists'
        },
    ],
    Aggregators=[
        {
            'Expression': 'string',
            'Aggregators': {'... recursive ...'},
            'Groups': [
                {
                    'Name': 'string',
                    'Filters': [
                        {
                            'Key': 'string',
                            'Values': [
                                'string',
                            ],
                            'Type': 'Equal'|'NotEqual'|'BeginWith'|'LessThan'|'GreaterThan'|'Exists'
                        },
                    ]
                },
            ]
        },
    ],
    ResultAttributes=[
        {
            'TypeName': 'string'
        },
    ],
    NextToken='string',
    MaxResults=123
)
Parameters:
  • Filters (list) –

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

    • (dict) –

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

      • Key (string) – [REQUIRED]

        The name of the filter key.

      • Values (list) – [REQUIRED]

        Inventory filter values. Example: inventory filter where managed node IDs are specified as values Key=AWS:InstanceInformation.InstanceId,Values= i-a12b3c4d5e6g, i-1a2b3c4d5e6,Type=Equal.

        • (string) –

      • Type (string) –

        The type of filter.

        Note

        The Exists filter must be used with aggregators. For more information, see Aggregating inventory data in the Amazon Web Services Systems Manager User Guide.

  • Aggregators (list) –

    Returns counts of inventory types based on one or more expressions. For example, if you aggregate by using an expression that uses the AWS:InstanceInformation.PlatformType type, you can see a count of how many Windows and Linux managed nodes exist in your inventoried fleet.

    • (dict) –

      Specifies the inventory type and attribute for the aggregation execution.

      • Expression (string) –

        The inventory type and attribute name for aggregation.

      • Aggregators (list) –

        Nested aggregators to further refine aggregation for an inventory type.

      • Groups (list) –

        A user-defined set of one or more filters on which to aggregate inventory data. Groups return a count of resources that match and don’t match the specified criteria.

        • (dict) –

          A user-defined set of one or more filters on which to aggregate inventory data. Groups return a count of resources that match and don’t match the specified criteria.

          • Name (string) – [REQUIRED]

            The name of the group.

          • Filters (list) – [REQUIRED]

            Filters define the criteria for the group. The matchingCount field displays the number of resources that match the criteria. The notMatchingCount field displays the number of resources that don’t match the criteria.

            • (dict) –

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

              • Key (string) – [REQUIRED]

                The name of the filter key.

              • Values (list) – [REQUIRED]

                Inventory filter values. Example: inventory filter where managed node IDs are specified as values Key=AWS:InstanceInformation.InstanceId,Values= i-a12b3c4d5e6g, i-1a2b3c4d5e6,Type=Equal.

                • (string) –

              • Type (string) –

                The type of filter.

                Note

                The Exists filter must be used with aggregators. For more information, see Aggregating inventory data in the Amazon Web Services Systems Manager User Guide.

  • ResultAttributes (list) –

    The list of inventory item types to return.

    • (dict) –

      The inventory item result attribute.

      • TypeName (string) – [REQUIRED]

        Name of the inventory item type. Valid value: AWS:InstanceInformation. Default Value: AWS:InstanceInformation.

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

  • MaxResults (integer) – 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.

Return type:

dict

Returns:

Response Syntax

{
    'Entities': [
        {
            'Id': 'string',
            'Data': {
                'string': {
                    'TypeName': 'string',
                    'SchemaVersion': 'string',
                    'CaptureTime': 'string',
                    'ContentHash': 'string',
                    'Content': [
                        {
                            'string': 'string'
                        },
                    ]
                }
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) –

    • Entities (list) –

      Collection of inventory entities such as a collection of managed node inventory.

      • (dict) –

        Inventory query results.

        • Id (string) –

          ID of the inventory result entity. For example, for managed node inventory the result will be the managed node ID. For EC2 instance inventory, the result will be the instance ID.

        • Data (dict) –

          The data section in the inventory result entity JSON.

          • (string) –

            • (dict) –

              The inventory result item.

              • TypeName (string) –

                The name of the inventory result item type.

              • SchemaVersion (string) –

                The schema version for the inventory result item/

              • CaptureTime (string) –

                The time inventory item data was captured.

              • ContentHash (string) –

                MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API doesn’t update the inventory item type contents if the MD5 hash hasn’t changed since last update.

              • Content (list) –

                Contains all the inventory data of the item type. Results include attribute names and values.

                • (dict) –

                  • (string) –

                    • (string) –

    • NextToken (string) –

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

Exceptions