Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering Lambda when a device Shadow updates

I've set up a rule

SELECT * FROM '$aws/things/+/shadow/update/accepted'

This rule triggers my lambda function when the shadow of any thing in my AWS IoT updates.

Instead I want it to get triggered only when the shadows of some things are updated, not all of them. Any way I can do that?


1 Answers

I recently learned that you can use functions to filter on parts of the topic, and something like this could potentially work for you:

SELECT *
FROM '$aws/things/+/shadow/update/accepted'
WHERE startswith(topic(3), 'someprefix-')

This would only trigger the action(s) when the part of the topic captured by the + started with "someprefix-". You can use other functions to filter in other ways if a prefix does not work for you.

like image 143
Theo Avatar answered Dec 24 '25 07:12

Theo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!