Search by Tags

Getting Started with AWS IoT Greengrass for Torizon

 
Applicable for

Article updated at 23 Oct 2019
Subscribe for this article updates

Overview

This article will introduce the first steps to run AWS IoT Greengrass software in Toradex modules with Torizon.

Typographic Conventions

Prerequisites

Configure the Lambda function for Torizon in AWS Greengrass console

Configure the Lambda Function for AWS IoT Greengrass for a run on a Torizon container. To do this go to the settings of your Greengrasss Group:


Select the option Default Lamda function containerization to No container and clik the button Update default Lambda execution configuration:


A confirmation window will be shown, click Continue button:


Download docker-compose to Run AWS Greengrass Software for Torizon

Step 1 - Copy the security resources file

After setting up the AWS IoT Greengrass on your AWS IoT and after you download the security resources, copy the security resources file to the board via ssh:

$ scp hash-setup.tar.gz torizon@board_ip:/home/torizon

From the above command example, remember to change board_ip for the Toradex the module IP address.

Step 2 - Access the board terminal

Access the board Bash via ssh:

$ ssh torizon@board_ip

Unzip the security resources file:

# sudo tar -xzvf hash-setup.tar.gz

Step 3 - Download the docker-compose

Still on the board Bash download the docker-compose file with settings for running a container with AWS IoT Greengrass Core software already configured for Torizon:

# wget -O docker-compose.yaml https://docs.toradex.com/106791-docker-compose-aws-iot-imx8.yaml

Note: Download docker-compose file in the same root directory where you unzipped the security resources files.

Step 4 - Execute the docker-compose

Execute the docker-compose to run the container with the AWS IoT Greengrass Core software for Torizon:

# docker-compose run --rm greengrass

If you have output containing the message:

Note: More message logs may be output with this message.

Greengrass successfully started with PID

The message above means the AWS IoT Greengrass Core software for Torizon is running successfully.

Deploy from AWS IoT Core to the device

Deploy the cloud configuration from AWS Greengrass Group to the board. On your Greengrass group access Deployments and click on Actions, Deploy:


The first time you are deploying a Configure how Devices discover your Core will be shown, click the Automatic detection button:


Wait a while for the deploy to complete. If all goes successfully you will see the following status:


Test Hello World MQTT messages

Test if your Lambda function running on the device is successfully sending MQTT messages. In the AWS Console IoT Core menu select Test, on the Subscription topic input field write "hello/world" and finally click the Subscribe to topic button:


If the connection between device and AWS IoT Core was made correctly you should see messages coming from the device: