interface DynamoDBActionProperty
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.IoT.CfnTopicRule.DynamoDBActionProperty |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsiot#CfnTopicRule_DynamoDBActionProperty |
Java | software.amazon.awscdk.services.iot.CfnTopicRule.DynamoDBActionProperty |
Python | aws_cdk.aws_iot.CfnTopicRule.DynamoDBActionProperty |
TypeScript | aws-cdk-lib » aws_iot » CfnTopicRule » DynamoDBActionProperty |
Describes an action to write to a DynamoDB table.
The tableName
, hashKeyField
, and rangeKeyField
values must match the values used when you created the table.
The hashKeyValue
and rangeKeyvalue
fields use a substitution template syntax. These templates provide data at runtime. The syntax is as follows: ${ sql-expression }.
You can specify any valid expression in a WHERE or SELECT clause, including JSON properties, comparisons, calculations, and functions. For example, the following field uses the third level of the topic:
"hashKeyValue": "${topic(3)}"
The following field uses the timestamp:
"rangeKeyValue": "${timestamp()}"
For more information, see DynamoDBv2 Action in the AWS IoT Developer Guide .
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_iot as iot } from 'aws-cdk-lib';
const dynamoDBActionProperty: iot.CfnTopicRule.DynamoDBActionProperty = {
hashKeyField: 'hashKeyField',
hashKeyValue: 'hashKeyValue',
roleArn: 'roleArn',
tableName: 'tableName',
// the properties below are optional
hashKeyType: 'hashKeyType',
payloadField: 'payloadField',
rangeKeyField: 'rangeKeyField',
rangeKeyType: 'rangeKeyType',
rangeKeyValue: 'rangeKeyValue',
};
Properties
Name | Type | Description |
---|---|---|
hash | string | The hash key name. |
hash | string | The hash key value. |
role | string | The ARN of the IAM role that grants access to the DynamoDB table. |
table | string | The name of the DynamoDB table. |
hash | string | The hash key type. |
payload | string | The action payload. |
range | string | The range key name. |
range | string | The range key type. |
range | string | The range key value. |
hashKeyField
Type:
string
The hash key name.
hashKeyValue
Type:
string
The hash key value.
roleArn
Type:
string
The ARN of the IAM role that grants access to the DynamoDB table.
tableName
Type:
string
The name of the DynamoDB table.
hashKeyType?
Type:
string
(optional)
The hash key type.
Valid values are "STRING" or "NUMBER"
payloadField?
Type:
string
(optional)
The action payload.
This name can be customized.
rangeKeyField?
Type:
string
(optional)
The range key name.
rangeKeyType?
Type:
string
(optional)
The range key type.
Valid values are "STRING" or "NUMBER"
rangeKeyValue?
Type:
string
(optional)
The range key value.