An AWS IoT setup from scratch with Cloudformation.
This should only be run once!
# Create the base API setup
$ bash ./bin/create-stack.sh --template base
# Create new iot groups
$ bash ./bin/create-stack.sh --template iam-groups
# Create new iot users
$ bash ./bin/create-stack.sh --template iam-users
After every change you can run this command to update the stack.
# Update the base API setup
$ bash ./bin/create-stack.sh --template base --update-stack
# Update iot groups
$ bash ./bin/create-stack.sh --template iam-groups
# Update iot users
$ bash ./bin/create-stack.sh --template iam-users
Make sure index is deleted.
$ export CF_IOT_ES_DOMAIN_URL=$(aws cloudformation describe-stacks --stack-name iot-rules --profile ffe | jq '.Stacks[].Outputs[] | { OutputKey: "iotElasticsearchURL", OutputValue: .OutputValue }' | jq -r '.OutputValue')
$ curl -XDELETE "${CF_IOT_ES_DOMAIN_URL}/iot-nodemcu"
Create new index with mappings.
$ curl -i -X PUT -d '{
"mappings": {
"sensor-data": {
"properties": {
"timestamp": {
"type": "long",
"copy_to": "datetime"
},
"datetime": {
"type": "date",
"store": true
},
"location": {
"type": "geo_point"
}
}
}
}
}' "${CF_IOT_ES_DOMAIN_URL}/iot-nodemcu"