前提
AWS IoT Twinmakerのハンズオンがうまく動きません。
AWS IoT Twinmakerのハンズオンにて、仮想のデバイスからのセンシングデータに相当するダミーデータをAWS Timestreamへ取り込む機能を実装したいのですが、SDKのバージョンが異なり困っております。わかる方がいらっしゃいましたらご教授いただければ幸いです。
以下ハンズオンのURLです
https://catalog.us-east-1.prod.workshops.aws/workshops/f3e15719-fcf0-4f2c-8105-4fae1aedba33/ja-JP
実現したいこと
・aws-iot-device-sdk-python-v2のSDKにて、ダミーデータを流す実装を実現したい
発生している問題・エラーメッセージ
上記ハンズオンに1から取り組み、手順「3.データの取り込み」の「Amazon Timestream へのデータの取り込み」にて指示されている"/aws-iot-device-sdk-python/samples/basicPubSub/basicPubSub.py"
のソースコード編集を、SDKのバージョンが異なるため行わずに手順を進め、
その後手順に従いIoTポリシーを変更し、スクリプトを実行した際に以下のエラーが生じました。
$ ./run_basicpubsub.sh Connecting to endpoint with client ID Traceback (most recent call last): File "aws-iot-device-sdk-python-v2/samples/pubsub.py", line 105, in <module> connect_future.result() File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 435, in result return self.__get_result() File "/usr/lib64/python3.7/concurrent/futures/_base.py", line 384, in __get_result raise self._exception awscrt.exceptions.AwsCrtError: AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly. test_dev_1:~/environment $
試したこと
現バージョンのSDKにてハンズオンで指示されている編集箇所に該当していそうな箇所を変更
・MQTTクライアントidの変更
/aws-iot-device-sdk-python-v2/samples/pubsub.py
29行目付近
python3
1#cmdUtils.register_command("client_id", "<str>", "Client ID to use for MQTT connection (optional, default='test-*').", default="test-" + str(uuid4())) 2cmdUtils.register_command("client_id", "<str>", "Target Client ID", default="MyThing")
・モードの変更
31行目付近
python3
1#cmdUtils.register_command("is_ci", "<str>", "If present the sample will run in CI mode (optional, default='None')") 2cmdUtils.register_command("is_ci", "<str>", "If present the sample will run in CI mode (optional, default='None')", default="publish")
・トピックの変更
/aws-iot-device-sdk-python-v2/samples/command_line_utils.py
74行目付近
python3
1 def add_common_topic_message_commands(self): 2# self.register_command(self.m_cmd_topic, "<str>", "Topic to publish, subscribe to (optional, default='test/topic').", default="test/topic") 3 self.register_command(self.m_cmd_topic, "<str>", "Topic to publish", default="aws/rules/timestream_mixer/mixer/telemetry") 4 self.register_command(self.m_cmd_message, "<str>", "The message to send in the payload (optional, default='Hello World!').", default="Hello World!")
結果
変わらず同じエラーが出てしまう
また、今回のエラーをネットで調べた際に出てくる”ポリシーのアクティブ化”についてもハンズオンの流れに沿い出来ているようです。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。