Friday, 3 August 2018

Automatically starting AWS Greengrass on a Raspberry Pi on system boot

This post covers the steps necessary to get AWS Greengrass to start at system boot on a Raspberry Pi 3+ running Raspbian Stretch. The Greengrass software was at version 1.6.0.

I don’t cover the Greengrass installation or configuration process here. It is assumed that has already been done. Refer to this tutorial for details.

What we are going to do here is use systemd to run Greengrass on system boot.

Step 1

Navigate to the systemd/system folder on the Raspberry Pi.

cd /etc/systemd/system/

SNAGHTML32f6852

Step 2

Create a file called greengrass.service in the systemd/system folder using the nano text editor.

sudo nano greengrass.service

Copy in to the file the contents described in this document.

image

Save the file.

image

Step 3

Change the permissions on the file so they are executable by root.

sudo chmod u+rwx /etc/systemd/system/greengrass.service

image

Step 4

Enable the service.

sudo systemctl enable greengrass

SNAGHTML33471df

Step 5

You can now start the Greengrass service.

sudo systemctl start greengrass

SNAGHTML335429d

You can check that Greengrass is running.

ps –ef | grep green

SNAGHTML3364160

Reboot the system and check that Greengrass started after a reboot.

SNAGHTML3372dd3

Friday, 3 August 2018