Amazon IoT Greengrass Version 1 entered the extended life phase on June 30, 2023. For more information, see the Amazon IoT Greengrass V1 maintenance policy. After this date, Amazon IoT Greengrass V1 won't release updates that provide features, enhancements, bug fixes, or security patches. Devices that run on Amazon IoT Greengrass V1 won't be disrupted and will continue to operate and to connect to the cloud. We strongly recommend that you migrate to Amazon IoT Greengrass Version 2, which adds significant new features and support for additional platforms.
Amazon CloudFormation support for Amazon IoT Greengrass
Amazon CloudFormation is a service that can help you create, manage, and replicate your Amazon resources. You can use Amazon CloudFormation templates to define Amazon IoT Greengrass groups and the client devices, subscriptions, and other components that you want to deploy. For an example, see Example template.
The resources and infrastructure that you generate from a template is called a stack. You can define all of your resources in one template or refer to resources from other stacks. For more information about Amazon CloudFormation templates and features, see What is Amazon CloudFormation? in the Amazon CloudFormation User Guide.
Creating resources
Amazon CloudFormation templates are JSON or YAML documents that describe the properties and relationships of Amazon resources. The following Amazon IoT Greengrass resources are supported:
Groups
Cores
Client devices (devices)
Lambda functions
Connectors
Resources (local, machine learning, and secret)
Subscriptions
Loggers (logging configurations)
In Amazon CloudFormation templates, the structure and syntax of Greengrass resources are based on the
Amazon IoT Greengrass API. For example, the example
template associates a top-level DeviceDefinition
with a
DeviceDefinitionVersion
that contains an individual client device. For
more information, see Overview of the Amazon IoT Greengrass group object model.
The Amazon IoT Greengrass resource types reference in the Amazon CloudFormation User Guide describes the Greengrass resources that you can manage with Amazon CloudFormation. When you use Amazon CloudFormation templates to create Greengrass resources, we recommend that you manage them only from Amazon CloudFormation. For example, you should update your template if you want to add, change, or remove a device (instead of using the Amazon IoT Greengrass API or Amazon IoT console). This allows you to use rollback and other Amazon CloudFormation change management features. For more information about using Amazon CloudFormation to create and manage your resources and stacks, see Working with stacks in the Amazon CloudFormation User Guide.
For a walkthrough that shows how to create and deploy Amazon IoT Greengrass resources in an Amazon CloudFormation template, see Automating Amazon IoT Greengrass setup with Amazon CloudFormation
Deploying resources
After you create an Amazon CloudFormation stack that contains your group version, you can use the Amazon CLI or Amazon IoT console to deploy it.
Note
To deploy a group, you must have a Greengrass service role associated with your Amazon Web Services account. The service role allows Amazon IoT Greengrass to access your resources in Amazon Lambda and other Amazon services. This role should exist if you already deployed a Greengrass group in the current Amazon Web Services Region. For more information, see Greengrass service role.
- To deploy the group (Amazon CLI)
-
-
Run the create-deployment command.
aws greengrass create-deployment --group-id
GroupId
--group-version-idGroupVersionId
--deployment-type NewDeploymentNote
The
CommandToDeployGroup
statement in the example template shows how to output the command with your group and group version IDs when you create a stack.
-
- To deploy the group (console)
-
In the Amazon IoT console navigation pane, under Manage, expand Greengrass devices, and then choose Groups (V1).
Choose your group.
-
On the group configuration page, choose Deploy.
Example template
The following example template creates a Greengrass group that contains a core, client
device, function, logger, subscription, and two resources. To do this, the template
follows the object model of the Amazon IoT Greengrass API. For example, the client devices that you want
to add to the group are contained in a DeviceDefinitionVersion
resource,
which is associated with a DeviceDefinition
resource. To add the devices to
the group, the group version references the ARN of the
DeviceDefinitionVersion
.
The template includes parameters that let you specify the certificate ARNs for the core
and device and the version ARN of the source Lambda function (which is an Amazon Lambda resource).
It uses the Ref
and GetAtt
intrinsic functions to
reference IDs, ARNs, and other attributes that are required to create Greengrass resources.
The template also defines two Amazon IoT devices (things), which represent the core and client device that are added to the Greengrass group.
After you create the stack with your Greengrass resources, you can use the Amazon CLI or the Amazon IoT console to deploy the group.
Note
The CommandToDeployGroup
statement in the example
shows how to output a complete create-deployment CLI command that you can use
to deploy your group.
Supported Amazon Web Services Regions
Currently, you can create and manage Amazon IoT Greengrass resources only in the following Amazon Web Services Regions:
US East (Ohio)
US East (N. Virginia)
US West (Oregon)
Asia Pacific (Mumbai)
Asia Pacific (Seoul)
Asia Pacific (Singapore)
Asia Pacific (Sydney)
Asia Pacific (Tokyo)
China (Beijing)
Europe (Frankfurt)
Europe (Ireland)
Europe (London)
Amazon GovCloud (US-West)