AWS::Greengrass::ResourceDefinitionVersion - AWS CloudFormation
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅中国的 AWS 服务入门

AWS::Greengrass::ResourceDefinitionVersion

AWS::Greengrass::ResourceDefinitionVersion 资源表示 AWS IoT Greengrass 的资源定义版本。资源定义版本包含资源的列表。(在 AWS CloudFormation 中,资源是命名的资源实例。)

注意

要创建资源定义版本,您必须指定要与此版本关联的资源定义的 ID。有关创建资源定义的信息,请参阅 AWS::Greengrass::ResourceDefinition

在创建包含要部署的资源的资源定义版本后,您必须将其添加到组版本。有关更多信息,请参阅 AWS::Greengrass::Group

语法

要在 AWS CloudFormation 模板中声明此实体,请使用以下语法:

JSON

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

YAML

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

属性

ResourceDefinitionId

与此版本关联的资源定义的 ID。此值是 GUID。

必需:是

类型:字符串

Update requires: Replacement

Resources

此版本中的资源。

必需:是

类型ResourceInstance 的列表

Update requires: Replacement

返回值

Ref

在将此资源的逻辑 ID 传递给内部 Ref 函数时,Ref 返回资源定义版本的 Amazon 资源名称 (ARN),例如 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.

示例

资源定义版本代码段

以下代码段定义资源定义和资源定义版本资源。资源定义资源引用资源定义并包含每种类型的资源。

有关完整模板的示例,请参阅 AWS::Greengrass::Group 资源。

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

另请参阅