- Newest
- Most votes
- Most comments
Hello,
Thank you for connecting and sharing your use case.
The IoT Device Defender custom metrics are generally emitted by the Device defender agent which is running on the device. Ideally, you can emit the custom metric from the Lambda function, if you can ingest the data from the device to the Lambda environment and manage to implement a version of the SDK [1]. You should be able to emit the required custom metric for your use case.
The specific error that you are seeing is likely due to attempting to publish on a restricted topic which doesn't support publish-in from the Lambda environment or rather any clients.
Please feel free to explore the agent SDK and share if that fits your use case.
[1] https://github.com/aws-samples/aws-iot-device-defender-agent-sdk-python
The device defender topics only support MQTT publish so you will need to have your Lambda function connect over MQTT to publish those metrics to the device defender reserved topics.
This means that you will still incur the MQTT message cost from Lambda so whether you publish it from the device or Lambda, the cost may not change.
See below excerpts from - https://docs.aws.amazon.com/iot/latest/developerguide/reserved-topics.html#reserved-topics-device-defender
“These messages support response buffers in Concise Binary Object Representation (CBOR) format and JavaScript Object Notation (JSON), depending on the payload-format of the topic. AWS IoT Device Defender topics only support MQTT publish.”
Relevant content
- asked 4 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 20 days ago
Thank you both for your response. I'll go ahead and give the lambda based MQTT publish a try.
One outstanding question I have related to Device Defender is if it is actually the right tool for the job. I am trying to set up a way to ingest runtime metrics (things like power state (battery or wall power), network connectivity status (what interface is connected), system uptime) and be able to:
Device Defender actually covers all of these uses cases for me in the exploration I've done on it so far...but all of the documentation implies the real use case for Device Defender is to detect security anomalies which isn't the use case I'm interested in. I'm wondering if AWS provides any other tooling for general fleet monitoring/metric collection and alerting that isn't security specific OR is Device Defender a good tool for the uses cases I have outlined above?