Set up IOT with MQTT?

0

Hi,

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?

Thanks.

Frank
已提问 2 年前227 查看次数
3 回答
1

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?

Frank
已回答 2 年前
  • 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.

1

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: https://explore.skillbuilder.aws/learn/public/learning_plan/view/86/iot-learning-plan

AWS
Ryan_B
已回答 2 年前
0

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

AWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则