0

I am being sent a payload from a sensor to a dynamo db table. It has 3 attributes DeviceId (hash key: type string, timestamp (Sort Key: Type String) and payload (type: map). The map has about 10 separate elements. How would I store these elements as separate attributes (columns) in the table. I thought this was what the dynamodbv2 action was suppose to allow (through AWS IOT) but I haven't been able to get it to work. The AWS documentation for this action states "The MQTT message payload must contain a root-level key that matches the table's primary partition key and a root-level key that matches the table's primary sort key, if one is defined." I am unsure of what this means as I am very new to dynambo db and AWS IOT. If someone is able to help explain to achieve what i want it'd be greatly appreciated.

Community
  • 1
  • 1
Connar
  • 21
  • 2
  • Can you show the dynamodb rule configuration? You should have some rule defined like this http://docs.aws.amazon.com/iot/latest/developerguide/dynamodb-rule.html – notionquest Apr 24 '17 at 11:05
  • { "rule": { "ruleDisabled": false, "sql": "SELECT * FROM 'sensor_table'", "description": "A test DynamoDBv2 rule", "actions": [{ "dynamoDBv2": { "roleArn": "arn:aws:iam::123456789012:role/aws_iot_dynamoDBv2", "putItem": { "tableName": "sensor_table" } } }] } } – Connar Apr 25 '17 at 03:35
  • It would look something like that ^. I am not using the AWS CLI though and the rule/action i'm using is dynamodbV2. After I create the rule it says successfully enabled however my payload is still being stored as a map type rather than having individual columns/attributes for every element within that map. – Connar Apr 25 '17 at 03:39
  • How are you publishing the message to the topic? What topic filter are you using? The message published should be picked by correct topic filter. Otherwise, it wouldn't work. Refer http://docs.aws.amazon.com/iot/latest/developerguide/iot-ddb-rule.html – notionquest Apr 26 '17 at 21:20

0 Answers0