Developer Guide

SNS Action

A sns action sends the data from the MQTT message that triggered the rule as an SNS push notification. When creating a rule with an sns action, you must specify the following information:


The message format. Accepted values are "JSON" and "RAW." The default value of the attribute is "RAW." SNS uses this setting to determine if the payload should be parsed and relevant platform-specific parts of the payload should be extracted.


The IAM role that allows access to SNS.


The SNS topic or individual device to which the push notification is sent.


Make sure the policy associated with the rule has the sns:Publish permission.

The following JSON example shows how to define an sns action in an AWS IoT rule:

{ "rule": { "sql": "SELECT * FROM 'some/topic'", "ruleDisabled": false, "actions": [{ "sns": { "targetArn": "arn:aws:sns:us-east-2:123456789012:my_sns_topic", "roleArn": "arn:aws:iam::123456789012:role/aws_iot_sns" } }] } }

For more information, see the Amazon SNS Developer Guide.