Introduction
AWS IoT Greengrass is a service that you install on local hardware to analyze data and act on it in real-time.
One of Greengrass’s advantages is the ability to remotely manage local applications (called Components).
It seems like a great solution for many Internet of Things challenges, but without understanding how it works…
Greengrass service might disturb your operations!
This is a deep-dive technical post, but the conclusion is the following:
Removal of a local application (Component) running at the Greengrass device will stop the main Greengrass service and all other applications managed by it. As a result, telemetry data might be lost and local processing will be impacted.
There are ways to automatically restart the Greengrass service to resume operations, but there is going to be an outage in your operations.
Let’s dive into the technical details.
Technical details
Initial stage
In this test setup, I use Greengrass running as a Docker container, but the issue is not related to Docker.
The Greengrass service connected to the AWS IoT Core backend and found no tasks (Deployments).
Local debug console
I installed the Local debug console component for presentation purposes:
We can see the list of applications (Components) installed on the Greengrass device and their statuses.
First deployment - add a new application
Let’s install our test application on the Greengrass device. I will use the LogManager component as an example.
The process of remote installation of applications at the Greengrass device is called a Deployment.
This is the Greengrass log mentioning the start of Deployment:
And this is the summary of a successful Deployment:
We managed to install our application without impacting our operations!
Second deployment - removal of an application
Let’s say that we want to remotely remove our sample application. We invoke a new Deployment to instruct the Greengrass working on our device to remove the LogManager Component.
From the AWS Console perspective, everything looks good:
Our Greengrass device status is Healthy, and Deployment is In progress.
Unfortunately, the reality is totally different.
Greengrass stopped every local application (it does not receive any telemetry data or processing tasks):
The Greengrass service is down:
The Greengrass process is terminated:
And the Greengrass container is not working:
There is no way for Greengrass to resume its operations by itself - it needs to be restarted by “something”.
Restart
Once we restart the Greengrass service, we can see that our sample application was finally removed:
and Greengrass is operational again.
Summary
I hope this article helped you realize the challenges of using the AWS IoT Greengrass service without properly designed architecture and operational processes.
There are a number of ways to automatically restart the Greengrass service to recover from the described situation.
My point is that even an automatic restart requires some time, and your operations will be impacted during that period.
I am working on the AWS IoT Greengrass training to cover this and other important use cases.
Feel free to contact me in case of any questions!