Set up IOT with MQTT?



I've read that the recommended way to use IOT services is via MQTT topics, and I'd like to do that, but I'm unsure how. Is there some MQTT topic already created that is associated with my IOT instance? Or, do I need to create the topic myself and link it to my IOT instance? If the latter, how is this done?


3 Answers

So if I decide I want to have a topic called "temperature", I just post to that topic? I don't have to pre-configure it anywhere?

answered 9 months ago
  • Correct. You can create a topic like so /myThing/Temperature and then you can publish to it. Or have a thing subscribe to it.

  • Thanks. Can there be a topic like /Temperature that multiple things can post to? Also, is there a way I can see a list of topics that have messages?

  • Posting to a topic is dictated by the IoT Policy attached to the certificate for the device. If the policy allows publishing to a single topic, then yes - you should be able to publish from multiple places to the same topic.

    I am not aware of a way to see all topics that have messages. I will look into that.


Topics are ephemeral resources in your IoT Core account. Your devices publish and subscribe to topics at runtime, so long as they have the permission to do so through their policy. If you are brand new to AWS IoT Core, you may find useful the first few lessons in this Skill Builder series:

answered 9 months ago

There are some reserved topics that you can access depending on the services you're using. A common one is the Shadow service where the updates to a device shadow are published.

Other than that, you can follow this guide on how to design your topics and can subscribe or publish to them.

As an example, when you create a Thing in the device registry, you can download a starter kit. It shows you a python example on how a client can subscribe to a topic. Here's a relevant example from the SDK repository

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions