AWS::Greengrass::ResourceDefinitionVersion - AWS CloudFormation

AWS::Greengrass::ResourceDefinitionVersion

The AWS::Greengrass::ResourceDefinitionVersion resource represents a resource definition version for AWS IoT Greengrass. A resource definition version contains a list of resources. (In AWS CloudFormation, resources are named resource instances.)

Note

To create a resource definition version, you must specify the ID of the resource definition that you want to associate with the version. For information about creating a resource definition, see AWS::Greengrass::ResourceDefinition.

After you create a resource definition version that contains the resources 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 AWS CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::Greengrass::ResourceDefinitionVersion", "Properties" : { "ResourceDefinitionId" : String, "Resources" : [ ResourceInstance, ... ] } }

YAML

Type: AWS::Greengrass::ResourceDefinitionVersion Properties: ResourceDefinitionId: String Resources: - ResourceInstance

Properties

ResourceDefinitionId

The ID of the resource definition associated with this version. This value is a GUID.

Required: Yes

Type: String

Update requires: Replacement

Resources

The resources in this version.

Required: Yes

Type: Array of ResourceInstance

Update requires: Replacement

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the Amazon Resource Name (ARN) of the resource definition version, such as arn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/resources/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2.

For more information about using the Ref function, see Ref.

Fn::GetAtt

Examples

Resource Definition Version Snippet

The following snippet defines resource definition and resource definition version resources. The resource definition version references the resource definition and contains each type of resource.

For an example of a complete template, see the AWS::Greengrass::Group resource.

JSON

"TestResourceDefinition": { "Type": "AWS::Greengrass::ResourceDefinition", "Properties": { "Name": "DemoTestResourceDefinition" } }, "TestResourceDefinitionVersion": { "Type": "AWS::Greengrass::ResourceDefinitionVersion", "Properties": { "ResourceDefinitionId": { "Ref": "TestResourceDefinition" }, "Resources": [ { "Id": "ResourceId1", "Name": "LocalDeviceResource", "ResourceDataContainer": { "LocalDeviceResourceData": { "SourcePath": "/dev/TestSourcePath1", "GroupOwnerSetting": { "AutoAddGroupOwner": "false", "GroupOwner": "TestOwner" } } } }, { "Id": "ResourceId2", "Name": "LocalVolumeResourceData", "ResourceDataContainer": { "LocalVolumeResourceData": { "SourcePath": "/dev/TestSourcePath2", "DestinationPath": "/volumes/TestDestinationPath2", "GroupOwnerSetting": { "AutoAddGroupOwner": "false", "GroupOwner": "TestOwner" } } } }, { "Id": "ResourceId3", "Name": "SageMakerMachineLearningModelResourceData", "ResourceDataContainer": { "SageMakerMachineLearningModelResourceData": { "SageMakerJobArn": { "Fn::Join": [ ":", [ "arn:aws:sagemaker", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "training-job/testJob" ] ] }, "DestinationPath": "/sagemakermodels/TestDestinationPath3" } } }, { "Id": "ResourceId4", "Name": "S3MachineLearningModelResourceData", "ResourceDataContainer": { "S3MachineLearningModelResourceData": { "S3Uri": "http://testBucket.s3.amazonaws.com/testUri.zip", "DestinationPath": "/mlModels/TestDestinationPath4" } } }, { "Id": "ResourceId5", "Name": "SecretsManagerSecretResourceData", "ResourceDataContainer": { "SecretsManagerSecretResourceData": { "ARN": { "Fn::Join": [ ":", [ "arn:aws:secretsmanager", { "Ref": "AWS::Region" }, { "Ref": "AWS::AccountId" }, "secret:testARN" ] ] }, "AdditionalStagingLabelsToDownload": [ "label1", "label2" ] } } } ] } }

YAML

TestResourceDefinition: Type: 'AWS::Greengrass::ResourceDefinition' Properties: Name: DemoTestResourceDefinition InitialVersion: Resources: - Id: ResourceId1 Name: LocalDeviceResource ResourceDataContainer: LocalDeviceResourceData: SourcePath: /dev/TestSourcePath1 GroupOwnerSetting: AutoAddGroupOwner: 'false' GroupOwner: TestOwner - Id: ResourceId2 Name: LocalVolumeResourceData ResourceDataContainer: LocalVolumeResourceData: SourcePath: /dev/TestSourcePath2 DestinationPath: /volumes/TestDestinationPath2 GroupOwnerSetting: AutoAddGroupOwner: 'false' GroupOwner: TestOwner - Id: ResourceId3 Name: SageMakerMachineLearningModelResourceData ResourceDataContainer: SageMakerMachineLearningModelResourceData: SageMakerJobArn: !Join - ':' - - 'arn:aws:sagemaker' - !Ref 'AWS::Region' - !Ref 'AWS::AccountId' - training-job/testJob DestinationPath: /sagemakermodels/TestDestinationPath3 - Id: ResourceId4 Name: S3MachineLearningModelResourceData ResourceDataContainer: S3MachineLearningModelResourceData: S3Uri: 'http://testBucket.s3.amazonaws.com/testUri.zip' DestinationPath: /mlModels/TestDestinationPath4 - Id: ResourceId5 Name: SecretsManagerSecretResourceData ResourceDataContainer: SecretsManagerSecretResourceData: ARN: !Join - ':' - - 'arn:aws:secretsmanager' - !Ref 'AWS::Region' - !Ref 'AWS::AccountId' - 'secret:testARN' AdditionalStagingLabelsToDownload: - label1 - label2

See also