Skip to content
v2.273.0

Experimental

@aws-cdk/aws-iot-actions-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

SnsTopicActionProps Struct ​

Configuration options for the SNS topic action.

Example ​

ts
import * as sns from 'aws-cdk-lib/aws-sns';

const topic = new sns.Topic(this, 'MyTopic');

const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
  ),
  actions: [
    new actions.SnsTopicAction(topic, {
      messageFormat: actions.SnsActionMessageFormat.JSON, // optional property, default is SnsActionMessageFormat.RAW
    }),
  ],
});

Properties ​

messageFormatSnsActionMessageFormatmessage_formatSnsActionMessageFormatmessageFormatSnsActionMessageFormatMessageFormatSnsActionMessageFormatMessageFormatSnsActionMessageFormat= SnsActionMessageFormat.RAW#
The message format of the message to publish.

SNS uses this setting to determine if the payload should be parsed and relevant platform-specific bits of the payload should be extracted.

roleIRoleroleIRoleroleIRoleRoleIRoleRoleIRole= a new role will be created#
The IAM role that allows access to AWS service.

Used as props by ​