LoginSignup
0
0

More than 5 years have passed since last update.

[JAWS-UG CLI] IoT #11 IoT Thingの削除

Posted at

前提条件

IoTへの権限

AWS IoTに対してフル権限があること。

AWS CLI

以下のバージョンで動作確認済

  • AWS CLI 1.11.14
コマンド
aws --version
結果(例)
      aws-cli/1.11.14 Python/2.7.10 Darwin/15.6.0 botocore/1.4.71

バージョンが古い場合は最新版に更新しましょう。

コマンド
sudo -H pip install -U awscli

0. 準備

0.1. リージョンの決定

変数の設定
export AWS_DEFAULT_REGION='ap-northeast-1'

0.2. 変数の確認

プロファイルが想定のものになっていることを確認します。

変数の確認
aws configure list
結果(例)
            Name                    Value             Type    Location
            ----                    -----             ----    --------
         profile       iotFull-handson-mbpr13        env    AWS_DEFAULT_PROFILE
      access_key     ****************XXXX shared-credentials-file
      secret_key     ****************XXXX shared-credentials-file
          region        ap-northeast-1        env    AWS_DEFAULT_REGION

0.3. モノ名の指定

コマンド
aws iot list-things \
        --query 'things[].thingName'
結果(例)
      [
        "handson-thing-20161117"
      ]

削除するモノの名を変数に格納します。

変数の設定
IOT_THING_NAME='handson-thing-20161117'

1. 事前作業

削除する前に、モノの内容を確認します。

コマンド
aws iot describe-thing \
        --thing-name ${IOT_THING_NAME}
結果
      (略)

2. モノの削除

コマンド
aws iot delete-thing \
        --thing-name ${IOT_THING_NAME}
結果(例)
      (戻り値なし)

3. 事後作業

同名のモノの不存在確認

コマンド
aws iot describe-thing \
        --thing-name ${IOT_THING_NAME}
結果(例)
      An error occurred (ResourceNotFoundException) when calling the DescribeThing operation: Failed to describe thing handson-thing-20161117 because it does not exist in our ecosystem for your account

完了

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