Greengrass Device
AWS IoT Greengrass is an open source Internet of Things (IoT) edge runtime and cloud service that helps you build, deploy and manage IoT applications on your devices. You can use AWS IoT Greengrass to build software that enables your devices to act locally on the data that they generate, run predictions based on machine learning models, and filter and aggregate device data.
The Greengrass nucleus lite is a device runtime for constrained edge devices optimized for minimal memory footprint.
/IOTCONNECT supports onboarding of both these devices with easy steps.
Greengrass Device On-boarding
/IOTCONNECT interface provides easy way to onboard Greengrass device, for now platform only Linux support. Before you start you should have your device template created in platform, device templates is blueprint of data which device will sends. Once you have template created, you can now go to Greengrass Device menu and click on create device. This will ask basic information of your device.
You will see two option in Device Type dropdown
You can select Nucleus Classic to create Greengrass and to create Greengrass lite device, you need to select Nucleus Lite.
Greengrass lite Device:
Once you add primarily details, you need to download bundle which contains device certificate and configuration file. You can also download this later from device info page as well as device listing page. Store download information and store it securely as it contains sensitive information.
We have added our device in /IOTCONNECT platform now we need to prepare our device, for that we have to follow build guide provided by aws, below are summary of steps which you need to follow after connecting to your device.
Please run all commands as a root user, you can use sudo -s or su command for switching as root user.
1. Install the required dependencies in user directory by executing below command
sudo apt install build-essential pkg-config cmake git curl libssl-dev \
libcurl4-openssl-dev uuid-dev libzip-dev libsqlite3-dev libyaml-dev \
libsystemd-dev libevent-dev liburiparser-dev cgroup-tools
2. Create required users and groups
groupadd ggcore
useradd -Ng ggcore ggcore
groupadd gg_component
useradd -Ng gg_component gg_component
3. Build and install Greengrass Lite (nucleus)
Checkout the repository of Greengrass lite,
git clone https://github.com/aws-greengrass/aws-greengrass-lite.git
cd aws-greengrass-lite
cmake -B build -D CMAKE_BUILD_TYPE=MinSizeRel
make -C build -j$(nproc)
make -C build install
4. Copy files
Create these two directories:
mkdir -p /etc/greengrass
mkdir -p /var/lib/greengrass
Copy the downloaded bundle files to Device and place in the following folders,
config.yaml in /etc/greengrass/
certificate files in /var/lib/greengrass/
Download Root CA file using following command,
curl https://www.amazontrust.com/repository/AmazonRootCA1.pem -o /var/lib/greengrass/AmazonRootCA1.pem
5. Start Greengrass Lite (nucleus)
use below command to start nucleus service
./misc/run_nucleus
6. Log and Status
Log:
journalctl -a -f
Status of the Greengrass service:
systemctl status –with-dependencies greengrass-lite.target
Manage Service:
systemctl start greengrass-lite.target
systemctl stop greengrass-lite.target
systemctl restart greengrass-lite.target
Additional Resources:
Greengrass Lite GitHub Repository: https://github.com/aws-greengrass/aws-greengrass-lite
Setup and Build Documentation: https://github.com/aws-greengrass/aws-greengrass-lite/blob/main/docs