Configure devices and subscriptions - Amazon IoT Greengrass
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.

Amazon IoT Greengrass Version 1 no longer receives feature updates, and will receive only security patches and bug fixes until June 30, 2023. For more information, see the Amazon IoT Greengrass V1 maintenance policy. We strongly recommend that you migrate to Amazon IoT Greengrass Version 2, which adds significant new features and support for additional platforms.

Configure devices and subscriptions

Shadows can be synced to Amazon IoT when the Amazon IoT Greengrass core is connected to the internet. In this module, you first use local shadows without syncing to the cloud. Then, you enable cloud syncing.

Each client device has its own shadow. For more information, see Device shadow service for Amazon IoT in the Amazon IoT Developer Guide.

  1. On the group configuration page, choose the Client devices tab.

  2. From the Client devices tab, add two new client devices in your Amazon IoT Greengrass group. For detailed steps of this process, see Create client devices in an Amazon IoT Greengrass group.

    • Name the client devices GG_Switch and GG_TrafficLight.

    • Generate and download the security resources for both client devices.

    • Make a note of the certificate ID in the file names of the security resources for the client devices. You use these values later.

  3. Create a folder on your computer for these client devices' security credentials. Copy the certificates and keys into this folder.

  4. Make sure that the client devices are set to use local shadows and not sync with the Amazon Web Services Cloud. If not, select the client device, choose Sync shadow, and then choose Disable shadow sync with cloud.

  5. Add the subscriptions in the following table to your group. For example, to create the first subscription:

    1. On the group configuration page, choose the Subscriptions tab, and then choose Add.

    2. For Source type, choose Client device, and then choose GG_Switch.

    3. For Target type, choose Service, and then choose Local Shadow Service.

    4. For Topic filter, enter $aws/things/GG_TrafficLight/shadow/update

    5. Choose Create subscription.

    The topics must be entered exactly as shown in the table. Although it's possible to use wildcards to consolidate some of the subscriptions, we don't recommend this practice. For more information, see Shadow MQTT topics in the Amazon IoT Developer Guide.

    Source Target Topic Notes

    GG_Switch

    Local Shadow Service

    $aws/things/GG_TrafficLight/shadow/update

    The GG_Switch sends an update request to update topic.

    Local Shadow Service

    GG_Switch

    $aws/things/GG_TrafficLight/shadow/update/accepted

    The GG_Switch needs to know whether the update request was accepted.

    Local Shadow Service

    GG_Switch

    $aws/things/GG_TrafficLight/shadow/update/rejected

    The GG_Switch needs to know whether the update request was rejected.

    GG_TrafficLight

    Local Shadow Service

    $aws/things/GG_TrafficLight/shadow/update

    The GG_TrafficLight sends an update of its state to the update topic.

    Local Shadow Service

    GG_TrafficLight

    $aws/things/GG_TrafficLight/shadow/update/delta

    The Local Shadow Service sends a received update to GG_TrafficLight through the delta topic.

    Local Shadow Service

    GG_TrafficLight

    $aws/things/GG_TrafficLight/shadow/update/accepted

    The GG_TrafficLight needs to know whether its state update was accepted.

    Local Shadow Service

    GG_TrafficLight

    $aws/things/GG_TrafficLight/shadow/update/rejected

    The GG_TrafficLight needs to know whether its state update was rejected.

    The new subscriptions are displayed on the Subscriptions tab.

    Note

    For information about the $ character, see Reserved topics.

  6. Make sure that automatic detection is enabled so the Greengrass core can publish a list of its IP addresses. Client devices use this information to discover the core. Do the following:

    1. On the group configuration page, choose the Lambda functions tab.

    2. Under System Lambda functions, choose IP detector, and then choose Edit.

    3. In the Edit IP detector settings, choose Automatically detect and override MQTT broker endpoints, and then choose Save.

  7. Make sure that the Greengrass daemon is running, as described in Deploy cloud configurations to a core device.

  8. On the group configuration page, choose Deploy.