amazon-web-services - 在 AWS IoT Core 规则操作或 AWS Timestream 数据库表中,我们如何指定/配置措施?

标签 amazon-web-services aws-iot aws-iot-core amazon-timestream

以下是我的消息中的数据。

{
  "time_epoch": 1604489437,
  "temperature": 100,
  "device_id": "TempSensor1"
}

我有一个 IoT 核心规则,它接受此消息并采取操作将其发送到 Timestream 数据库表。

在 IoT 核心规则中 - 我已将 device_id 配置为维度,将 time_epoch 配置为时间戳。截图如下:

enter image description here

问题:当消息到达 Timestream 数据库表时,device_id 正确显示为维度。 time_epoch 在时间列下正确显示。 但是,所有 3 个 - device_id、温度和 time_epoch 都显示为度量。截图如下:

enter image description here

我想 - 由于我在 IoT 核心规则操作中指定了 device_id 是维度,time_epoch 是时间戳,那么 AWS Timestream 应该足够聪明,不会将这两者作为度量。

如何指示 timestream db 不将 device_id 和 time_epoch 视为度量;只考虑温度作为衡量标准?我尝试编辑表设置,但找不到任何选项来指定/配置度量。

最佳答案

我假设你正在做类似的事情:

SELECT * FROM /your/topic

你想做的是:

SELECT temperature FROM /your/topic

您现在必须编辑维度才能使用内置函数而不是 SQL 查询结果。本质上,使用 ${clientId()} 表示 device_id,使用 ${timestamp()} 表示 time。请参阅文档以获取可用列表 substitution templates .

然后您应该会看到您期望看到的表格。

您当前看到虚假措施的原因是,如 the docs状态下,Timestream 将 JSON 的每个键转换为自己的测量记录。

关于amazon-web-services - 在 AWS IoT Core 规则操作或 AWS Timestream 数据库表中,我们如何指定/配置措施?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64659408/

相关文章:

amazon-sqs - 重定向到 AWS 中的 SQS 时如何获取 IoT 主题

sql - AWS IoT SQL 规则

amazon-web-services - 如何安排 AWS 中的 IOT 作业在特定时间运行?

aws-cloudformation - CloudFormation 模板中的事物类型

amazon-web-services - AWS-modyfing lambda 是否会立即更新 CloudFormation 堆栈?

amazon-web-services - AWS Beanstalk docker 镜像自动更新不起作用

amazon-web-services - 重启nginx : unknown directive "listen"

amazon-web-services - 在 AWS Fargate 中链接容器

amazon-web-services - 使用 API 插入 AWS Timestream