0
votes

I have successfully hooked my RaspberryPi up to AWS IoT Core and am able to publish/subscribe to the "sdk/test/Python" topic without any problem. However whenever I change the topic to a custom value, I get either a "subscribeTimeoutException()" or a "publishTimeoutException()".

I've run the command:

python aws-iot-device-sdk-python/samples/basicPubSub.py -e xxxxxxxxx-xxx.iot.us-west-2.amazonaws.com -r root-CA.crt -c RaspberryPi.cert.pem -k RaspberryPi.private.key

However, when I attempt to manually select the topic with the following command, I get the aforementioned errors.

python aws-iot-device-sdk-python/samples/basicPubSub.py -e xxxxxxxxx-xxx.iot.us-west-2.amazonaws.com -r root-CA.crt -c RaspberryPi.cert.pem -k RaspberryPi.private.key -t testTopic

Another attempt I tried was to manually change the "default" value on line 46, I also get the same exceptions.

Inside of the AWS IoT console, I'm able to publish/subscribe to "testTopic", which leads me to believe I may be missing a permission perhaps?

The code is a direct copy of: https://github.com/aws/aws-iot-device-sdk-python/blob/master/samples/basicPubSub/basicPubSub.py

All I'd like to do is to have the ability to manually set my topic names. Does anyone have any insights into this problem?

2

2 Answers

0
votes

try:

test/testTopic

hopefully adding an arbitrary hierarchy to a Single topic subscription will be enough

0
votes

After hours of digging I found that you cannot make arbitrary topic names with the default permissions. Ensure that the policy you have attached to your certificate that is attached to your device grants access to your desired topic names. In this case, the default policy allows you to publish/subscribe to topics "sdk/test/Python", "sdk/test/java", "topic_1", and "topic_2".

If you wish to have arbitrary "on demand" topic names, to each permission in the policy add the wildcard e.g:

"arn:aws:iot:us-west-2:000000000000:<topic/topicfilter/client/etc...>/*"

Located under resources. Also note, have your certificate active in the AWS IoT console to avoid SSLError.