Walkthrough: Assign custom inventory metadata to a managed node - Amazon Systems Manager
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Walkthrough: Assign custom inventory metadata to a managed node

The following procedure walks you through the process of using the Amazon Systems Manager PutInventory API operation to assign custom inventory metadata to a managed node. This example assigns rack location information to a node. For more information about custom inventory, see Working with custom inventory.

To assign custom inventory metadata to a node
  1. Install and configure the Amazon Command Line Interface (Amazon CLI), if you haven't already.

    For information, see Installing or updating the latest version of the Amazon CLI.

  2. Run the following command to assign rack location information to a node.

    Linux

    aws ssm put-inventory --instance-id "ID" --items '[{"CaptureTime": "2016-08-22T10:01:01Z", "TypeName": "Custom:RackInfo", "Content":[{"RackLocation": "Bay B/Row C/Rack D/Shelf E"}], "SchemaVersion": "1.0"}]'

    Windows

    aws ssm put-inventory --instance-id "ID" --items "TypeName=Custom:RackInfo,SchemaVersion=1.0,CaptureTime=2021-05-22T10:01:01Z,Content=[{RackLocation='Bay B/Row C/Rack D/Shelf F'}]"
  3. Run the following command to view custom inventory entries for this node.

    aws ssm list-inventory-entries --instance-id ID --type-name "Custom:RackInfo"

    The system responds with information like the following.

    {
        "InstanceId": "ID", 
        "TypeName": "Custom:RackInfo", 
        "Entries": [
            {
                "RackLocation": "Bay B/Row C/Rack D/Shelf E"
            }
        ], 
        "SchemaVersion": "1.0", 
        "CaptureTime": "2016-08-22T10:01:01Z"
    }
  4. Run the following command to view the custom inventory schema.

    aws ssm get-inventory-schema --type-name Custom:RackInfo

    The system responds with information like the following.

    {
        "Schemas": [
            {
                "TypeName": "Custom:RackInfo",
                "Version": "1.0",
                "Attributes": [
                    {
                        "DataType": "STRING",
                        "Name": "RackLocation"
                    }
                ]
            }
        ]
    }