AWS 创建示例表
这是AWS Create Example Tables
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.CreateTables.html的链接。我想为 localhost 创建一个脚本,如下所示。我不知道该怎么做create the Reply Table
。有人可以帮忙吗?
export LOCAL="--endpoint-url http://localhost:8000"
aws dynamodb create-table \
$LOCAL \
--table-name ProductCatalog \
--attribute-definitions \
AttributeName=Id,AttributeType=N
--key-schema \
AttributeName=Id,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=10,WriteCapacityUnits=5
aws dynamodb create-table \
$LOCAL \
--table-name Forum \
--attribute-definitions \
AttributeName=Name,AttributeType=S
--key-schema \
AttributeName=Name,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=10,WriteCapacityUnits=5
aws dynamodb create-table \
$LOCAL \
--table-name Thread \
--attribute-definitions \
AttributeName=ForumName,AttributeType=S \
AttributeName=Subject,AttributeType=S \
--key-schema \
AttributeName=ForumName,KeyType=HASH \
AttributeName=Subject,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=10,WriteCapacityUnits=5
aws dynamodb create-table \
$LOCAL \
--table-name Reply \
--attribute-definitions \
AttributeName=Id,AttributeType=S
AttributeName=ReplyDateTime,AttributeType=S
--key-schema \
AttributeName=Id,KeyType=HASH \
AttributeName=ReplyDateTime,KeyType=HASH \
--provisioned-throughput \
ReadCapacityUnits=10,WriteCapacityUnits=5
数据加载
这部分应该没问题,因为它是从Step 2: Load Data into Tables
链接https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SampleData.LoadData.html复制的
aws dynamodb batch-write-item --request-items file://ProductCatalog.json
aws dynamodb batch-write-item --request-items file://Forum.json
aws dynamodb batch-write-item --request-items file://Thread.json
aws dynamodb batch-write-item --request-items file://Reply.json