0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWSIOT: AWS CLI で トピックにパブリッシュ

Last updated at Posted at 2022-11-10

次のバージョンで確認しました。

$ aws --version
aws-cli/2.7.35 Python/3.9.11 Linux/5.19.0-23-generic exe/x86_64.ubuntu.22 prompt/off

エンドポイントの調べ方

aws iot describe-endpoint --endpoint-type iot:Data-ATS
$ aws iot describe-endpoint --endpoint-type iot:Data-ATS
{
    "endpointAddress": "b987ceh026tlxq-ats.iot.ap-northeast-1.amazonaws.com"
}

トピックの調べ方

aws iot list-topic-rules

topicPattern です。

"topicPattern": "test/topica"

パブリッシュするスクリプト

publish.sh
ENDPOINT="b987ceh026tlxq-ats.iot.ap-northeast-1.amazonaws.com"
HOST="https://"${ENDPOINT}
TOPIC="test/topica"
#
aws iot-data publish --cli-binary-format raw-in-base64-out \
	--topic $TOPIC --qos 1 --payload '{"x": 37, "y":47, "z": 1027}' \
	--endpoint-url $HOST

結果の確認

MQTT テストクライアント で確認できます。
AWS IoT -> MQTT test client

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?