Setting Up AWS IoT Greengrass v2 on Raspberry Pi CM5
A complete engineering R&D log for deploying AWS IoT Greengrass v2 on the Raspberry Pi Compute Module 5, including real-world troubleshooting of JDK and permission errors.
Setting Up AWS IoT Greengrass v2 on Raspberry Pi CM5 — SciTech Edge Advance 1.1 R&D Log
Executive Summary#
In this R&D log, we document the end-to-end process of provisioning an AWS IoT Core device and installing AWS IoT Greengrass v2 on a Raspberry Pi CM5 Compute Module. This setup forms the backbone of responsive Industrial IoT (IIoT) applications, enabling local compute, messaging, and data caching closer to the factory floor. We explicitly document the "happy path" alongside real-world errors—specifically Java dependency issues and permission failures—to prepare engineers for actual field deployments.
Hardware Stack#
- Edge Device: Scitech Edge Advance 1.1
- Compute Module: Raspberry Pi CM5
- OS: Raspberry Pi OS (Linux)
- Cloud Platform: AWS IoT Core
Software & Tooling Stack#
- AWS Services: AWS IoT Core, AWS IoT Greengrass v2
- Runtime: Java Development Kit (JDK)
- Connection protocol: SSH (Secure Shell)
Technical Walkthrough#
1. Creating the AWS IoT Core Device
The first step involves provisioning the digital twin in the cloud. Navigating to the AWS Console:
- Go to IoT Core > Greengrass devices > Setup Core Device.
- Core Device Name: We named ours
CM5 Module RPI. Ensure this is unique within your registry. - Thing Group: Select "No group" for a standalone setup, or add to an existing deployment group.
- Operating System: Linux.
- Nucleus Type: Select Nucleus Classic.
Why Nucleus Classic?
Nucleus Classic runs the Greengrass software as a system service with root privileges (if configured). This gives it full control over the Raspberry Pi's hardware interfaces (GPIO, Serial, etc.), which is critical for industrial connectivity where direct hardware access is required.
2. Downloading Configuration Artifacts
AWS generates two critical files during setup:
- The Connection Kit (Config files, certificates, and private keys).
- The Greengrass Installer (The Nucleus software).
Download both files to your local machine (Downloads folder).
3. Transferring Files to Raspberry Pi
With the device capable of network access (via Wi-Fi or Ethernet), we transfer the setup files.
- Identify the IP Address of the Raspberry Pi.
- Connect via SSH:
text
ssh user@<RPI_IP_ADDRESS> - Transfer the files using
scpor a drag-and-drop SSH client:greengrass-nucleus-latest.zipaws-resources-setup.zip(Connection kit)
4. Installing Greengrass v2
On the Raspberry Pi terminal, we prepare the directory structure.
- Unzip the installer:
text
unzip greengrass-nucleus-latest.zip -d GreenGrassCore - Unzip the connection kit into a dedicated folder (e.g.,
GreenGrass_v2):textmkdir GreenGrass_v2 unzip <connection_kit_filename>.zip -d GreenGrass_v2
5. Running the Installation
We initiate the installation command provided by AWS. However, this is where real-world environments often diverge from documentation.
sudo -E java -Droot="/greengrass/v2" -Dlog.store=FILE -jar lib/Greengrass.jar \
--aws-region <REGION> \
--thing-name "CM5 Module RPI" \
--tes-role-name <ROLE_NAME> \
--tes-role-alias-name <ALIAS_NAME> \
--provision true \
--setup-system-service true
⚠️ The Rogue Insight: Missing Dependencies & Permissions#
During our R&D deployment, we hit two critical blockers common in fresh OS installs.
Error 1: Command not found: java
The Issue: The Raspberry Pi OS Lite (or specific custom images) often come without a Java Runtime Environment (JRE). Greengrass is a Java-based application.
The Fix: Install the default JDK before running the installer.
sudo apt update
sudo apt install default-jdk -y
java -version # Verify installation
Error 2: Permission Denied
The Issue: Attempting to run the installer without sudo. Greengrass needs to write to protected system directories (/greengrass/v2) and register itself as a systemd service. Running it as a standard user (pi or admin) fails.
The Fix: ALWAYS use sudo when provisioning the Nucleus as a service.
# INCORRECT
java -jar lib/Greengrass.jar ...
# CORRECT
sudo -E java -jar lib/Greengrass.jar ...
Note: The -E flag preserves the user environment variables, which can be useful if you've set AWS credentials in your session.
Current State Verification#
After a successful installation:
-
Local Verification: Check the service status on the Pi:
textsystemctl status greengrass.serviceIt should be
Active (running). -
Cloud Verification: Return to the AWS IoT Core Console. The device
CM5 Module RPIshould now report its status as Healthy.
The folder structure on the device will now populate:
/greengrass/v2/config/greengrass/v2/packages/greengrass/v2/logs
What’s Next#
The Road Ahead
With the CM5 Module RPI healthy and communicating with AWS, the infrastructure is ready. In the next log, we will move from infrastructure to application logic:
- Creating a custom Greengrass Component.
- Deploying code locally first for debugging.
- Pushing the verified component from the cloud to the fleet.
This log is part of the SciTech Edge Advance 1.1 series. Scitech Industries is committed to transparent R&D in Industrial IoT.
People Behind This Work


D K Swami
Founder & Technical Lead, Scitech Industries
Also documenting the founder journey at Unscripted with DK Swami → Instagram