The sample basicPubSub.py in AWS IoT Python SDK can help us do it.
We follow AWS IoT tutorial to create a device certificate. We download the device certificate, its root CA, and its private key in our local path where the sample exists.
We also create a policy, and a device. We attach both resources into the device certificate.
Because the command arguments of the sample are too long, I prefer to write a makefile Test.mk to test it.
E1 = a2uc??????????.iot.us-west-2.amazonaws.com
R1 = VeriSign-Class\ 3-Public-Primary-Certification-Authority-G5.pem
C1 = 5988??????-certificate.pem.crt
K1 = 5988??????-private.pem.key
dev1:
python3 basicPubSub.py -e $(E1) -r $(R1) -c $(C1) -k $(K1)
Run the sample.
>make -f Test.mk dev1
It will publish messages and receive subscribed messages in loop.

-Count
No comments:
Post a Comment