Open main menu

DAVE Developer's Wiki β

Changes

MISC-TN-005: Running AWS Greengrass Core on SBCSPG

52 bytes added, 14:29, 14 July 2021
Configuring AWS Greengrass on the cloud side and installing GGC on the edge device
{{InfoBoxTop}}
{{AppliesToSBCSPG}}
{{AppliesTo SBC Lynx TN}}
{{AppliesToIoT}}
{{AppliesTo IoT TN}}
{{InfoBoxBottom}}
{{WarningMessage|text=This technical note was validated against specific versions of hardware and software. It may not work with other versions.}}
Within the processing power limits of the edge device, moving such computations to the edge can be an effective way to optimize costs. When the Internet connection is intermittent or poor, it may even be mandatory to meet system's requirements. Generally speaking, when implementing an IoT system, balancing between cloud computing and edge computing is one of the most important issues the system architect has to address.
It should be stressed that this Technical Note is not a step-by-step guide to set up the edge device and the cloud platform to implement a Greengrass-based system. AWS documentation is rich and detailed in this regard. Rather, this document aims to underline some specific SBCSPG-related steps required to run GGC on this device successfully. The procedure is based on the [https://docs.aws.amazon.com/greengrass/latest/developerguide/gg-gs.html ''Getting Started with AWS IoT Greengrass'' guide], which is, therefore, a recommended reading.
The test was performed with:
==Setting up the edge device==
The first thing to do was to rebuild the Linux kernel after adding the missing options⁠—if any⁠—required options⁠ required by GGC, which are detailed [https://docs.aws.amazon.com/en_us/greengrass/latest/developerguide/what-is-gg.html#gg-platforms here].
Once the device was up and running with the fresh Linux kernel, to enable IP routing to the Internet, the default gateway was setup like this:
Module 2 of the ''Getting started guide'' details how to setup the Greengrass service on the cloud side.
Once created the groupis created, disable the default Lamba functions containerization, as stated previously.
At the end of this step, a file has to be downloaded containing Core's security resources, which will be installed on the edge device. This archive also contains ''configuration information specific to your AWS IoT Greengrass core and the AWS IoT endpoint'', stored in the file <code>config.json</code>. After uncompressing it onto the SBCSPG, please verify that the <code>useSystemd</code> in <code>config.json</code> is set to ''yes''.
If everything is configured properly, after staring Greengrass Core daemon, you should see something like this in the following messages are logged into the <code>/greengrass/ggc/var/log/system/runtime.log</code>file:
==Deploying the test Lambda function to the edge device==
Module 3 (Part 1) of the ''Getting started guide'' shows hot to deploy a Lamba function⁠—which was created on the cloud⁠—to the edge device. This function, coded in Python, simply sends a "Hello, world!" message to the cloud at regular intrvalsintervals.
==Testing the execution of the Lambda function on the edge device==
Once the function has been deployed, on the edge device you should see the following messages appear in the <code>runtime.log</code> file.
<pre class="board-terminal">
[2019-08-07T11:41:02.43+02:00][INFO]-Start subscribing. {"numOfTopics": 2, "clientId": "SBCSPG_grp0_Core"}
On the cloud, the log of the received messages should look looked like this:
[[File:AWS-GGC-hello-world.png|thumb|center|600px|Received messages on the cloud]]
4,650
edits