LoginSignup
1
1

More than 5 years have passed since last update.

AWS IoT Device SDK for Ruby を使ってみた #3 - AWS IoT 設定

Last updated at Posted at 2016-10-11

// 当記事は, 以下親記事の Setup Flowの一部です.
// AWS IoT Device SDK for Ruby を使ってみた

AWS IoT : Create thing

  • Login to AWS
  • select AWS IoT
  • select [Create a resouce]
    スクリーンショット 2016-10-10 21.53.45.png


  • select [Create thing]
    スクリーンショット 2016-10-10 21.57.46.png


  • write name // 当値 Thing Name は後ほど使用

  • select [create]
    スクリーンショット 2016-10-10 22.01.55 のコピー.png


  • select [前工程で設定したthing name] icon
    スクリーンショット 2016-10-10 22.06.41.png


  • select [connect a device]
    スクリーンショット 2016-10-10 22.08.06.png


  • select [nodejs]

  • select [Generate ceritificate and policy]
    スクリーンショット 2016-10-10 22.09.57.png

  • download following access keys

    • public key
    • private key
    • certificate

      // 後ほどraspberry piへ転送
      スクリーンショット 2016-10-10 22.12.34 のコピー.png


  • select [Confirm and start connecting]
    スクリーンショット 2016-10-10 22.12.34.png


  • 変数を保存 // 設定に用いる値
    スクリーンショット 2016-10-10 22.15.55 のコピー.png


  • select [Return to Thing Detail]
    スクリーンショット 2016-10-10 22.15.55.png


  • [Thing name]_policy icon が作成されている事を確認
    スクリーンショット 2016-10-10 22.19.07.png


AWS IoT : Create rule

  • select [Create a resource]
    スクリーンショット 2016-10-10 21.53.45.png


  • select [Create Rule]
    スクリーンショット 2016-10-10 22.22.48.png


  • write Name : 適当な名前

  • write attribute : 下記をそのまま書き込み

    state.reported.temperature, state.reported.humidity
    
  • write topic filter : 下記の[Thing name]部分をを前工程で作成した、thing nameへ変更し書き込み

     $aws/things/[Thing name]/shadow/update/accepted
    

    スクリーンショット 2016-10-10 22.27.24.png


  • [choosen action] から [Republish this message to another topic (AWS IoT)] を選択
    スクリーンショット 2016-10-10 22.32.23.png


  • [Topic] へ適当な名前を入力

  • [Create a new role] を選択
    スクリーンショット 2016-10-10 22.36.08.png


  • Role Nameを入力

  • [Create] を選択
    スクリーンショット 2016-10-10 22.39.11 のコピー.png


  • 入力した Role名が表示される事を確認

  • [Add Action] を選択
    スクリーンショット 2016-10-10 22.41.55.png


  • [choosen action] から [Insert this message into a code function and excut it(Lambda)] を選択
    スクリーンショット 2016-10-10 22.44.43.png


  • [Create a new resouce] を選択
    スクリーンショット 2016-10-10 22.46.38.png


記事移動

残工程

  • Lambdaの画面から抜け, 設定途中のIoT画面へ戻る
  • フォーム右手の更新アイコンを押下し、function listを再取得
  • 新規作成した lambda functionを選択
  • [Add Action] を選択
    スクリーンショット 2016-10-11 0.24.11.png


  • [Create] を選択し、完了
    スクリーンショット 2016-10-11 0.24.46.png


RaspBerry Pi

Access keys をraspberry piへ転送

// AWS IoT : Create Thing 設定時DLした, pub / pri / cert の3個及び, root証明書 1個.

console
ssh pi@192.168.1.100
mkdir ~/cert
cd ~/cert
wget -O root-CA.crt https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem
exit
console
scp ./xxxx-certificate.pem.crt pi@192.168.1.100:/home/pi/cert/certificate.pem.crt
scp ./xxxx-private.pem.key     pi@192.168.1.100:/home/pi/cert/private.pem.key
scp ./xxxx-public.pem.key      pi@192.168.1.100:/home/pi/cert/root-CA.crt

以上.
続いて, #4 - AWS IoT Device SDK for Ruby script作成

1
1
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
1
1