1
votes

I want to send individual data values to respective columns received from AWS IoT to AWS DynamoDB.

My Devices send this payload:

    {
    "state": {
    "desired": {
        "DeviceId" : "Device101",
        "DateTime" : now,
        "Room1 Temperature" : m_t,
        "Room2 Temperature": b_t
        },
    "reported": {
        "Item": {
            "DeviceId" : "Device101",
            "DateTime" : now,
            "Room1 Temperature" : m_t,
            "Room2 Temperature": b_t
            }
        }
    }
}

I am receiving this payload as a Shadow Update on my Shadow Link here :

$aws/things/shadow/update

I have created a Sample DynamoDB Table and linked it with AWS IoT Rule, so that whenever data is incoming into the above mentioned topic, it will be triggered by the SQL Query:

SELECT * FROM '$aws/things/shadow/update'

  • This Data is reflected in my Shadow Update
  • This Data is not forwarded to DynamoDB table
  • What is the problem?!

Any help would be appreciated. Thanks.

2

2 Answers

5
votes

Firstly, enabling Cloudwatch Logs should assist you in debugging this issue.

Generally these types of silent failures indicate you have not properly formatted your data for insertion into DynamoDB.

Things to check:

  • Your SELECT statement won't work, as it needs to pull in the content you want to insert. In your case, this would be either SELECT desired.* or SELECT reported.Item.*
  • The primary partition key must be one of the keys you pull in or your DynamoDB insert will fail. What is your primary partition key? Make sure you have that in your list of keys in your SELECT statement
  • Make sure your data type for the primary partition key matches the type you are passing in - for example if your primary partition key was DeviceId, it should be a string type (not, for example, an Integer)

CloudWatch logs will provide much more detailed information to assist you. See http://docs.aws.amazon.com/iot/latest/developerguide/cloud-watch-logs.html for information on how to do this.

You can also enable it from the IoT console by selecting Settings (the cog) from the left hand navigation, and updating settings under Logging.

0
votes

For me this post led me to a result that finally worked, after many hours of misleading information:

https://forums.aws.amazon.com/thread.jspa?messageID=931485