AWS::Greengrass::CoreDefinition
The AWS::Greengrass::CoreDefinition
resource represents a core definition
for AWS IoT Greengrass. Core definitions are used to organize your core definition
versions.
Core definitions can reference multiple core definition versions. All core definition versions must be associated with a core definition. Each core definition version can contain one Greengrass core.
Note
When you create a core definition, you can optionally include an initial core
definition version. To associate a core definition version later, create an AWS::Greengrass::CoreDefinitionVersion
resource and specify
the ID of this core definition.
After you create the core definition version that contains the core 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::CoreDefinition", "Properties" : { "InitialVersion" :
CoreDefinitionVersion
, "Name" :String
, "Tags" :[
} }Tag
, ... ]
YAML
Type: AWS::Greengrass::CoreDefinition Properties: InitialVersion:
CoreDefinitionVersion
Name:String
Tags:-
Tag
Properties
InitialVersion
-
The core definition version to include when the core definition is created. Currently, a core definition version can contain only one
core
.Note
To associate a core definition version after the core definition is created, create an
AWS::Greengrass::CoreDefinitionVersion
resource and specify the ID of this core definition.Required: No
Type: CoreDefinitionVersion
Update requires: Replacement
Name
-
The name of the core definition.
Required: Yes
Type: String
Update requires: No interruption
-
Application-specific metadata to attach to the core definition. You can use tags in IAM policies to control access to AWS IoT Greengrass resources. You can also use tags to categorize your resources. For more information, see Tagging Your AWS IoT Greengrass Resources in the AWS IoT Greengrass Version 1 Developer Guide .
This
Json
property type is processed as a map of key-value pairs. It uses the following format, which is different from mostTags
implementations in AWS CloudFormation templates."Tags": { "KeyName0": "value", "KeyName1": "value", "KeyName2": "value" }
Required: No
Type: Array of
Tag
Update requires: No interruption
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the ID of the core definition, such as
1234a5b6-78cd-901e-2fgh-3i45j6k178l9
.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic 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::GetAtt
intrinsic function, see Fn::GetAtt
.
Arn
-
The Amazon Resource Name (ARN) of the
CoreDefinition
, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/cores/1234a5b6-78cd-901e-2fgh-3i45j6k178l9
. Id
-
The ID of the
CoreDefinition
, such as1234a5b6-78cd-901e-2fgh-3i45j6k178l9
. LatestVersionArn
-
The ARN of the last
CoreDefinitionVersion
that was added to theCoreDefinition
, such asarn:aws:greengrass:us-east-1:123456789012:/greengrass/definition/cores/1234a5b6-78cd-901e-2fgh-3i45j6k178l9/versions/9876ac30-4bdb-4f9d-95af-b5fdb66be1a2
. Name
-
The name of the
CoreDefinition
, such asMyCoreDefinition
.
Examples
Create a Core Definition
The following example creates a core definition that specifies an initial version that contains a core.
The template uses the Ref
function to return the ID of the core
definition for the CoreDefinitionId
property, which associates the
version with the core definition. The template uses parameters to represent the core
definition name and the ID, thing ARN, and certificate ARN to use for the core. It
also outputs the ID of the new core definition.
For another template example, see the AWS::Greengrass::Group
resource.
JSON
{ "Description": "Create CoreDefinition with InitialVersion", "Parameters": { "CoreDefinitionName": { "Type": "String", "Default": "TestCoreDefinition" }, "CoreId": { "Type": "String", "Default": "TestCoreId" }, "CoreThingArn": { "Type": "String", "Default": "TestCoreThingArn" }, "CoreCertificateArn": { "Type": "String", "Default": "TestCoreCertArn" } }, "Resources": { "CoreDefinition": { "Type": "AWS::Greengrass::CoreDefinition", "Properties": { "Name": { "Ref": "CoreDefinitionName" }, "InitialVersion": { "Cores": [ { "Id": { "Ref": "CoreId" }, "ThingArn": { "Ref": "CoreThingArn" }, "CertificateArn": { "Ref": "CoreCertificateArn" }, "SyncShadow": "true" } ] } } } }, "Outputs": { "CoreDefinitionId": { "Value": { "Ref": "CoreDefinition" } } } }
YAML
Description: Create CoreDefinition with InitialVersion Parameters: CoreDefinitionName: Type: String Default: TestCoreDefinition CoreId: Type: String Default: TestCoreId CoreThingArn: Type: String Default: TestCoreThingArn CoreCertificateArn: Type: String Default: TestCoreCertArn Resources: CoreDefinition: Type: 'AWS::Greengrass::CoreDefinition' Properties: Name: !Ref CoreDefinitionName InitialVersion: Cores: - Id: !Ref CoreId ThingArn: !Ref CoreThingArn CertificateArn: !Ref CoreCertificateArn SyncShadow: 'true' Outputs: CoreDefinitionId: Value: !Ref CoreDefinition
See also
-
CreateCoreDefinition in the AWS IoT Greengrass Version 1 API Reference