Menu
AWS Greengrass
Developer Guide

Create a Core Definition

An AWS Greengrass core definition is a list of AWS Greengrass cores that are members of the AWS Greengrass group and its associated configuration data. Currently, you can only have one AWS Greengrass core per list. This data specifies which devices are AWS Greengrass cores and which devices should sync thing shadow data with AWS IoT. You must create a thing to represent your AWS Greengrass core on AWS IoT. For this scenario, use the GGC_Thing AWS IoT thing to represent your AWS Greengrass core device.

First, create a AWS Greengrass core list with the create-core-definition CLI command:

Copy
aws greengrass create-core-definition --name "CoreDefinitionName"

The --name argument specifies a name for the AWS Greengrass core definition.

The output from the create-core-definition CLI command will look like this:

Copy
{ "LastUpdatedTimestamp": "2017-05-17T17:49:50.584Z", "CreationTimestamp": "2017-05-17T17:49:50.584Z", "Id": "099d0333-3b37-451e-8d1c-745950ea8e27", "Arn":"arn:aws:greengrass:us-west-2:123451234510:/greengrass/definition/cores/099d0333-3b37-451e-8d1c-745950ea8e27", "Name": "<CoreDefinitionName>" }

Now that you have created an AWS Greengrass core definition, create an AWS Greengrass core definition version by adding an AWS Greengrass core to the definition:

Copy
aws greengrass create-core-definition-version --core-definition-id "<CoreDefinitionId>" --cores '[{ "CertificateArn": "<GGC_Cert-Arn>", "Id": "<CoreElementId>", "SyncShadow": true, "ThingArn": "<GGC_Thing-Arn>" }]'

Arguments for the create-core command

--core-definition-id

The ID returned by the create-core-definition CLI command.

--cores

A list of JSON objects describing AWS Greengrass cores containing:

CertificateArn

The ARN of the core's certificate.

CoreElementId

An arbitrary ID for the core definition version.

SyncShadow

true if the core's shadow should be synchronized with the cloud. Otherwise, false.

ThingArn

The ARN for the AWS IoT thing that represents the AWS Greengrass core.

The output from the create-core-definition-version CLI command will look like this:

Copy
{ "Arn" : "arn:aws:greengrass:us-west-2:123451234510:/greengrass/definition/cores/099d0333-3b37-451e-8d1c-745950ea8e27/versions/e20c9a13-d737-441e-9f44-b0e70b0357f4", "Id" : "099d0333-3b37-451e-8d1c-745950ea8e27", "Version" : "e20c9a13-d737-441e-9f44-b0e70b0357f4", "CreationTimestamp" : "2017-05-17T17:57:01.449Z" }

Save the ARN from the CLI command output. You will use it later to add the list to a group.

You can view an AWS Greengrass core list version using the get-core-definition-version CLI command:

Copy
aws greengrass get-core-definition-version --core-definition-id CoreDefinitionId --core-definition-version-id <CoreDefinitionVersionId>

Arguments for the get-core-definition-version CLI command:

--core-definition-id

The AWS Greengrass core definition ID from the create-core-definition CLI command output.

--core-definition-version-id

The ID of the AWS Greengrass core definition version. In the preceding example, it would be e20c9a13-d737-441e-9f44-b0e70b0357f4.

The output from the get-core-definition-version CLI command will look like this:

Copy
{ "Definition": { "Cores": [ { "CertificateArn": "arn:aws:iot:us-west-2:123451234510:cert/b47d7b575e495d798ae0b83be87041b3b860e312105e40e2481527dd39918f49", "ThingArn": "arn:aws:iot:us-west-2:123451234510:thing/StorylineUpdate_Core", "SyncShadow": true, "Id": "base-core" } ] }, "Version": "e20c9a13-d737-441e-9f44-b0e70b0357f4", "CreationTimestamp": "2017-05-17T17:57:01.449Z", "Id": "099d0333-3b37-451e-8d1c-745950ea8e27", "Arn": "arn:aws:greengrass:us-west-2:123451234510:/greengrass/definition/cores/099d0333-3b37-451e-8d1c-745950ea8e27/versions/e20c9a13-d737-441e-9f44-b0e70b0357f4" }