Error connection when I try to connect AWS IoT to Losant

Good Morning,

I followed this tutorial (https://www.losant.com/blog/getting-started-with-aws-iot-and-losant) to integrate AWS IoT on Losant and I have a message stating that AWS is disconnected.

Here’s the error (Disconnected since …):

I double checked that the certificates were correct, I re-read the documentation to make sure that what I’ve made was correct, and I checked on losant’s forum to see if anybody was having the same problem as me, but to no avail.

Best regards

A good way to debug is to connect to AWS locally using the Mosquitto CLI tools. These accept the same information as Losant’s integration.

mosquitto_pub and mosquitto_sub

Here’s some example commands for AWS I found from this Github repo.

The Mosquitto Pub CLI
$ mosquitto_pub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/thing' -m "Hello from Mosquitto"

The Mosquitto Sub CLI
$ mosquitto_sub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/+'

There’s a fair amount of online resources available around connecting these tools to AWS as well to help debug. For example, here’s a Stack Overflow article I found that also shows example usage.