我一直在使用该命令aws dynamodb create-table --cli-input-json创建本地 dynamodb 表以在本地机器上进行测试。
我可以创建简单的表格,但无法创建更复杂的现实世界表格。我查看了AWS文档,它缺少嵌套AttributeDefinitions的解释,或者我找不到它。以下是一个简单的示例(用于通过 AWS CLI 创建):
{
"TableName": "fruitsTable",
"KeySchema": [
{
"AttributeName": "fruitId",
"KeyType": "HASH"
}
],
"AttributeDefinitions": [
{
"AttributeName": "fruitId",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}
Run Code Online (Sandbox Code Playgroud)
效果很好。aws dynamodb create-table --cli-input-json file:///Users/you/subfile/server/config/tables/fruits.json --endpoint-url http://localhost:8000
不过,我想看一个创建更复杂的对象的示例。什么模式适用于此?
{
"ComplexFruit" : [
{
"complexFruitId": "redbanana-fromGroceryStore"
"name" : "redBanana",
"notes": "this one is red",
"count" : {
"ripe" : 5,
"total": 10
},
"stores" : [
{"storeName" : "Exito"} …Run Code Online (Sandbox Code Playgroud)