View a markdown version of this page

DeviceRegistryEnrich 活動 - AWS IoT Analytics

終止支援通知:在 2025 年 12 月 15 日, AWS 將終止對 的支援 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" ] } ] }