AWS IoT Device Shadow Service - IoT Lens

AWS IoT Device Shadow Service

IoT solutions that use the Device Shadow service in AWS IoT Core manage command requests in a reliable, scalable, and straightforward fashion. The Device Shadow service follows a prescriptive approach to both the management of device-related state and how the state changes are communicated. This approach describes how the Device Shadows service uses a JSON document to store a device's current state, desired future state, and the difference between current and desired states.

Figure 4: Using Device Shadow with devices.

  1. A device reports initial device state by publishing that state as a message to the update topic deviceID/shadow/update.

  2. The Device Shadow reads the message from the topic and records the device state in a persistent data store.

  3. A device subscribes to the delta messaging topic deviceId/shadow/update/delta upon which device-related state change messages will arrive.

  4. A component of the solution publishes a desired state message to the topic deviceID/shadow/update and the Device Shadow tracking this device records the desired device state in a persistent data store.

  5. The Device Shadow publishes a delta message to the topic deviceId/shadow/update/delta, and the Message Broker sends the message to the device.

  6. A device receives the delta message and performs the desired state changes.

  7. A device publishes an acknowledgment message reflecting the new state to the update topic deviceID/shadow/update and the Device Shadow tracking this device records the new state in a persistent data store.

  8. The Device Shadow publishes a message to the deviceId/shadow/update/accepted topic.

  9. A component of the solution can now request the updated state from the Device Shadow.