Move from AWS IoT Greengrass Version 1 - AWS IoT Greengrass

Move from AWS IoT Greengrass Version 1

AWS IoT Greengrass Version 2 is a new major version release of the AWS IoT Greengrass Core software, APIs, and console. You can't use the AWS IoT Greengrass Core software v1.x with the V2 APIs. Likewise, you can't use the AWS IoT Greengrass Core software v2.0 with the V1 APIs. However, by using some modifications, you can run your V1 applications on AWS IoT Greengrass V2.

Differences between V1 and 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.

  • AWS IoT Greengrass groups and deployments

    In AWS IoT Greengrass V1, a group defines a core device, the settings and software for that core device, and the list of AWS IoT things that connect to that 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 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 fleet. For more information, see Deploy AWS IoT Greengrass components to devices.

    You can also create local deployments to develop and test custom software components. For more information, see Create AWS IoT Greengrass components.

  • AWS IoT Greengrass Core software and connectors

    In AWS IoT Greengrass V1, the AWS IoT Greengrass Core software is a single package that contains the software and all of its features. AWS IoT Greengrass connectors are modules that you deploy to AWS IoT Greengrass V1 core devices.

    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 that handles deployments, orchestration, and lifecycle management of other components. Features such as stream manager, secret manager, and log manager are components that you deploy only when you need those features. AWS IoT Greengrass V2 also provides some AWS IoT Greengrass V1 connectors as components. For more information, see AWS-provided components.

  • AWS Lambda functions

    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. You also define the container parameters for functions that the AWS IoT Greengrass Core software runs in a containerized Lambda runtime environment.

    In AWS IoT Greengrass V2, components are the software that run on core devices. Components can consist of any software applications, and 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. For more information, see Develop AWS IoT Greengrass components.

    You can import 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 Run AWS IoT Greengrass V1 applications on AWS IoT Greengrass V2..

  • Subscriptions

    In AWS IoT Greengrass V1, subscriptions specify where Lambda functions receive event messages to consume as function payloads. Functions subscribe to local publish/subscribe messages and AWS IoT Core MQTT messages.

    In AWS IoT Greengrass V2, components manage their own subscriptions to local publish/subscribe and AWS IoT Core MQTT messages. In the component recipe, you define authorization policies to specify which topics the component can use to communicate. In component code, you can use interprocess communication (IPC) for local publish/subscribe messaging and AWS IoT Core MQTT messaging. For more information, see Use the AWS IoT Device SDK to communicate with the Greengrass nucleus, other components, and AWS IoT Core.

  • Local resources

    In AWS IoT Greengrass V1, Lambda functions run in containers that you configure to access volumes and devices on the core device's file system.

    In AWS IoT Greengrass V2, components run outside containers, so you don't need to specify which local resources the component can access. You can develop components that work directly with local resources on core devices. You can also develop components that run Docker containers. For more information, see Run a Docker container.

    Note

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

  • Greengrass devices (connected devices)

    In AWS IoT Greengrass V1, Greengrass 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, and you associate client devices to core devices to connect them and communicate over MQTT. You can define authorization policies that 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. For more information, see Interact with local IoT devices.

    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.

  • 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 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 then use the AWS IoT Device SDK V2 in Lambda functions, or in custom components, to interact with shadows on your devices.

    In both AWS IoT Greengrass V1 and AWS IoT Greengrass V2, you can sync local shadow states with cloud shadows in AWS IoT Core. For more information, see Interact with device shadows.

Run AWS IoT Greengrass V1 applications on AWS IoT Greengrass V2

You can run most AWS IoT Greengrass V1 applications on AWS IoT Greengrass V2. You can use AWS-provided components that offer the same functionality as AWS IoT Greengrass connectors, and you can import Lambda functions as components that run on AWS IoT Greengrass V2.

Can I run my Greengrass v1.x applications on Greengrass v2.0?

AWS IoT Greengrass provides features that you can use to run your AWS IoT Greengrass Core software v1.x applications on the AWS IoT Greengrass Core software v2.0. However, if your v1.x applications use any of the following listed features, you won't be able to run them on the v2.0 software yet.

  • Hardware security integration

  • Stream manager telemetry metrics

  • The following languages in the AWS IoT Greengrass Core SDK:

    • Node.js

    • C

  • The C and C++ Lambda function runtimes.

You can develop custom components to build any feature or runtime to run on Greengrass core devices.

Run V1 Lambda functions

You can import Lambda functions as AWS IoT Greengrass V2 components. If your components use features such as stream manager or local secrets, you must define dependencies on the AWS-provided components that package these features' functionality. When you deploy a component, the deployment includes the component dependencies that you specify. You configure these dependent features when you deploy your Lambda function component.

If your Lambda function uses features such as stream manager or local secrets, you must define dependencies on the AWS-provided components that package these features. When you deploy the Lambda function component, the deployment also includes the component for each feature that you define as a dependency. In the deployment, you can configure parameters such as which secrets to deploy to the core device. Not all V1 features require a component dependency for your Lambda function on V2. The following list describes how to use V1 features on V2 in your Lambda function component.

  • Stream manager

    If your Lambda function uses stream manager, specify aws.greengrass.StreamManager as a component dependency when you import the function. When you deploy the stream manager component, specify the stream manager parameters to set for the target core devices. For more information, see Stream manager.

  • Local secrets

    If your Lambda function uses local secrets, specify aws.greengrass.SecretManager as a component dependency when you import the function. When you deploy the secret manager component, specify the secret resources to deploy to the target core devices. The core device's role alias must point to an IAM role that allows the core device to retrieve the secret resources to deploy. For more information, see Secret manager.

  • Subscriptions

    If your Lambda function publishes messages to the local publish/subscribe broker or to AWS IoT Core, specify aws.greengrass.LegacySubscriptionRouter as a component dependency when you import the function. When you deploy the legacy subscription router component, specify the subscriptions that the Lambda function uses. For more information, see Legacy subscription router.

    Note

    This component is required only if your Lambda function uses the publish() function in the AWS IoT Greengrass Core SDK. If you update your Lambda function code to use the interprocess communication (IPC)s interface in the V2 AWS IoT Device SDK, you don't need to deploy the legacy subscription router component. For more information, see the following interprocess communication services:

  • Local volumes and devices

    If your containerized Lambda function accesses local volumes or devices, specify those volumes and devices when you import the Lambda function. This feature doesn't require a component dependency.

  • Local shadows

    If your Lambda function interacts with local shadows, you must update the Lambda function code to use the AWS IoT Device SDK V2. You must also specify aws.greengrass.ShadowManager as a component dependency when you import the function.

  • Access other AWS services

    If your Lambda function uses AWS credentials to make requests to other AWS services, specify aws.greengrass.TokenExchangeService as a component dependency when you import the function. The core device's role alias must point to an IAM role that allows the core device to perform the AWS operations that the Lambda function uses. For more information, see Token exchange service and Authorize core devices to interact with AWS services.

For more information, see Run AWS Lambda functions.

Run AWS IoT Greengrass connectors

You can deploy AWS-provided components that offer the same functionality of AWS IoT Greengrass connectors. When you create the deployment, you can configure the connectors' parameters. For more information, see the following AWS IoT Greengrass V2 components that provide Greengrass connectors:

AWS IoT Greengrass V2 doesn't provide a component to replace the Docker application deployment connector, but you can create components that run Docker containers from images. For more information, see Run a Docker container.

Run machine learning inference

AWS IoT Greengrass V2 provides sample Amazon SageMaker Neo DLR machine learning components and models. You can use these features for image classification and object detection. To use other machine learning frameworks, such as MXNet and TensorFlow, you can develop your own custom components that use these frameworks.

Connect V1 Greengrass devices

In AWS IoT Greengrass V2, Greengrass devices (or connected devices) are called client devices. AWS IoT Greengrass V2 support for client devices is backward-compatible with AWS IoT Greengrass V1, so you can connect V1 core devices to V2 core devices without changing their application code. To enable client devices to connect a V2 core device, deploy Greengrass components that enable client device support, and associate the client devices to the core device. To relay messages between client devices, the AWS IoT Core cloud service, and Greengrass components (including Lambda functions), deploy and configure the MQTT bridge component. You can deploy the IP detector component to automatically detect connectivity information, or you can manually manage endpoints. For more information, see Interact with local IoT devices.