End of support notice: On October 7th, 2026, AWS will discontinue support for AWS IoT Greengrass Version 1. After October 7th, 2026, you will no longer be able to access the AWS IoT Greengrass V1 resources. For more information, please visit Migrate from AWS IoT Greengrass Version 1.
Test communications
-
On your computer, open two command-line
windows. Just as in Module 5, one window is for the GG_Switch client device and the other is for the GG_TrafficLight client device. You use them to run the same commands that you ran in Module 5. Run the following commands for the GG_Switch client device:
cdpath-to-certs-folderpython lightController.py --endpointAWS_IOT_ENDPOINT--rootCA AmazonRootCA1.pem --certswitchCertId-certificate.pem.crt --keyswitchCertId-private.pem.key --thingName GG_TrafficLight --clientId GG_SwitchRun the following commands for the GG_TrafficLight client device:
cdpath-to-certs-folderpython trafficLight.py --endpointAWS_IOT_ENDPOINT--rootCA AmazonRootCA1.pem --certlightCertId-certificate.pem.crt --keylightCertId-private.pem.key --thingName GG_TrafficLight --clientId GG_TrafficLightEvery 20 seconds, the switch updates the shadow state to G, Y, and R, and the light displays its new state.
-
The function handler of the Lambda function is triggered on every third green light (every three minutes), and a new DynamoDB record is created. After
lightController.pyandtrafficLight.pyhave run for three minutes, go to the AWS Management Console, and open the DynamoDB console. -
Choose US East (N. Virginia) in the AWS Region menu. This is the Region where the
GG_Car_Aggregatorfunction creates the table. -
In the navigation pane, choose Tables, and then choose the CarStats table.
-
Choose View items to view the entries in the table.
You should see entries with basic statistics on cars passed (one entry for every three minutes). You might need to choose the refresh button to view updates to the table.
-
If the test is not successful, you can look for troubleshooting information in the Greengrass logs.
-
Switch to the root user and navigate to the
logdirectory. Access to AWS IoT Greengrass logs requires root permissions.sudo su cd /greengrass/ggc/var/log -
Check
runtime.logfor errors.cat system/runtime.log | grep 'ERROR' -
Check the log generated by the Lambda function.
cat user/region/account-id/GG_Car_Aggregator.logThe
lightController.pyandtrafficLight.pyscripts store connection information in thegroupCAfolder, which is created in the same folder as the scripts. If you receive connection errors, make sure that the IP address in theggc-hostfile matches the IP address endpoint for your core.
For more information, see Troubleshooting AWS IoT Greengrass.
-
This is the end of the basic tutorial. You should now understand the AWS IoT Greengrass programming model and its fundamental concepts, including AWS IoT Greengrass cores, groups, subscriptions, client devices, and the deployment process for Lambda functions running at the edge.
You can delete the DynamoDB table and the Greengrass Lambda functions and subscriptions. To stop communications between the AWS IoT Greengrass core device and the AWS IoT cloud, open a terminal on the core device and run one of the following commands:
-
To shut down the AWS IoT Greengrass core device:
sudo halt -
To stop the AWS IoT Greengrass daemon:
cd /greengrass/ggc/core/ sudo ./greengrassd stop