AWS IoT Greengrass first impressions at Intenics Hackathon

a month ago   •   4 min read

By Johann
Photo by Chris Ried / Unsplash

Intenics Hackathon

At Intenics we hold hackathon events regularly to explore and tinker with new (and old) AWS services in an exploratory way, learn more about them and share our gained knowledge in the end. We use Hackathons as a safe space to experiment, prototype and try out things that might not fit in the regular work day setting. It is also a great team-building exercise as it encourages collaboration and communication - sometimes also distraction - among the team members, while improving the team spirit and new skills. The time restricted manner of a hackathon also trains the problem solving skills and prototypes sometimes evolve further into real things - like the Python OOP Companion: The Essential Plugin for Pycharm and IntelliJ.

gray concrete building under blue sky
Photo by Randy Tarampi / Unsplash

AWS IoT Greengrass

AWS IoT Greengrass allows you to run Lambda functions and pre-built connectors to create serverless applications that will be deployed on your local devices.
These can be then be triggered by local and cloud events. The communication between the IoT devices is not reliant on a constant connection to the internet.
This also means that processing of the data can happen much faster as it does not need to be transferred to the cloud first if the processing happens directly on the device.
The data you generate while offline can be stored locally and then synced with AWS IoT Core once the device comes back online using AWS IoT Greengrass stream manager.
Further client devices can be added to core devices even while offline. Features like over-the-air updates are provided for you so you can focus on developing your product without having to deal with the infrastructure involved.

Example Use-cases:

Run workload on the edge: using Greengrass you can extend AWS to the edge, for example to build IoT applications that collect, analyze and process data collected from other non-core devices. Process the data locally before uploading the data to the cloud.

Edge computing functionalities: run local compute on the edge, like caching and messaging or use Machine Learning inference on the device, even when not connected to the internet.

Home automation: build smart home applications that use the sensor data to perform different actions.

Key concepts:

Concept Definition
AWS IoT thing a logical representation of a device which could be physical (like a sensor or Raspberry Pi) or virtual (like EC2 instance)
AWS IoT Greengrass Core software AWS IoT Greengrass software package that you install on a core device (Nucleus which is required and optional components depending on your requirements)
Greengrass core device a physical device on which the AWS Greengrass Core software runs, providing local compute, messaging and data caching
Thing groups a way to organize your devices (IoT Things) for example to organize them by location
Greengrass client device interacts with the Greengrass Core (via MQTT), can be any IoT device, this is an AWS IoT thing
Greengrass component units of software that you deploy to your Greengrass core devices
Deployment process to send components and apply the desired component configuration to a destination target device or Thing group

Setup process with a Raspberry Pi

  1. Prepare the Raspberry with a running environment like Raspbian OS and make sure it is connected to the internet.
  2. Create a or login to your AWS account and navigate to the AWS IoT console, choose Greengrass and create a core device and add it to a group.
  3. Download and extract the Greengrass Core software on the Raspberry Pi, also make sure Java is installed.
  4. Setup AWS credentials on the device and run the AWS IoT Greengrass installer, which will provide the core device as an AWS IoT thing with a device certificate and default permissions, setup the device with a system user and group that are needed to run the software on the device. It will also connect the device to AWS IoT and run the latest version of the Core software on your device. The IoT console can help you getting the right commands to add your device as a core device.
  5. The installation process takes a few minutes. When it completes you should be able to find the device in the Core devices list.
  6. Now you can deploy your own applications on the device and use AWS Greengrass. Or try running an already deployed lambda function on your device by creating a new Component and import your lambda function there. The component will be created for you, configure the parameters like documented in the developer guide here and run the function.

Conclusion

AWS Greengrass is a powerful tool that bridges the gab between local device data and the capabilities of the cloud. Enabling local processing of your data, secure device communication and the seamless integration with other AWS services allow developers to build and deploy software solutions that scale. Optimize response times, lower bandwidth costs or bring machine learning closer to your devices with AWS Greengrass.

Setting up Greengrass is easy and the potential applications are plenty, now think of your own scenarios and get started.

References

AWS IoT Greengrass management console
AWS IoT Greengrass Developer Guide, Version 2 (installation)
Import a Lambda function as a component (console)

Spread the word