通过IoT Core Rule Egine连接其他aws服务.本实验将数据存入ElasticSearch并通过Kibana进行展现
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws-cn:es:cn-north-1:XXXXXXXXXXXX:domain/iot-lab/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": "XXXXXXXXXXXX"
}
}
}
]
}
curl -H 'Content-Type: application/json' -i -X PUT -d '{
"mappings": {
"car": {
"properties": {
"timestamp": {
"type": "long",
"copy_to": "datetime"
},
"datetime": {
"type": "date",
"store": true
},
"location": {
"type": "geo_point"
},
"battery":{
"type": "float"
},
"temperature":{
"type": "short"
},
"pressure":{
"type": "short"
},
"rpm":{
"type": "short"
}
}
}
}
}
' 'https://search-iot-lab-xxxxxxxxxxxxxxxxxxxxx.cn-north-1.es.amazonaws.com.cn/cars'
请把最下面一行的
https://search-iot-lab-xxxxxxxxxxxxxxxxxxxxx.cn-north-1.es.amazonaws.com.cn/cars
替换为您的集群的终端节点,在“iot-lab”的详细页面可以找到:
如果成功您将在终端收到状态“ {“acknowledged”:true)”。如果不成功,请检查Kibana能否进入。如果不能进入,请调整访问策略,比如使用xxx.xxx.xxx.xxx/16代替IP。
SELECT *, timestamp() as timestamp FROM 'connectedcar/#'
https://search-iot-lab-xxxxxxxxxxxxx.us-east-1.es.amazonaws.com/_plugin/kibana/