Differences between AWS IoT Greengrass V1 and AWS IoT Greengrass V2 - AWS IoT Greengrass

Differences between AWS IoT Greengrass V1 and AWS IoT Greengrass V2

AWS IoT Greengrass V2 introduces new fundamental concepts for devices, fleets, and deployable software. This section describes the V1 concepts that are different in V2.

Greengrass concepts and terminology
Concept AWS IoT Greengrass V1 AWS IoT Greengrass V2

Application code

In AWS IoT Greengrass V1, Lambda functions define the software that runs on core devices. In each Greengrass group, you define subscriptions and local resources that the function uses. For Lambda functions that the AWS IoT Greengrass Core software runs in a containerized Lambda runtime environment, you define container parameters, such as memory limits.

In AWS IoT Greengrass V2, components are the software modules that run on core devices.

  • Each component has a recipe that defines the component's metadata, parameters, dependencies, and scripts to run at each step in the component lifecycle.

  • The recipe also defines the component's artifacts, which are binary files, such as scripts, compiled code, and static resources.

  • When you deploy a component to a core device, the core device downloads the component recipe and artifacts to run the component.

You can import your V1 Lambda functions as components that run in a Lambda runtime environment in AWS IoT Greengrass V2. When you import the Lambda function, you specify the subscriptions, local resources, and container parameters for the function. For more information, see Step 2: Create and deploy AWS IoT Greengrass V2 components to migrate AWS IoT Greengrass V1 applications.

For more information about how to create custom components, see Develop AWS IoT Greengrass components.

AWS IoT Greengrass groups and deployments

In AWS IoT Greengrass V1, a group defines the core device, the settings and software for that core device, and the list of AWS IoT things that can connect to that core device. You create a deployment to send a group's configuration to a core device.

In AWS IoT Greengrass V2, you use deployments to define the software components and configurations that run on core devices.

  • Each deployment targets a single core device (which is an AWS IoT thing) or an AWS IoT thing group that can contain multiple core devices.

  • Deployments to thing groups are continuous, so when you add a core device to a thing group, it receives the software configuration for that group.

For more information, see Deploy AWS IoT Greengrass components to devices.

In AWS IoT Greengrass V2, you can also create local deployments using the Greengrass CLI to test custom software components on the device where you develop them. For more information, see Create AWS IoT Greengrass components.

AWS IoT Greengrass Core software

In AWS IoT Greengrass V1, the AWS IoT Greengrass Core software is a single package that contains the software and all of its features. The edge device on which you install the AWS IoT Greengrass Core software is called a Greengrass core.

In AWS IoT Greengrass V2, the AWS IoT Greengrass Core software is modular, so that you can choose what to install to control the memory footprint.

  • The Greengrass nucleus component is the minimum required installation of the AWS IoT Greengrass Core software. The edge device on which you install the nucleus is called a Greengrass core device.

  • The nucleus handles deployments, orchestration, and lifecycle management of other components on the core device.

  • Features such as stream manager, secret manager, and log manager are components that you deploy only when you need those features. For more information, see AWS-provided components.

Connectors

In AWS IoT Greengrass V1, connectors are prebuilt modules that you deploy to AWS IoT Greengrass V1 core devices to interact with local infrastructure, device protocols, AWS, and other cloud services.

In AWS IoT Greengrass V2, AWS provides Greengrass components that implement the functionality provided by connectors in V1. The following AWS IoT Greengrass V2 components provide Greengrass V1 connector functionality:

For more information, see AWS-provided components.

Connected devices (Greengrass devices)

In AWS IoT Greengrass V1, connected devices are AWS IoT things that you add to a Greengrass group to connect to the core device in that group and communicate over MQTT. You must deploy that group each time that you add or remove a connected device. You use subscriptions to relay messages between connected devices, AWS IoT Core, and applications on the core device.

In AWS IoT Greengrass V2, connected devices are called Greengrass client devices.

  • You associate client devices to core devices to connect them and communicate over MQTT.

  • To authorize client devices to connect, you define authorization policies that can apply to groups of client devices, so you don't need to create a deployment to add or remove a client device.

  • To relay messages between client devices, AWS IoT Core, and Greengrass components, you can configure an optional MQTT bridge component.

In both AWS IoT Greengrass V1 and AWS IoT Greengrass V2, devices can run FreeRTOS or use the AWS IoT Device SDK or Greengrass discovery API to get information about core devices to which they can connect. The Greengrass discovery API is backward compatible, so if you have client devices that connect to a V1 core device, you can connect them to a V2 core device without changing their code.

For more information about client devices, see Interact with local IoT devices.

Local resources

In AWS IoT Greengrass V1, Lambda functions that run in containers can be configured to access volumes and devices on the core device's file system. These file system resources are known as local resources.

In AWS IoT Greengrass V2, you can run components that are Lambda functions, Docker containers, or native operating system processes or custom runtimes.

  • When you import a containerized Lambda function as a component, you must specify the local resources that the function uses.

  • Non-containerized Lambda functions and non-Lambda components can work directly with local resources on core devices, so you don't need to specify the local resources that the component uses.

Local shadow service

In AWS IoT Greengrass V1, the local shadow service is enabled by default, and supports only unnamed classic shadows. You use the AWS IoT Greengrass Core SDK in your Lambda functions to interact with shadows on your devices.

In AWS IoT Greengrass V2, you enable the local shadow service by deploying the shadow manager component.

  • You can use the AWS IoT Device SDK V2 in Lambda functions and custom components to interact with shadows on your devices.

  • The local shadow service supports named shadows.

  • The local shadow service lets you delete shadows and synchronize deleted shadows with AWS IoT Core.

For more information, see Interact with device shadows.

Subscriptions

In AWS IoT Greengrass V1, you define subscriptions for a Greengrass group to specify communication channels between Lambda functions, connectors, connected devices, the AWS IoT Core MQTT broker, and the local shadow service. Subscriptions specify where Lambda functions receive event messages to consume as function payloads.

In AWS IoT Greengrass V2, you specify communication channels without using subscriptions.

  • Components manage their own communication channels to interact with local publish/subscribe messages, AWS IoT Core MQTT messages, and the local shadow service.

  • To configure communication channels between client devices, the local publish/subscribe broker, and the AWS IoT Core MQTT broker, you configure and deploy the MQTT bridge component. The MQTT bridge component enables you to interact with client devices in components and relay messages between client devices and AWS IoT Core.

Accessing other AWS services

In AWS IoT Greengrass V1, you attach an AWS Identity and Access Management (IAM) role, called the group role, to a Greengrass group. The group role defines the permissions that Lambda functions and AWS IoT Greengrass features on that group's core device use to access AWS services.

In AWS IoT Greengrass V2, you attach an AWS IoT role alias to a Greengrass core device. The role alias points to an IAM role called the token exchange role. The token exchange role defines the permissions that Greengrass components on the core device use to access AWS services. For more information, see Authorize core devices to interact with AWS services.