AWS::Greengrass::DeviceDefinition
The
AWS::Greengrass::DeviceDefinition resource represents a device definition for Amazon IoT Greengrass.
Device definitions are used to organize your device definition versions.
Device definitions can reference multiple device definition versions. All device definition versions must be associated with a device definition. Each device definition version can contain one or more devices.
Note
When you create a device definition, you can optionally include an initial device definition version.
To associate a device definition version later, create an AWS::Greengrass::DeviceDefinitionVersion
resource and specify the ID of this device definition.
After you create the device definition version that contains the devices you want to deploy,
you must add it to your group version.
For more information, see AWS::Greengrass::Group.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Greengrass::DeviceDefinition", "Properties" : { "InitialVersion" :DeviceDefinitionVersion, "Name" :String, "Tags" :Json} }
YAML
Type: AWS::Greengrass::DeviceDefinition Properties: InitialVersion:DeviceDefinitionVersionName:StringTags:Json
Properties
InitialVersion-
The device definition version to include when the device definition is created. A device definition version contains a list of
deviceproperty types.Note
To associate a device definition version after the device definition is created, create an
AWS::Greengrass::DeviceDefinitionVersionresource and specify the ID of this device definition.Required: No
Type: DeviceDefinitionVersion
Update requires: Replacement
Name-
The name of the device definition.
Required: Yes
Type: String
Update requires: No interruption
Tags-
Application-specific metadata to attach to the device definition. You can use tags in IAM policies to control access to Amazon IoT Greengrass resources. You can also use tags to categorize your resources. For more information, see Tagging Your Amazon IoT Greengrass Resources in the Amazon IoT Greengrass Version 1 Developer Guide.
This
Jsonproperty type is processed as a map of key-value pairs. It uses the following format, which is different from mostTagsimplementations in Amazon CloudFormation templates."Tags": { "KeyName0": "value", "KeyName1": "value", "KeyName2": "value" }Required: No
Type: Json
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns the
ID of the device definition, such as
1234a5b6-78cd-901e-2fgh-3i45j6k178l9.
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Arn-
The Amazon Resource Name (ARN) of the
DeviceDefinition, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/devices/1234a5b6-78cd-901e-2fgh-3i45j6k178l9. Id-
The ID of the
DeviceDefinition, such as1234a5b6-78cd-901e-2fgh-3i45j6k178l9. LatestVersionArn-
The ARN of the last
DeviceDefinitionVersionthat was added to theDeviceDefinition, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/devices/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2. Name-
The name of the device definition.
Examples
Device Definition Snippet
The following snippet defines a device definition resource with an initial version that contains a device. This example points to a manually generated device certificate.
For an example of a complete template, see the AWS::Greengrass::Group resource.
JSON
"TestDeviceDefinition": { "Type": "AWS::Greengrass::DeviceDefinition", "Properties": { "Name": "DemoTestDeviceDefinition", "InitialVersion": { "Devices": [ { "Id": "TestDevice1", "ThingArn": { "Fn::Join": [ ":", [ "arn:aws:iot", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "thing/TestDevice1" ] ] }, "CertificateArn": { "Fn::Join": [ ":", [ "arn:aws:iot", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "cert/4db8b7f58d95b7fdb45c38c28a0b1adf6c5f8c03e902de65734935fea83e751f" ] ] }, "SyncShadow": "true" } ] } } }
YAML
TestDeviceDefinition: Type: 'AWS::Greengrass::DeviceDefinition' Properties: Name: DemoTestDeviceDefinition InitialVersion: Devices: - Id: TestDevice1 ThingArn: !Join - ':' - - 'arn:aws:iot' - !Ref 'AWS::Region' - !Ref 'AWS::AccountId' - thing/TestDevice1 CertificateArn: !Join - ':' - - 'arn:aws:iot' - !Ref 'AWS::Region' - !Ref 'AWS::AccountId' - >- cert/4db8b7f58d95b7fdb45c38c28a0b1adf6c5f8c03e902de65734935fea83e751f SyncShadow: 'true'
See also
-
CreateDeviceDefinition in the Amazon IoT Greengrass Version 1 API Reference