aws-samples / aws-iot-events-accelerators

MIT No Attribution
1 stars 3 forks source link

mqttc.connect() failed #1

Open racheliurui opened 4 years ago

racheliurui commented 4 years ago

In summary, 2 places need to be modified to make the sample work, 1) the MQTT endpoint should be the thing's endpoint, not just static region name. 2) the rootCA.pem should curl from the official website, not using the hard coded one from the cert folder.

============ I am trying to run through the sample, I haven changed region to us-east-1

1) certificate for the thing has been created and copied to certs folder under docker before run docker command 2) after cfn creation I can see the thing is created successfully with full access to publish message. 3) no firewall for outbound 8883 from the mac

nc -v data.iot.us-east-1.amazonaws.com 8883
found 0 associations
found 1 connections:
     1: flags=82<CONNECTED,PREFERRED>
    outif utun1
    src 10.85.2.118 port 49532
    dst 34.198.167.56 port 8883
    rank info not available
    TCP aux info available

Connection to data.iot.us-east-1.amazonaws.com port 8883 [tcp/*] succeeded!

The Cloudside configuration all works for me, but the client simulation docker image gave me exception as below,

Creating network "docker_default" with the default driver
Building iml-iotevents
Step 1/4 : FROM python:2.7
2.7: Pulling from library/python
16ea0e8c8879: Pull complete
50024b0106d5: Pull complete
ff95660c6937: Pull complete
9c7d0e5c0bc2: Pull complete
29c4fb388fdf: Pull complete
02ced85d1576: Pull complete
c6a05aec329f: Pull complete
a12780a25ba8: Pull complete
19d4c19e02fb: Pull complete
Digest: sha256:c99e3995896e491d65941dd380bffb98219be7ac77dce85a701258034a9d3207
Status: Downloaded newer image for python:2.7
 ---> ecbb8b5ea744
Step 2/4 : ADD . /
 ---> 8498d8fb9bd4
Step 3/4 : WORKDIR /
 ---> Running in 6dff63d454c7
Removing intermediate container 6dff63d454c7
 ---> 04625fa7ea0c
Step 4/4 : CMD [“/bin/bash”]
 ---> Running in 58b490a02ed3
Removing intermediate container 58b490a02ed3
 ---> 0b49a9db7a07

Successfully built 0b49a9db7a07
Successfully tagged x86_64/aws-iotevents-iml-simulatedmotor:latest
Creating aws-iotevents-iml-simulatedmotor ... done
Attaching to aws-iotevents-iml-simulatedmotor
aws-iotevents-iml-simulatedmotor | 
aws-iotevents-iml-simulatedmotor | Installing AWS SDK...
aws-iotevents-iml-simulatedmotor | Cloning into 'aws-iot-device-sdk-python'...
aws-iotevents-iml-simulatedmotor | /aws-iot-device-sdk-python /
aws-iotevents-iml-simulatedmotor | running install
aws-iotevents-iml-simulatedmotor | running build
aws-iotevents-iml-simulatedmotor | running build_py
aws-iotevents-iml-simulatedmotor | creating build
aws-iotevents-iml-simulatedmotor | creating build/lib
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/__init__.py -> build/lib/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/MQTTLib.py -> build/lib/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/__init__.py -> build/lib/AWSIoTPythonSDK/core
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/util/__init__.py -> build/lib/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/util/providers.py -> build/lib/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/util/enums.py -> build/lib/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/shadow/__init__.py -> build/lib/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/shadow/deviceShadow.py -> build/lib/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/shadow/shadowManager.py -> build/lib/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/__init__.py -> build/lib/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/mqtt_core.py -> build/lib/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/jobs/__init__.py -> build/lib/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/jobs/thingJobManager.py -> build/lib/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/paho/__init__.py -> build/lib/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/paho/client.py -> build/lib/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/queues.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/__init__.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/defaults.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/workers.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/events.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/requests.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/internal/clients.py -> build/lib/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/connection/__init__.py -> build/lib/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/connection/cores.py -> build/lib/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/protocol/connection/alpn.py -> build/lib/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/greengrass
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/greengrass/__init__.py -> build/lib/AWSIoTPythonSDK/core/greengrass
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/greengrass/discovery/__init__.py -> build/lib/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/greengrass/discovery/models.py -> build/lib/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/core/greengrass/discovery/providers.py -> build/lib/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | creating build/lib/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/exception/operationError.py -> build/lib/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/exception/__init__.py -> build/lib/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/exception/AWSIoTExceptions.py -> build/lib/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying AWSIoTPythonSDK/exception/operationTimeoutException.py -> build/lib/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | running install_lib
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/mqtt_core.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/paho/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/paho/client.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/connection/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/connection/cores.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/connection/alpn.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/queues.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/defaults.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/workers.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/events.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/requests.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/protocol/internal/clients.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/jobs/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/jobs/thingJobManager.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/jobs
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/util/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/util/providers.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/util/enums.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/shadow/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/shadow/deviceShadow.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/shadow/shadowManager.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/greengrass/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/greengrass/discovery/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/greengrass/discovery/models.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/core/greengrass/discovery/providers.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery
aws-iotevents-iml-simulatedmotor | creating /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/exception/operationError.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/exception/__init__.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/exception/AWSIoTExceptions.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/exception/operationTimeoutException.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception
aws-iotevents-iml-simulatedmotor | copying build/lib/AWSIoTPythonSDK/MQTTLib.py -> /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py to mqtt_core.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py to client.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection/cores.py to cores.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/connection/alpn.py to alpn.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/queues.py to queues.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/defaults.py to defaults.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/workers.py to workers.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/events.py to events.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/requests.py to requests.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/internal/clients.py to clients.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/jobs/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/jobs/thingJobManager.py to thingJobManager.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util/providers.py to providers.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/util/enums.py to enums.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow/deviceShadow.py to deviceShadow.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/shadow/shadowManager.py to shadowManager.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery/models.py to models.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/greengrass/discovery/providers.py to providers.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception/operationError.py to operationError.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception/__init__.py to __init__.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception/AWSIoTExceptions.py to AWSIoTExceptions.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/exception/operationTimeoutException.py to operationTimeoutException.pyc
aws-iotevents-iml-simulatedmotor | byte-compiling /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py to MQTTLib.pyc
aws-iotevents-iml-simulatedmotor | running install_egg_info
aws-iotevents-iml-simulatedmotor | Writing /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK-1.4.8-py2.7.egg-info
aws-iotevents-iml-simulatedmotor | /
aws-iotevents-iml-simulatedmotor | 
aws-iotevents-iml-simulatedmotor | Running Simulated Device...
aws-iotevents-iml-simulatedmotor | Endpoint :data.iot.us-east-1.amazonaws.com
aws-iotevents-iml-simulatedmotor | 
aws-iotevents-iml-simulatedmotor | Traceback (most recent call last):
aws-iotevents-iml-simulatedmotor |   File "simulated_motor.py", line 61, in <module>
aws-iotevents-iml-simulatedmotor |     mqttc.connect()
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 513, in connect
aws-iotevents-iml-simulatedmotor |     return self._mqtt_core.connect(keepAliveIntervalSecond)
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 196, in connect
aws-iotevents-iml-simulatedmotor |     self.connect_async(keep_alive_sec, self._create_blocking_ack_callback(event))
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 223, in connect_async
aws-iotevents-iml-simulatedmotor |     raise e
aws-iotevents-iml-simulatedmotor | socket.gaierror: [Errno -2] Name or service not known
aws-iotevents-iml-simulatedmotor exited with code 1
racheliurui commented 4 years ago

Just found the issue with setting the endpoint, modified the https://github.com/aws-samples/aws-iot-events-accelerators/blob/2905825720d9dd252d8d1878f5b363a60b87d054/integratingmachinelearning/docker/simulated_motor.py#L27

The endpoint here should be the thing's endpoint not static data.iot.[region].amazon.aws.com. For me it's something like

xxxxxxxxx-ats.iot.us-east-1.amazonaws.com

But after that, still I get SSL certificate error,

aws-iotevents-iml-simulatedmotor | Endpoint :a2rizlo4ii9h59-ats.iot.us-east-1.amazonaws.com
aws-iotevents-iml-simulatedmotor |     mqttc.connect()
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/MQTTLib.py", line 513, in connect
aws-iotevents-iml-simulatedmotor |     return self._mqtt_core.connect(keepAliveIntervalSecond)
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 196, in connect
aws-iotevents-iml-simulatedmotor |     self.connect_async(keep_alive_sec, self._create_blocking_ack_callback(event))
aws-iotevents-iml-simulatedmotor |   File "/usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/mqtt_core.py", line 223, in connect_async
aws-iotevents-iml-simulatedmotor |     raise e
aws-iotevents-iml-simulatedmotor | ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)
racheliurui commented 4 years ago

OK, SSL issue also found the reason, the root CA should be

https://www.amazontrust.com/repository/AmazonRootCA1.pem

Please instead of providing the rootCA.pem under certs, use curl to get the it.

Now it all works.

aws-iotevents-iml-simulatedmotor | Message Published {"motorID": "AWS98765", "TT10": 57, "PTO1": 21, "FTO1": 172, "TT08": 82, "TT09": 68, "TT04": 27, "TT05": 55, "TT06": 52, "TT07": 79, "TT01": 5, "TT02": 65, "TT03": 83, "motorType": "Pump_GN12345"}
aws-iotevents-iml-simulatedmotor | Message Published {"motorID": "AWS98765", "TT10": 39, "PTO1": 30, "FTO1": 161, "TT08": 34, "TT09": 27, "TT04": 28, "TT05": 59, "TT06": 99, "TT07": 65, "TT01": 6, "TT02": 66, "TT03": 79, "motorType": "Pump_GN12345"}
aws-iotevents-iml-simulatedmotor | Message Published {"motorID": "AWS98765", "TT10": 31, "PTO1": 26, "FTO1": 202, "TT08": 51, "TT09": 61, "TT04": 86, "TT05": 61, "TT06": 71, "TT07": 45, "TT01": 7, "TT02": 77, "TT03": 78, "motorType": "Pump_GN12345"}
aws-iotevents-iml-simulatedmotor | Message Published {"motorID": "AWS98765", "TT10": 33, "PTO1": 31, "FTO1": 234, "TT08": 72, "TT09": 67, "TT04": 51, "TT05": 82, "TT06": 73, "TT07": 66, "TT01": 6, "TT02": 61, "TT03": 20, "motorType": "Pump_GN12345"}
aws-iotevents-iml-simulatedmotor | Message Published {"motorID": "AWS98765", "TT10": 78, "PTO1": 28, "FTO1": 186, "TT08": 21, "TT09": 21, "TT04": 44, "TT05": 99, "TT06": 20, "TT07": 83, "TT01": 12, "TT02": 53, "TT03": 42, "motorType": "Pump_GN12345"}