Quantcast
Channel: Intel Developer Zone Articles
Viewing all articles
Browse latest Browse all 3384

Start Amazon Web Services Greengrass* Core on the UP Squared* Development Board

$
0
0

Introduction

This guide shows the steps to start Amazon Web Services (AWS) Greengrass* core on Ubuntu* using the UP Squared* development board.

About the UP Squared* Board

Characterized by low power consumption and high performance - which is ideal for the Internet of Things (IoT) - the UP Squared platform is the fastest x86 maker board based on the Apollo Lake platform from Intel. It contains both the Intel Celeron® processor Dual Core N3350 and Intel® Pentium® brand Quad Core N4200 processor.

AWS Greengrass*

AWS Greengrass is software that extends AWS cloud capabilities to local devices, allowing them to collect and analyze data on the local devices. This reduces latency between the devices and data processing layer, and reduces storage and bandwidth costs involved with sending data to the cloud. The user can create AWS Lambda functions to enable Greengrass to keep data in sync, filter data for further analysis, and communicate with other devices securely.

Operating System Compatibility

The UP Squared board can run Ubilinux*, Ubuntu*, Windows® 10 IoT Core, Windows® 10, Yocto Project*, and Android* Marshmallow operating systems. For more information on UP Squared, visit this website.

Hardware Components

The hardware components used in this project are listed below:

Create AWS Greengrass* Group

An AWS Greengrass group is a collection of settings for AWS Greengrass core devices, and the devices that communicate with them. Let’s start by logging into the Amazon Web Services (AWS)* Management Console, opening AWS IoT console, choosing a region from the top right corner of the navigation bar, then selecting Greengrass.

On the Welcome to AWS Greengrass screen, choose Get Started.

Figure 1: AWS IoT Console

On the Set up your Greengrass group page, select Use easy creation to create an AWS Greengrass group.

Figure 2: Setting up AWS Greengrass Group

Choose a name for your Greengrass Group, then click Next.

Figure 3: Setting up AWS Greengrass Group: Name the Group

Use the default name for the AWS Greengrass core, then select Next.

Figure 4: Setting up AWS Greengrass Group: Name the Greengrass Core

Select Create group and Core on the Run a scripted easy Group creation page. 

Figure 5: Setting up AWS Greengrass Group: Create Group and Core

You should see following page while the AWS Greengrass Group is being created.

Figure 6: Setting up AWS Greengrass Group: Creating Group and Core

When you see a certificate and public and private keys, you have successfully created the new Greengrass group. Click on Download these resources as a tar.gz to download the certificate and private key for later use. Select x86_64 for CPU architecture and then click on the Download Greengrass to start the Greengrass download.

Figure 7: Setting up AWS Greengrass Group: Certificate and Private Key

Select Finish.

Figure 8: Setting up AWS Greengrass Group: Successfully

Development Boards

Before you begin, make sure that the Ubuntu* operating is installed on The UP Squared board. To ensure that the Ubuntu operating system is up to date and dependent Ubuntu packages are installed, open a command prompt (terminal) and type the following:

sudo apt-get update

Install sqlite3 package by entering the following command in the terminal:

sudo apt-get install sqlite3

Create the Greengrass user and group account:

sudo adduser --system gcc_user
sudo addgroup --system gcc_group

Untar the Greengrass Core software that was downloaded in the “Figure 7: Setting up AWS Greengrass Group: Certificate and Private Key” step earlier.

Download the cmake package by entering the following command in the terminal:

wget https://cmake.org/files/v3.8/cmake-3.8.0.tar.gz

Execute the following commands:

tar -xzvf cmake-3.8.0.tar.gz
cd cmake-3.8.0
./configure
make
sudo make install

Use the following commands to install OpenSSL:

wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -xzvf openssl-1.0.2k.tar.gz
cd openssl-1.0.2k
./config --prefix=/usr
make
sudo make install
sudo ln –sf /usr/local/ssl/bin/openssl ‘which openssl’
openssl version -v

Enable Hardlinks and Softlinks Protection

Activate the hardlinks and softlinks protection to improve security on the device. Add the following two lines to /etc/sysctl.d/10-link-restrictions.conf.

fs.protected hardlinks = 1
fs.protected symlinks = 1

Reboot the UP Squared board and validate the system variables by running:

sudo sysctl -a | grep fs.protected

Install Greengrass Certificate and Key

Copy the certificate and private keys files created in the “Figure 7: Setting up AWS Greengrass Group: Certificate and Private Key” above to the UP Squared board as follow:

  • cloud.pem.crt: 4f7a73faa9-cert.pem.crt created above
  • cloud.pem.key: 4f7a73faa9-private.pem.key created above
  • root-ca-cert.pem: wget https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem -O root-ca-cert.pem

The ~/greengrass/certs should look like this:

Edit config.json

Open a command prompt (terminal) and navigate to ~/greengrass/config folder. Edit config.json as follows to configure the Greengrass Core:

{
    "coreThing": {
        "caPath": "root-ca-cert.pem",
        "certPath": "cloud.pem.crt",
        "keyPath": "cloud.pem.key",
        "thingArn": "arn:aws:iot:us-east-1:xxxxxxxxxxxx:thing/MyGreengrass1stGroup_Core",
        "iotHost": "yyyyyyyyyyyy.iot.us-east-1.amazonaws.com",
        "ggHost": "greengrass.iot.us-east-1.amazonaws.com",
	"keepAlive": 600
    },
    "runtime": {
        "cgroup": {
            "useSystemd": "yes"
        }
    },
    "system": {
        "shadowSyncTimeout": 120
    }
}
Note: The default value of shadowSyncTimeout is 1.
  • thingArn: Navigate to AWS IoT console, choose Manage on the left, and then select MyGreengrass1stGroup under Thing.

ThingARN should look like this:

  • iotHost: Navigate to AWS IoT console, the Endpoint is located under Settings on the bottom left corner of the AWS IoT console. 

Start AWS Greengrass* Core

Open a command prompt (terminal) and navigate to ~/greengrass/config folder

cd ~/greengrass/ggc/core
sudo ./greengrassd start

When you see the message “Greengrass successfully started”, you will know the Greengrass core has been created successfully.

To confirm that the Greengrass core process is running, run the following command:

ps aux | grep greengrass

Summary

We have described how to start the Greengrass core on the UP Squared board. From here, there are several projects you can try to explore the potential of the UP Squared board. For example, you can create a Greengrass deployment, add a group of devices that can communicate with the local IoT endpoint, enable Lambda functions to filter data for further analysis, and more.

References

Amazon Kinesis* Service API Reference: 
http://docs.aws.amazon.com/greengrass/latest/developerguide/what-is-gg.html
http://docs.aws.amazon.com/greengrass/latest/developerguide/gg-config.html

Up Squared:
http://www.up-board.org/upsquared

Amazon:
https://aws.amazon.com/kinesis/streams/getting-started

IoT References:
https://software.intel.com/en-us/iot/hardware/devkit

About the Author

Nancy Le is a software engineer at Intel Corporation in the Software and Services Group, working on the Intel Atom® processor and IoT scale enabling projects.

*Other names and brands may be claimed as the property of others.

More on UP Squared


Viewing all articles
Browse latest Browse all 3384

Trending Articles