Tutorial: Setting Up AWS IoT Greengrass on Revolution Pi
Introduction
AWS IoT Greengrass enables edge devices to act locally on the data they generate while leveraging the cloud for management, storage, and analytics. This guide walks you through setting up AWS IoT Greengrass on a Revolution Pi (RevPi), a modular industrial PC system designed for automation projects.
Prerequisites
- A valid AWS account.
- RevPi device with internet access.
- Basic familiarity with Linux or Windows operating systems.
- AWS CLI installed and configured.
- Python 3.5+ installed and added to the PATH environment variable.
Requirements
Hardware:
- RevPi Core 3 or newer models (e.g., Core 3+, Connect+, Connect SE, etc.).
- Standard kit components: RevPi device, power supply, and wiring tools.
- Additional items: PC (Windows, Linux, or Mac), minimum 11W power supply, slotted screwdriver, and wire stripper.
Software:
- Python 3.5+.
- AWS CLI (v1.18.197 or v2.1.11 or later).
- Java Runtime Environment 8+ for Greengrass.
Preparation:
-
Install the necessary software:
- Python 3.5 or later.
- AWS CLI and configure with your AWS credentials.
- Java Runtime Environment (JRE) on RevPi.
sudo apt install default-jdk
java -version
-
Ensure the RevPi and development PC are set to the same AWS region.
-
Flash the operating system on the RevPi following the user manual.
-
Connect to the RevPi using SSH (e.g., PuTTY).
-
Update and verify the RevPi software:
- Install Java.
- Test internet connectivity.
Step 1: Configure AWS Account and Permissions
▷ Sign in to the AWS Management Console.
▷ Go to Access Management and choose “Users”.
▷ Click “Add User” and choose your user name.
▷ On “Select AWS Credential Type”, choose “Access Key – Programmatic Access and next”
▷ On “Attach existing policies directly (details on provisioning policies)”, search for:
- IAMFullAccess
- AmazonS3FullAccess
- AWSIoTFullAccess
- AWSGreengrassFullAccess
▷ Click on “Create user”
▷ Download the .csv
▷ Copy the Access Key ID and the Secret Access Key.
▷ Paste the Access Key ID and the Secret Access Key on your RevPi SSH console using the following command lines:
export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
Step 2: Create AWS IoT Resources
Use the AWS IoT console to:
▷ Create an IoT Policy.
▷ Create a thing object
Pay special attention to the Notes.
Step 3: Install AWS IoT Greengrass Core
▷ Download the Greengrass Core software on the RevPi:
curl -s https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-nucleus-latest.zip > greengrass-nucleus-latest.zip
▷ Run the installer:
sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE \
-jar ./GreengrassInstaller/lib/Greengrass.jar \
--aws-region region \
--thing-name MyGreengrassCore \
--thing-group-name MyGreengrassCoreGroup \
--thing-policy-name GreengrassV2IoTThingPolicy \
--setup-system-service true
➜ The local development tools (specified by the –deploy-dev-tools option) take some time to deploy
▷ he following command can be used to check the status of this deployment:
aws greengrassv2 list-effective-deployments --core-device-thing-name thing-name
➜ The status is “Succeeded”
▷ Run the following command to verify that the Greengrass CLI is installed and runs on your device.
- Verify installation:
/greengrass/v2/bin/greengrass-cli help
▷ Under AWS IoT Greengrass console, choose “Core Devices”.
▷ Check if the status of your RevPiRevPi is healthy. ➜ Now your device is ready to go. Enjoy using AWS Greengrass.
Step 4: Create a Hello World Component
- Develop a "Hello World" component on the RevPi:
- Create and test the component locally.
- Use the AWS console or CLI to upload the component to the cloud.
- Deploy the component to your RevPi using the AWS IoT Greengrass console.
Step 5: Verify and Troubleshoot
- Verify the deployment:
- Check the status of your RevPi in the AWS IoT Greengrass console.
- Ensure the status is healthy.
- If issues arise, refer to the RevPi support forum or AWS documentation.
Conclusion
Your RevPi is now configured with AWS IoT Greengrass, ready to process edge data and seamlessly integrate with AWS cloud services.