CmdID

CmdID / aws / aws iot

aws iot list-things

Lists your things. AWS CLI reference

2 examples 6 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To list all things in the registry

The following list-things example lists the things (devices) that are defined in the AWS IoT registry for your AWS account.

aws iot list-thingsIdentify
Its output, shortened
{
    "things": [
        {
            "thingName": "ThirdBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/ThirdBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 2
        },
        {
            "thingName": "MyOtherLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 3
        },
        {
            "thingName": "MyLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
… 10 more lines

Example 2: To list the defined things that have a specific attribute

The following list-things example displays a list of things that have an attribute named wattage.

aws iot list-things --attribute-name wattageIdentify
--attribute-nameThe attribute name used to search for things.
Its output
{
    "things": [
        {
            "thingName": "MyLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 1
        },
        {
            "thingName": "MyOtherLightBulb",
            "thingTypeName": "LightBulb",
            "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb",
            "attributes": {
                "model": "123",
                "wattage": "75"
            },
            "version": 3
        }
    ]
}

For more information, see How to Manage Things with the Registry in the AWS IoT Developers Guide.

Options

6 in the AWS CLI reference
--attribute-nameThe attribute name used to search for things.
--attribute-valueThe attribute value used to search for things.
--max-resultsThe maximum number of results to return in this operation.
--next-tokenTo retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.
--thing-type-nameThe name of the thing type used to search for things.
--use-prefix-attribute-valueWhen true, the action returns the thing resources with attribute values that start with the attributeValue provided.