Mark Wilson
Mark Wilson

Reputation: 31

How does one obtain the client's IP address in an AWS Lambda when the data comes from an IoT Core Rule?

We want to track the ip of the sender for some MQTT topics.

I see in the Lambda event body or context that the data does not appear available.

Is there an option to enable that I am missing or a work around to get the calling ip at the same time the message is being processed in the Lambda?

Upvotes: 1

Views: 923

Answers (1)

Aarth Tandel
Aarth Tandel

Reputation: 1009

In MQTT using AWS I don't think there is a provision to get the IP of the user

The message broker does not support persistent sessions (connections made with the cleanSession flag set to false. The AWS IoT message broker assumes all sessions are clean sessions and messages are not stored across sessions. If an MQTT client attempts to connect to the AWS IoT message broker with the cleanSession set to false, the client will be disconnected.

You can get more details on this AWS Docs. Also, if they are providing the IP the end user might get exposed.

Upvotes: 2

Related Questions