简体   繁体   中英

I am trying to connect AWS IoT to my Arduino UNO, but there is some connection issue i am facing

I am using this command

C:\Users\*******\aws-iot-device-sdk-python-v2\samples>py pubsub.py --topic topic_1 --ca_file "C:\Users\HP*************\AmazonRootCA1.pem" --cert "C:\Users\***********certificate.pem.crt" --key "C:\Users*************private.pem.key" --endpoint ********p-south-1.amazonaws.com
Connecting to ********ap-south-1.amazonaws.com with client ID 'test-2b05cc3d-70e6-4a15-8798-6057fbffaa13'...
Connected!
Subscribing to topic 'topic_1'...
Connection interrupted. error: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly.
Connection resumed. return_code: 0 session_present: True
Connection interrupted. error: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly.

while connecting it will again and again trying to connect and executing infinitly. what do do for this?

I had this same issue with my raspberry pi. Turns out the problem had to do with the policies not allowing the topics. I was successfully able to pubsub using the test topic sdk/test/python but any other topic would fail.

I eventually came to this page and it answered my problem by showing me where to look: here

Once I modified the policy attached to my "thing" I was able to publish any topic I desired.

Here is where you can manage your policies inside of AWS IoT Core Under Manage -> Security -> Policies

I hope that helps. If you need help modifying the policy let me know I'll show you what I did to mine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM