2
votes

Apologies if this is a noob. I am trying to learn the ropes of AWS IOT.

I understand that I can use a client like MQTT.fx to publish messages to a topic in a message broker

I also see that AWS IOT resources console, I can create things, attach certificates, policies, and create rules.

If I create a thing say 'car' using the IOT resources console, is there some way that the console gives where i can have the car publish MQTT messages to a topic? Or is the only way wiring up the simulate car to an actual device using the SDK.

Like I mentioned, I am aware of publishing through an MQTT client. I just want to understand how to make a 'thing' I created in the resources console, to publish the MQTT messages to a message broker?

Thanks

1

1 Answers

0
votes

I think you are looking for information how to obtain endpoint that will handle subscribe and publish messages. This is described in Verify MQTT Subscribe and Publish section of Developers Guide. Using AWS CLI:

aws iot describe-endpoint

It will return something like that:

{
    "endpointAddress": "ABCDEF12345678.iot.eu-west-1.amazonaws.com"
}

Your thing should use one of existing AWS IoT SDKs to subscribe to MQTT topic and start publishing some data ie. speed, fuel consumption, etc.

In general you can simulate your thing (ie. car) by subscribing to some topic:

mosquitto_sub --cafile "path-to-cert\rootCA.pem" --cert "path-to-cert\cert.pem" \
--key "path-to-cert\privateKey.pem" \
-h "ABCDEF12345678.iot.eu-west-1.amazonaws.com" -p 8883 -q 1 -d -t "topic/test" \
-i "car1"

Then in other terminal you can publish:

mosquitto_pub --cafile rootCA.pem --cert certs\cert.pem --key privateKey.pem \
-h "ABCDEF12345678.iot.eu-west-1.amazonaws.com" -p 8883 -q 1 -d -t topic/test 
-i car2 -m "Hello, World"