2014年10月20日月曜日

AWS CLI から DynamoDB local を操作

こちらがとても参考になります。

テーブル作成:HASHキー
aws dynamodb create-table --endpoint-url http://localhost:8000 \
 --table-name test1 \
 --attribute-definitions AttributeName=testId,AttributeType=S \
 --key-schema AttributeName=testId,KeyType=HASH \
 --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
テーブル作成:HASH+RANGEキー
aws dynamodb create-table --endpoint-url http://localhost:8000 \
 --table-name test2 \
 --attribute-definitions AttributeName=testId,AttributeType=S AttributeName=range,AttributeType=S \
 --key-schema AttributeName=testId,KeyType=HASH AttributeName=range,KeyType=RANGE \
 --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1
テーブルリスト
aws dynamodb list-tables --endpoint-url http://localhost:8000
テーブル詳細
aws dynamodb describe-table --table-name test1 --endpoint-url http://localhost:8000
テーブルスループット変更
aws dynamodb update-table --endpoint-url http://localhost:8000 \
 --table-name test \
 --provisioned-throughput ReadCapacityUnits=2,WriteCapacityUnits=2
追加
aws dynamodb put-item --endpoint-url http://localhost:8000 \
 --table-name test --item '{"testId":"1"}'
取得
aws dynamodb get-item --endpoint-url http://localhost:8000 \
 --table-name test --key '{"testId":"1"}'
削除
aws dynamodb delete-item --endpoint-url http://localhost:8000 \
 --table-name test --key '{"testId":"1"}'

0 件のコメント:

コメントを投稿