View a markdown version of this page

DeviceRegistryEnrich 活动 - AWS IoT Analytics

终止支持通知: AWS 将于 2025 年 12 月 15 日终止对的支持 AWS IoT Analytics。2025 年 12 月 15 日之后,您将无法再访问 AWS IoT Analytics 控制台或 AWS IoT Analytics 资源。有关更多信息,请参阅AWS IoT Analytics 终止支持

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DeviceRegistryEnrich 活动

通过该deviceRegistryEnrich活动,您可以将 AWS IoT 设备注册表中的数据添加到消息负载中。例如,给定了以下消息:

{ "temp": 50, "hum": 40, "device" { "thingName": "my-thing" } }

和类似下面这样的 deviceRegistryEnrich 活动:

{ "deviceRegistryEnrich": { "name": "MyDeviceRegistryEnrichActivity", "attribute": "metadata", "thingName": "device.thingName", "roleArn": "arn:aws:iam::<your-account-number>:role:MyEnrichRole", "next": "MyDatastoreActivity" } }

输出消息现在如此示例所示。

{ "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" } }

您必须在活动定义的 roleArn 字段中指定已附加适当权限的角色。该角色必须具有类似以下示例的权限策略。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:DescribeThing" ], "Resource": [ "arn:aws:iot:us-east-1:123456789012:thing/your-thingName" ] } ] }

和类似如下的信任策略:

JSON
{ "Version":"2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": "iotanalytics.amazonaws.com" }, "Action": [ "sts:AssumeRole" ] } ] }