Wednesday, September 07, 2022

AWSIoTPythonSDK.exception.AWSIoTExceptions.connectTimeoutException

Are you getting the below error when sening data to IoT Core using the "AWSIoTPythonSDK." ?


Here is my error :


  File "/usr/local/lib/python3.6/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 520, in connect
    return self._mqtt_core.connect(keepAliveIntervalSecond)
  File "/usr/local/lib/python3.6/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 199, in connect
    raise connectTimeoutException()
AWSIoTPythonSDK.exception.AWSIoTExceptions.connectTimeoutException


The below can be reason for  this issue


1- You have not defined policy to allow the sending message to the IoT Core topic. If that is the case create a policy for the "Thing"


You need to define

  Publish/Subscribe policy 

Connect and Publish Policy

 

If the policies are defined than check the active version of policy, In my case old policy was active

 

2- Make the latest one active  

 Check this  under your "Thing" policy settings:

 


 

 Hopefully one of it works. Leave comment if it does help

Thanks



 



Handle the error “OwnershipControlsNotFoundError” for buckets created prior to April 2023 when the bucket ownership was defaulted to “Object Writer”

Here you go published a  python code sample written for migrating S3 bucket ownership controls between AWS accounts. The code is written to ...