AI/ML, AWS, Cloud Computing, IoT

4 Mins Read

A Guide to AWS IoT Greengrass on Raspberry Pi

Introduction

AWS IoT Greengrass is an open-source edge runtime for the Internet of Things (IoT) and cloud service that helps build, deploy, and manage IoT applications on user devices. It is a software that extends cloud capabilities to local devices. AWS IoT Greengrass enables devices to collect and analyze data closer to where data is generated, react autonomously to local events, and communicate securely with each other on local networks. Greengrass devices can communicate securely with AWS IoT Core and export IoT data to the AWS Cloud. AWS IoT Greengrass developers can use AWS Lambda functions and prebuild connectors or, more specifically, a group of connectors as a component to create serverless applications that are deployed to devices for local execution.

Working of AWS IoT Greengrass

The AWS IoT Greengrass client software for the devices is called AWS IoT Greengrass Core software. It can run on Windows and Linux-based distributions, such as Ubuntu or Raspberry Pi OS, and supports devices with ARM or x86 architectures.

The following image shows how an AWS IoT Greengrass device interacts with the AWS IoT Greengrass cloud service and other AWS services in the AWS Cloud.

The following are the key concepts for understanding and using AWS IoT Greengrass:

  • AWS IoT Greengrass core device

AWS IoT Greengrass core device is an AWS IoT thing running the AWS IoT Greengrass Core software. We can add multiple core devices to AWS IoT thing groups to create a managed group of AWS IoT Greengrass core devices.

  • AWS IoT Greengrass Client Device

A device that communicates with the AWS Greengrass core device over MQTT is called an AWS IoT Greengrass client device. AWS IoT Greengrass client device is not an AWS IoT thing. The core device handles data processing, filtering, and data aggregation from the client device. Moreover, a client device can only access the AWS IoT Core via AWS IoT Greengrass. Generally, a Client device can be one with FreeRTOS or use the AWS IoT Device SDK or AWS IoT Greengrass discovery API to get information about core devices to connect.

  • AWS IoT Greengrass component

A component is a software module deployed on an AWS IoT Greengrass core device. AWS IoT Greengrass components can be pre-built public or community components that provide specific functionality. There is also a provision for developing custom components on a local device or in the cloud. After the development of a custom component, the AWS IoT Greengrass cloud service is used to deploy it to single or multiple core devices.  A component has the following structure.

  • Recipe: A JSON or YAML file describing the component module by defining lifecycle, configuration, and parameters.
  • Artifact: The source code or scripts of the defined software that will run on the device.

There is also a provision for versioning a component.

  • Dependency:

The components are sometimes dependent on other components, which enables the enforcement of automatic updates or restarts of dependent components.

  • Deployment

The process to send/install required components and apply the desired configuration to a destination target device, which can be a group of AWS IoT Greengrass core devices. Deployments apply any updated component configurations to the target and may include other dependencies components. Deployments can be cloned to create a revised or new deployment that uses the same components but is deployable to a different target.

  • AWS IoT Greengrass Core software

The set of all AWS IoT Greengrass software that is installed on a core device consists of the following:

Nucleus: This component provides the minimum functionality of the AWS IoT Greengrass Core software. The nucleus manages deployments, orchestration, and lifecycle management of other components and communication of AWS IoT Greengrass components locally on an individual device.

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Steps to Create AWS IoT Greengrass Core Device

AWS IoT Greengrass core software can be installed on a Raspberry Pi.

Step 1 – AWS IAM User creation and creating a device in the cloud

  • To install AWS IoT Greengrass on a Raspberry Pi, we first need to create a user with the policies shown in the image attached, and also, for best practice, the user should not have console access. A pair of secrets (access and secret access keys) is generated.

step1

Next is to create an AWS IoT Greengrass core device in the AWS IoT Greengrass tab, defining the device name and thing group.

step1b

Step 2 – Setting up credentials in the device and downloading:

Before installing, the JAVA runtime above version must be installed in the Raspberry Pi. Which can be checked in the terminal using the java –version command. If Java runtime is not available, it can be installed using the command sudo apt install default-jdk

Now, the AWS IoT Greengrass core device software can be downloaded after entering the following secrets ( which were generated in the previous step.)

and then entering the following command

which will download the AWS IoT Greengrass installer.

  • Installing

The following command installs the AWS IoT Greengrass core software, provisions the devices in the core with necessary certificates and permissions, and connects it to the core.

Conclusion

The AWS IoT Greengrass is a necessary upgrade for gateway devices. Security and downtime reduction are necessary for any industry migrating from on-premise old SCADA-based solutions to a Cloud platform.

The installation on a general-purpose computing board shows how lightweight AWS IoT Greengrass is and the security it provides. This also shows the ease of deployment and flexibility achievable on industrial-grade hardware. Also, deploying via the cloud without intervening in a running production setup is a major advantage.

Drop a query if you have any questions regarding AWS IoT Greengrass and we will get back to you quickly.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, Amazon QuickSight Service Delivery Partner, AWS EKS Service Delivery Partner, and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

To get started, go through our Consultancy page and Managed Services PackageCloudThat’s offerings.

FAQs

1. What are the benefits of using AWS IoT Greengrass?

ANS: – AWS IoT Greengrass allows a user to remotely deploy components over the cloud without physically handling the device, it helps reduce cost and deployment time. As AWS IoT Greengrass devices can be put into groups, it also allows users to deploy a component to many AWS IoT Greengrass core devices at the same time.

2. What is a thing group?

ANS: – A thing group is a group device that allows users to deploy a component over all the devices of the same group just by deploying once.

WRITTEN BY Rishi Raj Saikia

Rishi Raj Saikia is working as Sr. Research Associate - Data & AI IoT team at CloudThat.  He is a seasoned Electronics & Instrumentation engineer with a history of working in Telecom and the petroleum industry. He also possesses a deep knowledge of electronics, control theory/controller designing, and embedded systems, with PCB designing skills for relevant domains. He is keen on learning new advancements in IoT devices, IIoT technologies, and cloud-based technologies.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!