AWS IoT is an IoT platform provided by Amazon to connect devices in cloud. We can use the AWS IoT Python SDK to write Python script to access the AWS IoT platform through MQTT to interact with connected devices. The following are steps of installing the SDK.
Check if the current Python is version 3.
Python 3.5.2 ...
I prefer to use Python 3. If it is not, we can download the newest Python 3.5.2 from the website and install it.
Check the OpenSSL version used by the Python.
>>> import ssl
'OpenSSL 1.0.2h 3 May 2016'
Install the AWS IoT Python SDK from source that contains samples.
>git clone https://github.com/aws/aws-iot-device-sdk-python.git
>python setup.py install
Indeed, we can also install the SDK from pip, but it doesn't have samples.
>pip install AWSIoTPythonSDK
Run a sample
An error occurs.
This page has a workaround:
# Now the import statement should work
from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
Run the sample again.
>python basicPubSub.py -h