LoginSignup
4
4

More than 5 years have passed since last update.

[JAWS-UG CLI] Kinesis:#6 ストリームの削除

Last updated at Posted at 2015-06-18

注意事項

Amazon Kinesis に無料枠はありません。今回のハンズオンでは2つの shard を 2時間弱使用するため、利用料金として10円程度発生しますのでご注意ください。ハンズオン後はストリームの削除をお忘れなくお願いします。

Kinesis の料金 (2015年5月4日現在)
http://aws.amazon.com/jp/kinesis/pricing/

  • $0.0195 /h (1shardあたり)
  • $0.0430 /1,000,000 PutRecords

前提条件

Kinesis への権限

  • Kinesis に対してフル権限があること。

AWS CLI のバージョン

  • 以下のバージョンで動作確認済
    • AWS CLI 1.7.24
コマンド
aws --version
結果(例)
aws-cli/1.7.25 Python/2.7.6 Darwin/14.3.0

0. 準備

0.1. リージョンの決定

作成するストリームのリージョンを決めます。
(カレントユーザが利用するカレントリージョンも切り変わります。)

コマンド(東京リージョンの場合)
export AWS_DEFAULT_REGION='ap-northeast-1'

0.2. 変数の確認

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

変数の確認
aws configure list
結果(例)
      Name                    Value             Type    Location
      ----                    -----             ----    --------
   profile KinesisFull-handsOn-Kinesis-user-5KVYHRGZMYWG              env    AWS_DEFAULT_PROFILE
access_key     ****************HORA shared-credentials-file    
secret_key     ****************F9zU shared-credentials-file    
    region           ap-northeast-1              env    AWS_DEFAULT_REGION

0.3. ストリームの指定

command
aws kinesis list-streams
command
STREAM_NAME='<ストリーム名>'

0.4. ストリームの確認

command
aws kinesis describe-stream --stream-name ${STREAM_NAME}
result
{
    "StreamDescription": {
        "StreamStatus": "ACTIVE", 
        "StreamName": "handson", 
        "StreamARN": "arn:aws:kinesis:ap-northeast-1:XXXXXXXXXXXX:stream/handson", 
        "Shards": [
            {
                "ShardId": "shardId-000000000000", 
                "HashKeyRange": {
                    "EndingHashKey": "340282366920938463463374607431768211455", 
                    "StartingHashKey": "0"
                }, 
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "49550864092662459711139433817050545721599481607404650498", 
                    "StartingSequenceNumber": "49550864092651309338540168505480986788282674130572017666"
                }
            }, 
            {
                "ShardId": "shardId-000000000001", 
                "HashKeyRange": {
                    "EndingHashKey": "170141183460469231731687303715884105727", 
                    "StartingHashKey": "0"
                }, 
                "ParentShardId": "shardId-000000000000", 
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "49550864601498562906012662037471029548617289644346703890", 
                    "StartingSequenceNumber": "49550864601487412533413396725901470615300436606500995090"
                }
            }, 
            {
                "ShardId": "shardId-000000000002", 
                "HashKeyRange": {
                    "EndingHashKey": "340282366920938463463374607431768211455", 
                    "StartingHashKey": "170141183460469231731687303715884105728"
                }, 
                "ParentShardId": "shardId-000000000000", 
                "SequenceNumberRange": {
                    "EndingSequenceNumber": "49550864601520863651211192660612565266889938005852684322", 
                    "StartingSequenceNumber": "49550864601509713278611927349043006333573084968006975522"
                }
            }, 
            {
                "ShardId": "shardId-000000000003", 
                "HashKeyRange": {
                    "EndingHashKey": "340282366920938463463374607431768211455", 
                    "StartingHashKey": "0"
                }, 
                "ParentShardId": "shardId-000000000001", 
                "AdjacentParentShardId": "shardId-000000000002", 
                "SequenceNumberRange": {
                    "StartingSequenceNumber": "49550865346912121539498005854874389596844711860389281842"
                }
            }
        ]
    }
}

1. ストリームの削除

1.1 ストリームの削除

変数の確認
cat << ETX

STREAM_NAME: ${STREAM_NAME}

ETX
command
aws kinesis delete-stream --stream-name ${STREAM_NAME}

1.2 ストリームの削除確認

command
aws kinesis describe-stream --stream-name ${STREAM_NAME}
result(削除直後)
{
    "StreamDescription": {
        "StreamStatus": "DELETING", 
        "StreamName": "handson", 
        "StreamARN": "arn:aws:kinesis:ap-northeast-1:252950251796:stream/handson", 
        "Shards": []
    }
}
result(削除完了)
A client error (ResourceNotFoundException) occurred when calling the DescribeStream operation: Stream handson under account XXXXXXXXXXXX not found.

完了

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