Uninstall the Amazon IoT Greengrass Core software - 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).

Uninstall the Amazon IoT Greengrass Core software

You can uninstall the Amazon IoT Greengrass Core software to remove it from a device that you don't want to use as a Greengrass core device. You can also use these steps to clean up an installation that fails.

To uninstall the Amazon IoT Greengrass Core software
  1. If you run the software as a system service, you must stop, disable, and remove the service. Run the following commands as appropriate for your operating system.

    Linux
    1. Stop the service.

      sudo systemctl stop greengrass.service
    2. Disable the service.

      sudo systemctl disable greengrass.service
    3. Remove the service.

      sudo rm /etc/systemd/system/greengrass.service
    4. Verify that the service is deleted.

      sudo systemctl daemon-reload && sudo systemctl reset-failed
    Windows (Command Prompt)
    Note

    You must run Command Prompt as an administrator to run these commands.

    1. Stop the service.

      sc stop "greengrass"
    2. Disable the service.

      sc config "greengrass" start=disabled
    3. Remove the service.

      sc delete "greengrass"
    4. Restart the device.

    Windows (PowerShell)
    Note

    You must run PowerShell as an administrator to run these commands.

    1. Stop the service.

      Stop-Service -Name "greengrass"
    2. Disable the service.

      Set-Service -Name "greengrass" -Status stopped -StartupType disabled
    3. Remove the service.

      • For PowerShell 6.0 and later:

        Remove-Service -Name "greengrass" -Confirm:$false -Verbose
      • For PowerShell versions earlier than 6.0 :

        Get-Item HKLM:\SYSTEM\CurrentControlSet\Services\greengrass | Remove-Item -Force -Verbose
    4. Restart the device.

  2. Remove the root folder from the device. Replace /greengrass/v2 or C:\greengrass\v2 with the path to the root folder.

    Linux
    sudo rm -rf /greengrass/v2
    Windows (Command Prompt)
    rmdir /s /q C:\greengrass\v2
    Windows (PowerShell)
    cmd.exe /c "rmdir /s /q C:\greengrass\v2"
  3. Delete the core device from the Amazon IoT Greengrass service. This step removes the core device's status information from the Amazon Web Services Cloud. Be sure to complete this step if you plan to reinstall the Amazon IoT Greengrass Core software to a core device with the same name.

    • To delete a core device from the Amazon IoT Greengrass console, do the following:

      1. Choose Core devices.

      2. Choose the core device to delete.

      3. Choose Delete.

      4. In the confirmation modal, choose Delete.

    • To delete a core device with the Amazon Command Line Interface, use the DeleteCoreDevice operation. Run the following command, and replace MyGreengrassCore with the name of the core device.

      aws greengrassv2 delete-core-device --core-device-thing-name MyGreengrassCore