ユーザ用ツール

サイト用ツール


aws:dynamodb

dynamoDB

DynamoDB-localのインストール

https://docs.aws.amazon.com/ja_jp/amazondynamodb/latest/developerguide/DynamoDBLocal.html

コマンド

テーブル一覧

aws dynamodb list-tables --endpoint-url http://localhost:8000

テーブル作成

aws dynamodb create-table --endpoint-url http://localhost:8000 --cli-input-json ./table_def.json 

テーブル定義JSONの例

{
  "AttributeDefinitions": [
    {"AttributeName": "user_id","AttributeType": "S"},
    {"AttributeName": "token","AttributeType": "S"},
    {"AttributeName": "timestamp","AttributeType": "S"}
  ],
  "TableName": "user_token",
  "KeySchema": [
    {"AttributeName": "user_id","KeyType": "HASH"},
    {"AttributeName": "timestamp","KeyType": "RANGE"}
  ],
  "GlobalSecondaryIndexes": [{
    "IndexName": "token_timestamp_index","KeySchema": [
      {"AttributeName": "token","KeyType": "HASH"},
      {"AttributeName": "timestamp","KeyType": "RANGE"}
    ],
    "Projection": {"ProjectionType": "ALL"},
    "ProvisionedThroughput": {"ReadCapacityUnits": 1,"WriteCapacityUnits": 1}
  }],
  "ProvisionedThroughput": {"ReadCapacityUnits": 1,"WriteCapacityUnits": 1}}
aws/dynamodb.txt · 最終更新: 2018/04/19 02:15 by nullpon