Upgrade Greengrass V1 core devices to Greengrass V2 - Amazon IoT Greengrass
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Upgrade Greengrass V1 core devices to Greengrass V2

After you verify that your applications and components work on an Amazon IoT Greengrass V2 core device, you can install the Amazon IoT Greengrass Core software v2.x on your devices that currently run v1.x, such as production devices. Then, deploy Greengrass V2 components to run your Greengrass applications on the devices.

To upgrade a fleet of devices from V1 to V2, complete these steps for each device to upgrade. You can use thing groups to deploy V2 components to a fleet of core devices.

Tip

We recommend that you create a script to automate the upgrade process for a fleet of devices. If you use Amazon Systems Manager to manage your fleet, you can use Systems Manager to run that script on each device to upgrade your fleet from V1 to V2.

You can contact your Amazon Enterprise Support representative with questions about how to best automate the upgrade process.

Step 1: Install the Amazon IoT Greengrass Core software v2.x

Choose from the following options to install the Amazon IoT Greengrass Core software v2.x on a V1 core device:

  • Upgrade in fewer steps

    To upgrade in fewer steps, you can uninstall the v1.x software before you install the v2.x software.

  • Upgrade with minimal downtime

    To upgrade with minimal downtime, you can install both versions of the Amazon IoT Greengrass Core software at the same time. After you install the Amazon IoT Greengrass Core software v2.x and verify that your V2 applications operate correctly, you uninstall the Amazon IoT Greengrass Core software v1.x. Before you choose this option, consider the additional RAM required to run both versions of the Amazon IoT Greengrass Core software at the same time.

Uninstall Amazon IoT Greengrass Core v1.x before you install v2.x

If you want to upgrade sequentially, uninstall the Amazon IoT Greengrass Core software v1.x before you install v2.x on your device.

To uninstall the Amazon IoT Greengrass Core software v1.x
  1. If the Amazon IoT Greengrass Core software v1.x is running as a service, you must stop, disable, and remove the service.

    1. Stop the running Amazon IoT Greengrass Core software v1.x service.

      sudo systemctl stop greengrass
    2. Wait until the service stops. You can use the list command to check the status of the service.

      sudo systemctl list-units --type=service | grep greengrass
    3. Disable the service.

      sudo systemctl disable greengrass
    4. Remove the service.

      sudo rm /etc/systemd/system/greengrass.service
  2. If the Amazon IoT Greengrass Core software v1.x is not running as a service, use the following command to stop the daemon. Replace greengrass-root with the name of your Greengrass root folder. The default location is /greengrass.

    cd /greengrass-root/ggc/core/ sudo ./greengrassd stop
  3. (Optional) Back up your Greengrass root folder and, if applicable, your custom write folder, to a different folder on your device.

    1. Use the following command to copy the current Greengrass root folder to a different folder, and then remove the root folder.

      sudo cp -r /greengrass-root /path/to/greengrass-backup rm -rf /greengrass-root
    2. Use the following command to move the write folder to a different folder, and then remove the write folder.

      sudo cp -r /write-directory /path/to/write-directory-backup rm -rf /write-directory

You can then use the installation instructions for Amazon IoT Greengrass V2 to install the software on your device.

Tip

To reuse a core device's identity when you migrate it from V1 to V2, follow instructions to install the Amazon IoT Greengrass Core software with manual provisioning. First remove the V1 core software from the device, and then reuse the V1 core device's Amazon IoT thing and certificate, and update the certificate's Amazon IoT policies to grant permissions that the v2.x software requires.

Install Amazon IoT Greengrass Core software v2.x on a device already running v1.x

If you install the Amazon IoT Greengrass Core v2.x software on a device that is already running the Amazon IoT Greengrass Core software v1.x, keep the following in mind:

  • The Amazon IoT thing name for your V2 core device must be unique. Don't use the same thing name as your V1 core device.

  • The ports that you use for the Amazon IoT Greengrass Core software v2.x must be different from the ports that you use for v1.x.

  • Amazon IoT Greengrass V2 doesn't provide the option to rename the Greengrass system service. If you run Greengrass as a system service, you must do one of the following to avoid conflicting system service names:

    • Rename the Greengrass service for v1.x before you install v2.x.

    • Install the Amazon IoT Greengrass Core software v2.x without a system service, and then manually configure the software as a system service with a name other than greengrass.

    To rename the Greengrass service for v1.x
    1. Stop the Amazon IoT Greengrass Core software v1.x service.

      sudo systemctl stop greengrass
    2. Wait for the service to stop. The service can take up to a few minutes to stop. You can use the list-units command to check whether the service stopped.

      sudo systemctl list-units --type=service | grep greengrass
    3. Disable the service.

      sudo systemctl disable greengrass
    4. Rename the service.

      sudo mv /etc/systemd/system/greengrass.service /etc/systemd/system/greengrass-v1.service
    5. Reload the service and start it.

      sudo systemctl daemon-reload sudo systemctl reset-failed sudo systemctl enable greengrass-v1 sudo systemctl start greengrass-v1

You can then use the installation instructions for Amazon IoT Greengrass V2 to install the software on your device.

Tip

To reuse a core device's identity when you migrate it from V1 to V2, follow instructions to install the Amazon IoT Greengrass Core software with manual provisioning. First remove the V1 core software from the device, and then reuse the V1 core device's Amazon IoT thing and certificate, and update the certificate's Amazon IoT policies to grant permissions that the v2.x software requires.

Step 2: Deploy Amazon IoT Greengrass V2 components to the core devices

After you install the Amazon IoT Greengrass Core software v2.x on your device, create a deployment that includes the following resources. To deploy components to a fleet of similar devices, create a deployment for a thing group that contains those devices.

For information about creating and revising deployments, see Deploy Amazon IoT Greengrass components to devices.