Using Python to Communicate with AWS IoT Core

   Go back to the Task List

  « 5. Device to IoT Communication    7. Clean up »

6. IoT to Device Communication

You tested device to the AWS IoT core communication in the previous task. In this task, you do the opposite.

  1. You use subscribe.py code to create topic subscription for the device. Goto AWS Cloud9 environment dojoenvironment, run the command python subscribe.py in the environment bash console to execute subscribe.py file.

    Inbound

  2. The device has subscribed to the general/outbound topic and is now waiting for the message. Please keep it running like that.

    Inbound

  3. Go back to AWS IoT subscriptions page, click on the Publish to a topic link.

    Inbound

  4. On the next screen, enter the topic as general/outbound and change the message (if you want) to be sent. Click on the Publish a topic button. The message is published.

    Inbound

  5. Go back to AWS Cloud9 environment dojoenvironment and you can see the message received from the AWS IoT core.

    Inbound

  6. It was an example to see IoT core to device communication. With both way communication, the workshop is over. Kindly goto the next task to clean-up the resources for the workshop so that you don’t incur cost post the workshop.