Install AWS IoT Greengrass Core software with custom resource provisioning
This feature is available for v2.4.0 and later of the Greengrass nucleus component.
The AWS IoT Greengrass Core software installer provides a Java interface that you can implement in a custom plugin that provisions required AWS resources. You can develop a provisioning plugin to use custom X.509 client certificates or to run complex provisioning steps that other installation processes don't support. For more information, see Create your own client certificates in the AWS IoT Core Developer Guide.
To run a custom provisioning plugin when you install the AWS IoT Greengrass Core software, you create a JAR file that you provide to the installer. The installer runs the plugin, and the plugin returns a provisioning configuration that defines the AWS resources for the Greengrass core device. The installer uses this information to configure the AWS IoT Greengrass Core software on the device. For more information, see Develop custom provisioning plugins.
Important
Before you download the AWS IoT Greengrass Core software, check that your core device meets the requirements to install and run the AWS IoT Greengrass Core software v2.0.
Topics
Prerequisites
To install the AWS IoT Greengrass Core software with custom provisioning, you must have the following:
-
A JAR file for a custom provisioning plugin that implements the
DeviceIdentityInterface
. The custom provisioning plugin must return values for each system and nucleus configuration parameter. Otherwise, you must provide those values in the configuration file during installation. For more information, see Develop custom provisioning plugins.
Set up the device environment
Follow the steps in this section to set up a Linux or Windows device to use as your AWS IoT Greengrass core device.
Set up a Linux device
To set up a Linux device for AWS IoT Greengrass V2
-
Install the Java runtime, which AWS IoT Greengrass Core software requires to run. We recommend that you use Amazon Corretto
or OpenJDK long-term support versions. Version 8 or higher is required. The following commands show you how to install OpenJDK on your device. -
For Debian-based or Ubuntu-based distributions:
sudo apt install default-jdk
-
For Red Hat-based distributions:
sudo yum install java-11-openjdk-devel
-
For Amazon Linux 2:
sudo amazon-linux-extras install java-openjdk11
-
For Amazon Linux 2023:
sudo dnf install java-11-amazon-corretto -y
When the installation completes, run the following command to verify that Java runs on your Linux device.
java -version
The command prints the version of Java that runs on the device. For example, on a Debian-based distribution, the output might look similar to the following sample.
openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1deb10u2) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1deb10u2, mixed mode)
-
-
(Optional) Create the default system user and group that runs components on the device. You can also choose to let the AWS IoT Greengrass Core software installer create this user and group during installation with the
--component-default-user
installer argument. For more information, see Installer arguments.sudo useradd --system --create-home ggc_user sudo groupadd --system ggc_group
-
Verify that the user that runs the AWS IoT Greengrass Core software (typically
root
), has permission to runsudo
with any user and any group.-
Run the following command to open the
/etc/sudoers
file.sudo visudo
-
Verify that the permission for the user looks like the following example.
root ALL=(ALL:ALL) ALL
-
-
(Optional) To run containerized Lambda functions, you must enable cgroups
v1, and you must enable and mount the memory and devices cgroups. If you don't plan to run containerized Lambda functions, you can skip this step. To enable these cgroups options, boot the device with the following Linux kernel parameters.
cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0
For information about viewing and setting kernel parameters for your device, see the documentation for your operating system and boot loader. Follow the instructions to permanently set the kernel parameters.
-
Install all other required dependencies on your device as indicated by the list of requirements in Device requirements.
Set up a Windows device
Note
This feature is available for v2.5.0 and later of the Greengrass nucleus component.
To set up a Windows device for AWS IoT Greengrass V2
-
Install the Java runtime, which AWS IoT Greengrass Core software requires to run. We recommend that you use Amazon Corretto
or OpenJDK long-term support versions. Version 8 or higher is required. -
Check whether Java is available on the PATH
system variable, and add it if not. The LocalSystem account runs the AWS IoT Greengrass Core software, so you must add Java to the PATH system variable instead of the PATH user variable for your user. Do the following: -
Press the Windows key to open the start menu.
-
Type
environment variables
to search for the system options from the start menu. -
In the start menu search results, choose Edit the system environment variables to open the System properties window.
-
Choose Environment variables... to open the Environment Variables window.
-
Under System variables, select Path, and then choose Edit. In the Edit environment variable window, you can view each path on a separate line.
-
Check if the path to the Java installation's
bin
folder is present. The path might look similar to the following example.C:\\Program Files\\Amazon Corretto\\jdk11.0.13_8\\bin
-
If the Java installation's
bin
folder is missing from Path, choose New to add it, and then choose OK.
-
-
Open the Windows Command Prompt (
cmd.exe
) as an administrator. -
Create the default user in the LocalSystem account on the Windows device. Replace
password
with a secure password.net user /add ggc_user
password
Tip
Depending on your Windows configuration, the user's password might be set to expire at a date in the future. To ensure your Greengrass applications continue to operate, track when the password expires, and update it before it expires. You can also set the user's password to never expire.
-
To check when a user and its password expire, run the following command.
net user
ggc_user
| findstr /C:expires -
To set a user's password to never expire, run the following command.
wmic UserAccount where "Name='
ggc_user
'" set PasswordExpires=False -
If you’re using Windows 10 or later where the
wmic
command is deprecated, run the following PowerShell command. Get-CimInstance -Query "SELECT * from Win32_UserAccount WHERE name = '
ggc_user
'" | Set-CimInstance -Property @{PasswordExpires="False"}
-
-
Download and install the PsExec utility
from Microsoft on the device. -
Use the PsExec utility to store the user name and password for the default user in the Credential Manager instance for the LocalSystem account. Replace
password
with the user's password that you set earlier.psexec -s cmd /c cmdkey /generic:ggc_user /user:ggc_user /pass:
password
If the PsExec License Agreement opens, choose Accept to agree to the license and run the command.
Note
On Windows devices, the LocalSystem account runs the Greengrass nucleus, and you must use the PsExec utility to store the default user information in the LocalSystem account. Using the Credential Manager application stores this information in the Windows account of the currently logged on user, instead of the LocalSystem account.
Download the AWS IoT Greengrass Core software
You can download the latest version of the AWS IoT Greengrass Core software from the following location:
Note
You can download a specific version of the AWS IoT Greengrass Core software from the following location.
Replace version
with the version to download.
https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-
version
.zip
To download the AWS IoT Greengrass Core software
-
On your core device, download the AWS IoT Greengrass Core software to a file named
greengrass-nucleus-latest.zip
.By downloading this software, you agree to the Greengrass Core Software License Agreement
. -
(Optional) To verify the Greengrass nucleus software signature
Note
This feature is available with Greengrass nucleus version 2.9.5 and later.
-
Use the following command to verify your Greengrass nucleus artifact's signature:
-
The
jarsigner
invocation yields output that indicates the results of the verification.-
If the Greengrass nucleus zip file is signed, the output contains the following statement:
jar verified.
-
If the Greengrass nucleus zip file isn't signed, the output contains the following statement:
jar is unsigned.
-
-
If you provided the Jarsigner
-certs
option along with-verify
and-verbose
options, the output also includes detailed signer certificate information.
-
-
Unzip the AWS IoT Greengrass Core software to a folder on your device. Replace
GreengrassInstaller
with the folder that you want to use. -
(Optional) Run the following command to see the version of the AWS IoT Greengrass Core software.
java -jar ./
GreengrassInstaller
/lib/Greengrass.jar --version
Important
If you install a version of the Greengrass nucleus earlier than v2.4.0, don't remove this folder after you install the AWS IoT Greengrass Core software. The AWS IoT Greengrass Core software uses the files in this folder to run.
If you downloaded the latest version of the software, you install v2.4.0 or later, and you can remove this folder after you install the AWS IoT Greengrass Core software.
Install the AWS IoT Greengrass Core software
Run the installer with arguments that specify the following actions:
-
Install from a partial configuration file that specifies to use your custom provisioning plugin to provision AWS resources. The AWS IoT Greengrass Core software uses a configuration file that specifies the configuration of every Greengrass component on the device. The installer creates a complete configuration file from the partial configuration file that you provide and the AWS resources that the custom provisioning plugin creates.
-
Specify to use the
ggc_user
system user to run software components on the core device. On Linux devices, this command also specifies to use theggc_group
system group, and the installer creates the system user and group for you. -
Set up the AWS IoT Greengrass Core software as a system service that runs at boot. On Linux devices, this requires the Systemd
init system. Important
On Windows core devices, you must set up the AWS IoT Greengrass Core software as a system service.
For more information about the arguments that you can specify, see Installer arguments.
Note
If you are running AWS IoT Greengrass on a device with limited memory, you can
control the amount of memory that AWS IoT Greengrass Core software uses. To control memory allocation, you can set
JVM heap size options in the jvmOptions
configuration parameter in your nucleus
component. For more information, see Control memory allocation with JVM options.
To install the AWS IoT Greengrass Core software (Linux)
-
Check the version of the AWS IoT Greengrass Core software.
-
Replace
GreengrassInstaller
with the path to the folder that contains the software.
java -jar ./
GreengrassInstaller
/lib/Greengrass.jar --version -
-
Use a text editor to create a configuration file named
config.yaml
to provide to the installer.For example, on a Linux-based system, you can run the following command to use GNU nano to create the file.
nano
GreengrassInstaller
/config.yamlCopy the following YAML content into the file.
--- system: rootpath: "
" # The following values are optional. Return them from the provisioning plugin or set them here. # certificateFilePath: "" # privateKeyPath: "" # rootCaPath: "" # thingName: "" services: aws.greengrass.Nucleus: version: "/greengrass/v2
2.14.0
" configuration: # The following values are optional. Return them from the provisioning plugin or set them here. # awsRegion: "" # iotRoleAlias: "" # iotDataEndpoint: "" # iotCredEndpoint: "" com.example.CustomProvisioning: configuration: # You can specify configuration parameters to provide to your plugin. # pluginParameter: ""Then, do the following:
-
Replace
2.14.0
with the version of the AWS IoT Greengrass Core software. -
Replace each instance of
with the Greengrass root folder./greengrass/v2
-
(Optional) Specify system and nucleus configuration values. You must set these values if your provisioning plugin doesn't provide them.
-
(Optional) Specify configuration parameters to provide to your provisioning plugin.
Note
In this configuration file, you can customize other configuration options, such as the ports and network proxy to use, as shown in the following example. For more information, see Greengrass nucleus configuration.
--- system: rootpath: "
" # The following values are optional. Return them from the provisioning plugin or set them here. # certificateFilePath: "" # privateKeyPath: "" # rootCaPath: "" # thingName: "" services: aws.greengrass.Nucleus: version: "/greengrass/v2
2.14.0
" configuration: mqtt: port: 443 greengrassDataPlanePort: 443 networkProxy: noProxyAddresses: "http://192.168.0.1,www.example.com" proxy: url: "http://my-proxy-server:1100" username: "Mary_Major" password: "pass@word1357" # The following values are optional. Return them from the provisioning plugin or set them here. # awsRegion: "" # iotRoleAlias: "" # iotDataEndpoint: "" # iotCredEndpoint: "" com.example.CustomProvisioning: configuration: # You can specify configuration parameters to provide to your plugin. # pluginParameter: "" -
-
Run the installer. Specify
--trusted-plugin
to provide your custom provisioning plugin, and specify--init-config
to provide the configuration file.Note
Windows has a path length limitation of 260 characters. If you are using Windows, use a root folder like
C:\greengrass\v2
orD:\greengrass\v2
to keep the Greengrass components paths under the 260 character limit.-
Replace
or/greengrass/v2
C:\greengrass\v2
with the Greengrass root folder. -
Replace each instance of
GreengrassInstaller
with the folder where you unpacked the installer. -
Replace the path to the custom provisioning plugin JAR file with the path to your plugin's JAR file.
Important
On Windows core devices, you must specify
--setup-system-service true
to set up the AWS IoT Greengrass Core software as a system service.If you specify
--setup-system-service true
, the installer printsSuccessfully set up Nucleus as a system service
if it set up and ran the software as a system service. Otherwise, the installer doesn't output any message if it installs the software successfully.Note
You can't use the
deploy-dev-tools
argument to deploy local development tools when you run the installer without the--provision true
argument. For information about deploying the Greengrass CLI directly on your device, see Greengrass Command Line Interface. -
-
Verify the installation by viewing the files in the root folder.
If the installation succeeded, the root folder contains several folders, such as
config
,packages
, andlogs
.
If you installed the AWS IoT Greengrass Core software as a system service, the installer runs the software for you. Otherwise, you must run the software manually. For more information, see Run the AWS IoT Greengrass Core software.
For more information about how to configure and use the software and AWS IoT Greengrass, see the following: