SnsTopicActionProps

class aws_cdk.aws_iot_actions.SnsTopicActionProps(*, role=None, message_format=None)

Bases: CommonActionProps

(experimental) Configuration options for the SNS topic action.

Parameters:
  • role (Optional[IRole]) – (experimental) The IAM role that allows access to AWS service. Default: a new role will be created

  • message_format (Optional[SnsActionMessageFormat]) – (experimental) 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. Default: SnsActionMessageFormat.RAW

Stability:

experimental

ExampleMetadata:

infused

Example:

import aws_cdk.aws_sns as sns


topic = sns.Topic(self, "MyTopic")

topic_rule = iot.TopicRule(self, "TopicRule",
    sql=iot.IotSql.from_string_as_ver20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"),
    actions=[
        actions.SnsTopicAction(topic,
            message_format=actions.SnsActionMessageFormat.JSON
        )
    ]
)

Attributes

message_format

(experimental) 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.

Default:

SnsActionMessageFormat.RAW

See:

https://docs.aws.amazon.com/sns/latest/dg/sns-message-and-json-formats.html

Stability:

experimental

role

(experimental) The IAM role that allows access to AWS service.

Default:

a new role will be created

Stability:

experimental