Dynamic thing groups

You can also create dynamic thing groups. Dynamic thing groups are thing groups that dynamically update group members through search queries.

In the exercise for fleet indexing you have added an attribute building to your devices.

In this exercise you will learn to create a dynamic thing group and list it’s members.

No let’s create a dynamic thing group for all devices in the building Day_One

aws iot create-dynamic-thing-group \
    --thing-group-name "Dynamic_Building_Day_One" \
    --query-string "attributes.building:Day_One"

Find your dynamic group definition

aws iot describe-thing-group --thing-group-name "Dynamic_Building_Day_One"

Get the things which are member or a dynamic thing group

aws iot list-things-in-thing-group --thing-group-name "Dynamic_Building_Day_One"

Add an attribute building with the value Day_One to any other device which is not already member of the Dynamic_Building_Day_One group and list again the members in the group.