About
AWSのドキュメント にDynamoDBのテーブルを作成するものがあるが、マネジメントコンソールから作る例しか見当たらなかったので、cliから作る例を貼っておく。すでにあったら消すかも
実行方法
$ aws dynamodb create-table --cli-input-json file://product_catalog.json
のようにjsonを指定する
ProductCatalog
{
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "N"
}
],
"TableName": "ProductCatalog",
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
Forum
{
"AttributeDefinitions": [
{
"AttributeName": "Name",
"AttributeType": "S"
}
],
"TableName": "Forum",
"KeySchema": [
{
"AttributeName": "Name",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
Thread
{
"AttributeDefinitions": [
{
"AttributeName": "ForumName",
"AttributeType": "S"
},
{
"AttributeName": "Subject",
"AttributeType": "S"
}
],
"TableName": "Thread",
"KeySchema": [
{
"AttributeName": "ForumName",
"KeyType": "HASH"
},
{
"AttributeName": "Subject",
"KeyType": "RANGE"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
Reply
{
"AttributeDefinitions": [
{
"AttributeName": "Id",
"AttributeType": "S"
},
{
"AttributeName": "ReplyDateTime",
"AttributeType": "S"
},
{
"AttributeName": "PostedBy",
"AttributeType": "S"
},
{
"AttributeName": "Message",
"AttributeType": "S"
}
],
"TableName": "Reply",
"KeySchema": [
{
"AttributeName": "Id",
"KeyType": "HASH"
},
{
"AttributeName": "ReplyDateTime",
"KeyType": "RANGE"
}
],
"GlobalSecondaryIndexes": [
{
"IndexName": "PostedBy-Message-Index",
"KeySchema": [
{
"AttributeName": "PostedBy",
"KeyType": "HASH"
},
{
"AttributeName": "Message",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}