aws-cdk-lib.aws_iot.CfnTopicRule.DynamoDBActionProperty

interface DynamoDBActionProperty

LanguageType name
.NETAmazon.CDK.AWS.IoT.CfnTopicRule.DynamoDBActionProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsiot#CfnTopicRule_DynamoDBActionProperty
Javasoftware.amazon.awscdk.services.iot.CfnTopicRule.DynamoDBActionProperty
Pythonaws_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

NameTypeDescription
hashKeyFieldstringThe hash key name.
hashKeyValuestringThe hash key value.
roleArnstringThe ARN of the IAM role that grants access to the DynamoDB table.
tableNamestringThe name of the DynamoDB table.
hashKeyType?stringThe hash key type.
payloadField?stringThe action payload.
rangeKeyField?stringThe range key name.
rangeKeyType?stringThe range key type.
rangeKeyValue?stringThe 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.