class SnsTopicAction
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.IoT.Actions.SnsTopicAction |
![]() | software.amazon.awscdk.services.iot.actions.SnsTopicAction |
![]() | aws_cdk.aws_iot_actions.SnsTopicAction |
![]() | @aws-cdk/aws-iot-actions » 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/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
Methods
Name | Description |
---|---|
bind(rule) | Returns the topic rule action specification. |
bind(rule)
public bind(rule: ITopicRule): ActionConfig
Parameters
- rule
ITopic
Rule
Returns
Returns the topic rule action specification.