Experimental
@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
DynamoDBv2PutItemAction Class
The action to put the record from an MQTT message to the DynamoDB table.
Example
ts
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
declare const table: dynamodb.Table;
const topicRule = new iot.TopicRule(this, 'TopicRule', {
sql: iot.IotSql.fromStringAsVer20160323(
"SELECT * FROM 'device/+/data'",
),
actions: [
new actions.DynamoDBv2PutItemAction(table)
],
});
python
import aws_cdk.aws_dynamodb as dynamodb
# table: dynamodb.Table
topic_rule = iot.TopicRule(self, "TopicRule",
sql=iot.IotSql.from_string_as_ver20160323("SELECT * FROM 'device/+/data'"),
actions=[
actions.DynamoDBv2PutItemAction(table)
]
)
java
import software.amazon.awscdk.services.dynamodb.*;
Table table;
TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
.sql(IotSql.fromStringAsVer20160323("SELECT * FROM 'device/+/data'"))
.actions(List.of(
new DynamoDBv2PutItemAction(table)))
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.IoT.Actions.Alpha
using Amazon.CDK.AWS.DynamoDB;
Table table;
var topicRule = new TopicRule(this, "TopicRule", new TopicRuleProps {
Sql = IotSql.FromStringAsVer20160323("SELECT * FROM 'device/+/data'"),
Actions = new [] {
new DynamoDBv2PutItemAction(table) }
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2
import dynamodb "github.com/aws/aws-cdk-go/awscdk"
var table Table
topicRule := iot.NewTopicRule(this, jsii.String("TopicRule"), &TopicRuleProps{
Sql: iot.IotSql_FromStringAsVer20160323(jsii.String("SELECT * FROM 'device/+/data'")),
Actions: []IAction{
actions.NewDynamoDBv2PutItemAction(table),
},
})
Initializer
ts
new DynamoDBv2PutItemAction(table: ITable, props?: DynamoDBv2PutItemActionProps)
python
DynamoDBv2PutItemAction(table: ITable, props: typing.Optional[DynamoDBv2PutItemActionProps] = None)
java
new DynamoDBv2PutItemAction(ITable table, DynamoDBv2PutItemActionProps props)
csharp
new DynamoDBv2PutItemAction(ITable table, DynamoDBv2PutItemActionProps? props = null)
go
NewDynamoDBv2PutItemAction(Table ITable, Props DynamoDBv2PutItemActionProps)