AWS Greengrass
Developer Guide

Configure Devices and Subscriptions

  1. Create two devices in your AWS Greengrass group, GG_Switch and GG_TrafficLight. Use the default security settings.

    
                            Screenshot showing the two devices, GG_TrafficLight and
                                GG_Switch.

    Save the certificates for the devices to your computer – note the GUID-like filename component for the GG_Switch and GG_TrafficLight devices, these will be needed later. You can reuse the root CA that you downloaded in the previous module.

    Now, each shadow can be synced to AWS IoT when the AWS Greengrass core is connected to the internet. First, you'll use local shadows without syncing the shadows to the cloud. Later in the module, you enable syncing. By default, cloud syncing should be disabled. If it's not disabled, under Devices, choose the ellipsis (…), and then choose Local Shadow Only.

    
                            Screenshot with LOCAL SHADOW ONLY highlighted for both
                                devices.
  2. Choose Subscriptions and create the following subscriptions for your group (For information on the $ sign, see Reserved Topics). For example, to set up the first row subscription, choose Add Subscription, for Select a source choose Select, choose the Devices tab, and then choose GG_Switch. For Select a target choose Select, choose Local Shadow Service, and then Next. For Optional topic filter, type (or copy/paste) $aws/things/GG_TrafficLight/shadow/update, choose Next, and then Finish. Using a similar procedure, complete the remaining subscriptions:

    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 or rejected.

    Local Shadow Service

    GG_Switch

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

    The GG_Switch needs to know whether the update request was accepted or 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 the update request from GG_Switch was accepted or rejected.

    Local Shadow Service

    GG_TrafficLight

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

    The GG_TrafficLight needs to know whether the update request from GG_Switch was accepted or rejected.

    Note

    Although you can use wildcards (for example, $aws/things/GG_TrafficLight/shadow/#) to consolidate some of the subscriptions, we do not recommend this practice.

    The topic paths must be written exactly as shown in the table. Do not include an extra / at the end of a topic. You can hover your mouse over a Topic path to see the full path via tooltip popup:

    
                            Tabular data on the Subscriptions page. The page contains
                                Source, Target, and Topic columns.

    Note

    Each device has its own device shadow service. For more information, see Shadow MQTT Topics.

  3. Make sure that the AWS Greengrass daemon is running, as described in Deploy Cloud Configurations to a Core Device.

  4. On the group configuration page, from the Actions menu, choose Deploy to deploy the updated group configuration to your AWS Greengrass core device.

    
                            Screenshot of the Deployments page with Deploy highlighted under
                                the Actions menu.

    For help troubleshooting any issues that you encounter, see Troubleshooting AWS Greengrass Applications.