- Newest
- Most votes
- Most comments
You're absolutely right, directly passing the SNS Topic ARN through an IoT Core rule and using it in the SNS Topic field of an IoT Events action isn't supported .**
Maybe try this approach:**
1/ Instead of specifying the SNS topic directly in the detector model, introduce a dynamic variable (e.g., $topic) within the model itself. This variable will hold the SNS Topic ARN received from the IoT Core rule.
"sns": { "topicArn": "$topic", // Use the dynamic variable here "messagePayload": "Alert! Metric for device $device exceeded threshold: $metric" }
2/ Update your IoT Core rule to extract the relevant SNS Topic ARN and device ID from the incoming message. Use the sql expression language in the IoT Core rule to filter and extract the desired information. Include the extracted SNS Topic ARN and device ID within the message payload sent to IoT Events. "sql": "SELECT *, EXTRACT(topic_arn FROM message) AS topic, EXTRACT(device_id FROM message) AS device FROM 'your_topic'",
Please note I havn't tried it myself. Give it a try and share the feedback if it works.
Relevant content
- asked 3 years ago
- asked 5 years ago
- AWS OFFICIALUpdated 10 months ago
Thanks for your answer. But we discovered a case that use Lambda function (https://repost.aws/es/knowledge-center/sns-topic-lambda). This should work. Thanks again!