2

我在 AWS 中开发了一个管道,我通过 Python 3 从我的笔记本收集 CPU 温度,使用安全协议发送到 AWS IoT Core,一条规则将数据发送到 Cloud Watch,然后 DynamoDB 保存它。创建了一个数据管道以将此 DynamoDB 数据保存到 S3,我想使用 Quick Sight 生成此数据的绘图。

但是,我无法让 Quick Sight 正确读取文件。S3 文件如下所示:

{"timestamp":{"s":"1526819850637"},"payload":{"m":{"$Temperature":{"s":"42.000"}}}}
{"timestamp":{"s":"1526819976032"},"payload":{"m":{"$Temperature":{"s":"42.000"}}}}
{"timestamp":{"s":"1526819934216"},"payload":{"m":{"$Temperature":{"s":"42.000"}}}}
{"timestamp":{"s":"1526817845094"},"payload":{"m":{"$Temperature":{"s":"48.000"}}}}

当我使用下面的清单文件时,Quick Sight 成功读取数据,但新计算字段中的“parseJson”命令消失了,无法读取 JSON:

{
    "fileLocations": [
        {
            "URIs": [
                "https://s3.amazonaws.com/my-bucket2/2018-05-20-12-32-49/12345-a279-1234-2269-491212345"
            ]
        },
        {
            "URIPrefixes": [
                "https://s3.amazonaws.com/my-bucket2/2018-05-20-12-32-49/12345-a279-1234-2269-491212345"
            ]
        }
    ],"globalUploadSettings": {
        "format": "CSV","delimiter":"\n","textqualifier":"'"
    }

}

Quick Sight 将 JSON 读取为:

{{"timestamp":{"s":"1526819850637"},"payload":{"m":{"$Temperature":{"s":"42.000"}}}}}

...没有'parseJson'命令。

Quick Sight 中的数据没有缺失值,AWS 管道运行良好。我能做些什么 ?

4

1 回答 1

1

我找到了让它工作的方法。简单地:

{
    "fileLocations": [
        {
            "URIs": [
                "https://s3.amazonaws.com/your-bucket2/2018-05-20-12-32-49/123456789"
            ]
        },
        {
            "URIPrefixes": [
            "https://s3.amazonaws.com/your-bucket2/2018-05-20-12-32-49/123456789"
            ]
        }
    ],"globalUploadSettings": {"format":"JSON",
    "delimiter":"\n","textqualifier":"'"
    }
}
于 2018-05-20T19:14:44.853 回答