Developer Guide

DynamoDBv2 Action

The dynamoDBv2 action allows you to write all or part of an MQTT message to a DynamoDB table. Each attribute in the payload is written to a separate column in the DynamoDB database. When creating a DynamoDB rule, you must specify the following information:


The IAM role that allows access to the DynamoDB table. At a minimum, the role must allow the dynamoDB:PutItem IAM action.


The name of the DynamoDB table.


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.

The data written to the DynamoDB table is the result from the SQL statement of the rule.


Ensure the role associated with the rule has a policy granting the dynamodb:PutItem permission.

The following JSON example shows how to define a dynamoDB action in an AWS IoT rule:

{ "rule": { "ruleDisabled": false, "sql": "SELECT * AS message FROM 'some/topic'", "description": "A test DynamoDBv2 rule", "actions": [{ "dynamoDBv2": { "roleArn": "arn:aws:iam::123456789012:role/aws_iot_dynamoDBv2", "putItem": { "tableName": "my_ddb_table" } } }] } }

For more information, see the Amazon DynamoDB Getting Started Guide.