0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

DynamoDB Localを触ってみる

Posted at

はじめに

  • 以下の記事の検証用にローカルでDynamoDBを操作するために、DynamoDB localを触ってみたので簡単にまとめます。

テーブル作成まで

正直、以下参考記事通りやれば問題なくテーブル作成までできます。

1点補足をすると、参考記事内の

AWS CLI用コンテナに入る
shell
docker exec -it [AWS CLI用コンテナ名] /bin/bash

[AWS CLI用コンテナ名]は、docker ps -a実行後のNAMES列の値を使えばよいです。

データ保存

毎回、--region--endpoint-urlを指定する必要があるようです。

aws dynamodb \
  --region ap-northeast-1 \
  --endpoint-url http://dynamodb:8000 \
    put-item \
  --table-name User \
  --item '{ "UserId": { "S": "123" }, "SortKey": { "S": "SortKey1" }, "Parameter": { "S": "Param1" } }'

データの中身確認

aws dynamodb \
  --region ap-northeast-1 \
  --endpoint-url http://dynamodb:8000 \
    scan \
  --table-name User

{
    "Items": [
        {
            "Parameter": {
                "S": "Param1"
            },
            "UserId": {
                "S": "123"
            },
            "SortKey": {
                "S": "SortKey1"
            }
        }
    ],
    "Count": 1,
    "ScannedCount": 1,
    "ConsumedCapacity": null
}

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?