AWS Greengrass + Azul
Amazon AWS cloud-based tools can significantly increase the capabilities of ARTIK modules. The article here describes installation and test of the AWS Greengrass core service, used for deploying AWS Lambda functions on ARTIK gateways.
Because the Java runtime engine performance is so important in this use case, we also describe installation of the Azul Zulu Embedded OpenJDK Runtime Environment.
This tutorial is designed for use with the ARTIK 530 or 710 board with the Ubuntu OS installed.
AWS Lambda Functions
As applied to ARTIK, an AWS Lambda function is a computing package dispatched from the AWS cloud to the ARTIK gateway. It can be triggered locally within the gateway and also by events from the various AWS cloud services.
The package contents are typically runtime node.js code, but can also include Linux executable files called by the node.js code. In this way, over-the-air (OTA) update of edge node devices is also possible.
The ARTIK gateway continuously runs the Greengrass core daemon, which is always ready for arrival of a new lambda function or triggering/querying one that was previously delivered. The gateway must be provisioned with credentials from AWS, which provide security.
The present tutorial references the introductory tutorials provided by Amazon, but provides the ARTIK-specific information you'll need to get up and running. Follow the procedure below and then move to the MQTT publish/subscribe modules at the AWS site.
Follow the introductory article to set up the CLI, your account, and your credentials.
zipon your ARTIK board.
Preparing for AWS Greengrass Installation
This procedure was tested using A530 OS_3.0.0.
Create Greengrass User and Group accounts.
adduser --system ggc_user
addgroup -system ggc_group
apt install sqlite3
Greengrass Core does system checks for hard/soft link protection. ARTIK 530/710 releases have symlink and hardlink protection disabled by default. The following commands create a sysctl configuration file to enable the protection.
sh -c 'echo "fs.protected_hardlinks = 1" >>/etc/sysctl.d/local-ggc.conf'
sh -c 'echo "fs.protected_symlinks = 1" >>/etc/sysctl.d/local-ggc.conf'
Reboot the device, then run the following commands from your ARTIK terminal window to confirm the hardlink/symlink changes. You should see the output shown.
apt install git
git clone https://github.com/aws-samples/aws-greengrass-samples.git
Fixing Missing Dependencies
Use the provided dependency check program to see what is missing.
At this stage, you will likely see the following error messages.
1. Could not find the binary 'nodejs6.10'…
2. Could not find the binary 'java8'…
The introductory AWS Greengrass tutorial modules do not require you to fix these missing dependencies, but doing so is relatively quick.
Fix Error 1: Configure NodeJS
Node comes pre-installed on ARTIK modules. Use this command if not present.
apt install nodejs
Greengrass is expecting a specific version. To correct the node.js error, you need to link your current Node version back to version 6.10.
For A530, try this:
ln -s /usr/bin/node /usr/bin/nodejs6.10
ln -s /usr/bin/node /usr/bin/nodejs
For A710, try this:
ln -s /root/node-v8.9.4-linux-arm64/bin/node /usr/bin/nodejs6.10
ln -s /root/node-v8.9.4-linux-arm64/bin/node /usr/bin/nodejs
Fix Error 2: Install OpenJDK
You'll want to install Java 8 from Zulu Embedded for enhanced performance. Go to:
and download the latest ARM version meant for your ARTIK module (32-bit Hard Float for ARTIK 530 or 64-bit for ARTIK 710).
For these steps, you can copy/paste the command line, use the back arrow key to reach and delete < Tab >, then hit the Tab key to auto-complete for your specific file version.
tar xvf ezdk-<Tab>
update-alternatives --install /usr/bin/java java ~/ezdk-<Tab>/jre/bin/java 100
Don't try to run this command with a relative path; update-alternatives very specifically wants to see a full, absolute path name.
For ARM OpenJDK version 8u172, for example:
tar xvf ezdk-1.8.0_172-184.108.40.206-eval-linux_aarch32hf.tar update-alternatives --install /usr/bin/java java ~/ezdk-1.8.0_172-220.127.116.11-eval-linux_aarch32hf/jre/bin/java 100
Now, use this command to configure the setup.
update-alternatives --config java
Finally, use the following command to link to your Java installation.
ln -s /usr/bin/java /usr/bin/java8
You can now check that the installation works as expected.
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (Zulu Embedded 18.104.22.168-linux-aarch32hf) (build 1.8.0_172-106)
OpenJDK Client VM (Zulu Embedded 22.214.171.124-linux-aarch32hf) (build 25.172-b106, mixed mode, Evaluation)
to verify that the dependency requirements have now been met.
Installing AWS Greengrass Core
You're finally ready to install and use Greengrass, following the AWS Greengrass tutorial series.
Module 2 of the series lets you download and install the Greengrass core and security certificates. Choose ARMv8 architecture for ARTIK 710, or ARMv71 architecture for ARTIK 530.
Module 3 of the series will then show you how easy it is to remotely deploy a "lambda function" to your ARTIK board and start running it to send MQTT messages back to the Greengrass console.
Module 3 step 4b has some typos. Use these lines instead.
tar -xzvf greengrass-core-python-sdk-1.2.0.tar.gz (add "v")
cd aws_greengrass_core_sdk/examples/HelloWorld (remove "/")
unzip greengrassHelloWorld.zip (unchanged)
Note that for the US-west-2 region (one that supports Greengrass):