AWS Lambda - How to get the topic name of data coming from AWS IOT
I was looking for the same thing, there is a way to achieve that. While constructing your SQL you can use the topic() function to get the topic the message was sent to. That way you could put in the attribute section
*, topic() as topic
so your final SQL will look like:
SELECT *, topic() as topic FROM one/of/my/+/topics
your payload will then contain a new attribute topic that you can parse within your lambda function. More on this https://docs.aws.amazon.com/iot/latest/developerguide/iot-sql-functions.html