Contents

Removing an application managed by the AWS IoT Greengrass will disturb your operations!

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.

/posts/removing_aws_iot_gg_component/img/gg_container.png

The Greengrass service connected to the AWS IoT Core backend and found no tasks (Deployments).

/posts/removing_aws_iot_gg_component/img/gg_connected_initial.png

Local debug console

I installed the Local debug console component for presentation purposes:

/posts/removing_aws_iot_gg_component/img/gg_components_001.png

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:

/posts/removing_aws_iot_gg_component/img/gg_add_deployment_started.png

And this is the summary of a successful Deployment:

/posts/removing_aws_iot_gg_component/img/gg_add_deployment_success.png

We managed to install our application without impacting our operations!

/posts/removing_aws_iot_gg_component/img/gg_components_002.png

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:

/posts/removing_aws_iot_gg_component/img/console_deployment_status.png

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):

/posts/removing_aws_iot_gg_component/img/gg_components_003.png

The Greengrass service is down:

/posts/removing_aws_iot_gg_component/img/gg_logs_down.png

The Greengrass process is terminated:

/posts/removing_aws_iot_gg_component/img/container_exit.png

And the Greengrass container is not working:

/posts/removing_aws_iot_gg_component/img/container_status_exited.png

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:

/posts/removing_aws_iot_gg_component/img/gg_logs_after_restart_delete.png

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!

Support quality content❤️ Donate💰

Sign up for news: (by subscribing you accept the privacy policy)