AWS Greengrass, using AWS Lambda on local IoT devices

Spread the love

What is AWS Greengrass?

AWS Greengrass is software that extends AWS IoT Cloud capabilities to local devices, making it possible for those devices to collect and analyze data closer to the source of information, while also securely communicating with each other on local area networks. More specifically, IoT developers who use AWS Greengrass can author serverless AWS Lambda functions in the cloud and conveniently deploy it to devices for local execution of IoT applications.

AWS IoT Greengrass makes it possible for customers to use Lambda functions to build IoT devices and solution logic. Specifically, AWS IoT Greengrass provides cloud-based management of IoT applications that can be deployed for local execution. Locally deployed Lambda functions are triggered by local events, messages from the cloud, or other sources.

In AWS Greengrass, IoT devices securely communicate on a local network and exchange messages with each other without having to connect to the Amazon cloud. AWS IoT Greengrass provides a local pub/sub message manager that can intelligently buffer messages if connectivity is lost so that inbound and outbound messages to the AWS cloud are preserved.

The AWS Greengrass software lets enterprises run local compute, messaging, data caching, sync and machine learning inference capabilities for connected devices in a secure way. Amazon has started adding new capabilities onto the platform, such as Greengrass ML Inference, which allows machine learning models to be deployed directly to devices. These can make decisions quickly, even when the devices are not connected to the AWS cloud.

AWS Greengrass, the edge computing platform from Amazon, got a facelift in the form of machine learning inference support. The latest version (v1.5.0) can run Apache MXNet and TensorFlow Lite models locally on edge devices based on NVIDIA Jetson TX2 and Intel Atom architectures.

AWS Greengrass

AWS has done a great job of integrating AWS IoT, AWS Greengrass and Amazon SageMaker to deliver end-to-end machine learning support at the edge.
Customers upload training data to Amazon S3 before pointing Amazon SageMaker to it. They can choose one of the existing algorithms of SageMaker to generate a training model that is copied to another bucket of AWS S3 in the form of a compressed zip file. This zip file is copied to the device, which will be invoked by an AWS Lambda Python function at runtime. It is also possible to directly point AWS IoT Greengrass to a pre-trained SageMaker model.


AWS IoT Greengrass Key features:

  • Local Support for AWS Lambda functions
  • Local Support for AWS IoT Device Shadows
  • Local Messaging between devices
  • Protocol Support and Adapters
  • Over the Air Updates
  • Local Resource Access
  • Machine Learning Inference
  • Hardware Devices Ecosystem
  • Discovery service


Components of AWS Greengrass:

  • A message manager that routes messages between devices, Lambda functions, and AWS IoT.
  • A Lambda runtime that runs user-defined Lambda functions.
  • An implementation of the Device Shadow service that provides a local copy of shadows, which represent your devices. Shadows can be configured to sync with the cloud.
  • A deployment agent that is notified of new or updated AWS Greengrass group configuration. When a new or updated configuration is detected, the deployment agent downloads the configuration data and restarts the AWS Greengrass core.



AWS Greengrass Core Software functionality:

  • Allows deployment and execution of local IoT applications created using Lambda functions and managed through the deployment API.
  • Enables local messaging between devices over a secure local network using a managed subscription scheme through the MQTT protocol.
  • Ensures secure connections between devices and the cloud using device authentication and authorization.
    Provides secure, over-the-air software updates of user-defined Lambda functions.


IoT Devices in AWS Greengrass:

There are two types of devices:
1. AWS Greengrass cores.
An AWS Greengrass core is an AWS IoT device that runs specialized AWS IoT Greengrass software that communicates directly with the AWS IoT service and AWS Greengrass cloud services. It is an AWS IoT device with its own certificate used for authenticating with AWS IoT service. It has a device shadow and exists in the AWS IoT device registry. AWS Greengrass cores run a local Lambda runtime, a deployment agent, and an IP address tracker that sends IP address information to the AWS Greengrass cloud service to allow AWS IoT devices to automatically discover their group and core connection information.

2. AWS IoT devices connected to an AWS Greengrass core.
Any AWS IoT device can connect to an AWS Greengrass core. These devices run software written with the AWS IoT Devices SDK.


AWS Greengrass Introduction Video:


Required SDKs with AWS Greengrass:

Using the AWS SDKs, you can build IoT applications that work with any AWS service, including Amazon S3, Amazon DynamoDB, AWS IoT, AWS Greengrass, and more. In the context of AWS Greengrass, you can use the AWS SDK in deployed Lambda functions to make direct calls to any AWS service.

AWS IoT Device SDKs
The AWS IoT Device SDKs helps devices connect to AWS IoT or AWS Greengrass services. Devices must know which AWS Greengrass group they belong to and the IP address of the AWS IoT Greengrass core that they should connect to.

AWS Greengrass Core SDK
The AWS Greengrass Core SDK enables Lambda functions to interact with the AWS Greengrass core on which they run in order to publish messages, interact with the local IoT Device Shadow service, or invoke other deployed Lambda functions. This SDK is used exclusively for writing Lambda functions running in the Lambda runtime on an AWS Greengrass core.


Supported software platforms for AWS Greengrass core software:

  • Architecture: ARMv7l; OS: Linux; Distribution: Raspbian Jessie, 2017-03-02
  • Architecture: x86_64; OS: Linux; Distribution: Amazon Linux (amzn-ami-hvm-2016.09.1.20170119-x86_64-ebs)
  • Architecture: x86_64; OS: Linux; Distribution: Ubuntu 14.04 – 16.04
  • Architecture: ARMv8 (AArch64); OS: Linux; Distribution: Ubuntu 14.04 – 16.04 (Annapurna Alpine V2)


What is AWS Greengrass Groups:

An AWS Greengrass group definition is a collection of settings for AWS Greengrass core IoT devices and the devices that communicate with them.


AWS Greengrass Use cases, examples and applications:

  • Predictive maintainance
  • Local Video analytics
  • Smart Refrigerator


AWS Greengrass Pricing:

With AWS Greengrass, you pay only for what you use. You are charged based on the number of Greengrass Core devices that interact with the AWS Cloud in a given month. The Greengrass free tier includes 3 free Greengrass Cores for a year. There is no charge for AWS IoT SDK enabled devices connected to the Greengrass Core device.

  • 3 Devices: Free for 1 Year with the AWS Free Tier
  • 3 – 10,000 Devices : AWS Greengrass has two pricing options: Pay as you go or receive a 22% savings for annual commitments.


Which AWS regions is AWS Greengrass service available in?

AWS Greengrass is currently available in the following AWS regions:

  • US East (N. Virginia)
  • US West (Oregon)
  • EU (Frankfurt)
  • Asia Pacific (Sydney)
  • Asia Pacific (Tokyo)

You can use AWS Greengrass regardless of your geographic location, as long as you have access to one of the above AWS regions.


What Lambda development languages are supported by AWS Greengrass?

AWS Greengrass supports Lambda functions authored in the following languages:

  • Python 2.7
  • Node.JS 6.10
  • Java 8
  • C
  • C++
  • Any language that supports importing C libraries.


Which Lambdas can be deployed to Greengrass?

Any Lambda that uses the Python 2.7, Node.JS 6.10, or Java 8 Lambda Runtime can be deployed to Greengrass Core. Lambdas that get deployed to Greengrass must be packaged together with the Greengrass Core SDK. In addition, you can choose to also add the AWS SDK to your Lambda’s package in order to easily interact with AWS services such as DynamoDB.


How to get started, tutorial and documentation?

Official getting started documentation

You may also like:

MeenaG Staff

Internet of Things Enthusiast