DeviceRegistryEnrich activity
The deviceRegistryEnrich
activity enables you to add data from the Amazon IoT device
registry to your message payload. For example, given the following message:
{ "temp": 50, "hum": 40, "device" { "thingName": "my-thing" } }
and a deviceRegistryEnrich
activity that looks like this:
{ "deviceRegistryEnrich": { "name": "MyDeviceRegistryEnrichActivity", "attribute": "metadata", "thingName": "device.thingName", "roleArn": "arn:aws:iam::<your-account-number>:role:MyEnrichRole", "next": "MyDatastoreActivity" } }
The output message now looks like this example.
{ "temp" : 50, "hum" : 40, "device" { "thingName" : "my-thing" }, "metadata" : { "defaultClientId": "my-thing", "thingTypeName": "my-thing", "thingArn": "arn:aws:iot:us-east-1:<your-account-number>:thing/my-thing", "version": 1, "thingName": "my-thing", "attributes": {}, "thingId": "aaabbbccc-dddeeef-gghh-jjkk-llmmnnoopp" } }
You must specify a role in the roleArn
field of the activity definition that
has the appropriate permissions attached. The role must have a permissions policy that looks like
the following example.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:DescribeThing" ], "Resource": [ "arn:aws:iot:<region>:<account-id>:thing/<thing-name>" ] } ] }
and a trust policy that looks like:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "iotanalytics.amazonaws.com" }, "Action": [ "sts:AssumeRole" ] } ] }