AI/ML, AWS, Cloud Computing, IoT

4 Mins Read

A Guide to Deploy Components on AWS IoT Greengrass Device

Voiced by Amazon Polly

Overview

Deploying components on a Greengrass device involves distributing and managing software packages to edge devices, including AWS Lambda functions and Docker containers. This process extends AWS IoT capabilities to the edge, enabling local processing and enhancing IoT applications’ performance, resilience, and scalability. 

Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started

Introduction to Component

Components are software modules that can be deployed on an AWS IoT Greengrass core device and can perform different functions. A component can be a runtime installer, a library, an application, or any code that can run on the Greengrass device.

The components may have interdependency, e.g., a component can install a runtime, say Python, on an AWS IoT Greengrass device, and another component that uses Python can define the Python installing component as a dependency. The dependency can be defined as Hard or Soft, meaning the deployment will fail without the component defined as Hard dependency.

Component structure

A component consists of two parts called artifact and recipe.

  • Recipe

A component’s metadata is defined in the recipe. The recipe contains the component’s configuration parameters, dependencies, lifecycle, and platform compatibility. In the recipe, the platform-specific dependencies can be defined for devices. The mentioned lifecycle in a recipe defines the commands that install, run, and shut down the component. Every recipe has a list of manifests defining the required platform and the lifecycle and artifacts to use for the core devices meeting platform requirements. A recipe can be defined as either a JSON or YAML document.

The recipe, while defining, has the following information.

RecipeFormatVersion (template version of the recipe), ComponentName (user-defined name of the component), ComponentVersion, ComponentDescription (optional), ComponentPublisher (author of the component),

ComponentConfiguration (configuration parameters of the component), ComponentDependencies ( contains version requirement parameter and dependency type for the component), ComponentType(Optional and can be a generic, lambda, plugin or nucleus ), ComponentSource(Optional), Manifests( contains a name, a platform i.e OS and architecture, a lifecycle which may be an install, run, bootstrap, shutdown or recover cycle etc.), Artifacts( contains location of the executable code or URI and permission set viz. read, execute ), Lifecycle(Global lifecycle for components only when manifest does not specify a lifecycle).

A sample recipe is shown below for better understanding.

  • Artifacts

Artifacts are the binaries of scripts, compiled code, static resources, and any other files a component consumes. Components also use the artifacts of the other component dependencies.

Deploying the necessary components

AWS IoT Greengrass uses AWS IoT core jobs to deploy to an AWS IoT Greengrass core device. Deployment can be done to a single AWS IoT Greengrass device or a Device group. Deployment to the same target overwrites the previous instances of components. When an AWS IoT Greengrass receives a deployment, it checks whether the components meet the device platform or else a deployment fails.

The basic component of an AWS IoT Greengrass device is the Nucleus, which gets installed during the installation of AWS IoT Greengrass core software. Still, updating the nucleus component after AWS IoT Greengrass core software installation on a AWS IoT Greengrass device is best practice. With the nucleus component, a few more important components must be installed in the AWS IoT Greengrass device to communicate with devices via MQTT and relay local MQTT messages to AWS IoT Core.

Step-by-Step Guide

  • Select the “Components” subpalette from AWS IoT Core-> AWS IoT Greengrass devices, and search for “aws.greengrass.Nucleus” in public components, then select and deploy.

step1

  • Next, choose the deployment device and choose whether for a new or existing deployment. Here, we are going to update the existing deployment.

step2

  • Next select “aws.greengrass.LocalDebugConsole”(local dashboard to check logs in the Greengrass device),“aws.greengrass.clientdevices.mqtt.Bridge”(acts as a bridge between local MQTT broker or local component with AWS IoT core), “greengrass.clientdevices.mqtt.Moquette”(local MQTT broker), “aws.greengrass.TokenExchangeService” ( component providing AWS credentials for other components to communicate) and “aws.greengrass.clientdevices.Auth”(component providing authorization to local MQTT devices to connect to Greengrass core) components to deploy in the same deployment.

step3

  • Then, define the deployment policies regarding component update, timeout, and failure handling policy and finally deploy. Generally, it takes a few minutes before it gets reflected.

step4

Once deployment is successful, it will show in the deployment status.

step5

If the deployment fails, check the logs and also the status of the dependencies.

Conclusion

Thus, we have seen how components can be deployed to an AWS IoT Greengrass core device using AWS IoT Jobs. This OTA capability enables users to update a component without having the physical device in hand. Moreover, if a deployment fails, the AWS IoT Greengrass device can be redeployed by revising the last known configuration.

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. Is there a benefit of deploying a component using AWS IoT Jobs on an AWS IoT Greengrass device?

ANS: – Yes. Deploying a component on a device over OTA helps save time and money. It also helps if multiple devices need the same upgrade. Then, it can be done by making a group and deploying once.

2. How do I deploy a Greengrass component?

ANS: – To deploy a Greengrass component, create a deployment definition that includes the component. Then, deploy this definition to one or more Greengrass core devices using the AWS Management Console, AWS CLI, or SDKs.

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!