class SnsTopicAction
| Language | Type name | 
|---|---|
  .NET | Amazon.CDK.AWS.IoT.Actions.Alpha.SnsTopicAction | 
  Go | github.com/aws/aws-cdk-go/awscdkiotactionsalpha/v2#SnsTopicAction | 
  Java | software.amazon.awscdk.services.iot.actions.alpha.SnsTopicAction | 
  Python | aws_cdk.aws_iot_actions_alpha.SnsTopicAction | 
  TypeScript (source) | @aws-cdk/aws-iot-actions-alpha » SnsTopicAction | 
Implements
IAction
The action to write the data from an MQTT message to an Amazon SNS topic.
See also: https://docs.aws.amazon.com/iot/latest/developerguide/sns-rule-action.html
Example
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
    }),
  ],
});
Initializer
new SnsTopicAction(topic: ITopic, props?: SnsTopicActionProps)
Parameters
- topic 
ITopic— The Amazon SNS topic to publish data on. - props 
Sns— Properties to configure the action.Topic Action Props  

 .NET
 Go
 Java
 Python
 TypeScript (