You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过AWS IoT Core Rules批量导入多传感器数据至Timestream并添加类型维度

实现方案

1. 编写IoT Core规则SQL语句

使用UNNEST函数拆分Sensors数组,同时映射所需字段:

SELECT
  s.id AS measure_name,
  s.value AS measure_value,
  s.type AS measure_type,
  InstallationInstanceId AS device_id,
  CURRENT_TIMESTAMP() AS event_time
FROM
  'your_mqtt_topic'  -- 替换为实际接收数据的MQTT主题
CROSS JOIN UNNEST(Sensors) AS t(s)

说明:如果Payload中包含自定义时间戳字段(比如原Payload的Timestamp),可将CURRENT_TIMESTAMP()替换为该字段(如your_timestamp_field)。

2. 配置Timestream目标参数

在IoT Core规则的Timestream目标配置中,按以下设置:

  • 维度配置:
    • 添加维度:id,取值为 ${device_id}
    • 添加维度:measure_type,取值为 ${measure_type}
  • 度量配置:
    • 度量名称:选择Use a value from the message payload,填写 ${measure_name}
    • 度量值:选择Use a value from the message payload,填写 ${measure_value}
  • 时间戳配置:选择Use a value from the message payload,填写 ${event_time}(或自定义时间戳字段变量)

3. 验证数据导入

发送新格式的Payload到指定MQTT主题,登录Timestream控制台查询数据,确认每条记录包含id、measure_name、measure_value和measure_type字段,格式与预期一致。


内容的提问来源于stack exchange,提问作者João Artur Ceresoli

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 14:17:03