I have been using the command aws dynamodb create-table --cli-input-json to create local dynamodb tables for testing on my local box.
I can create simple tables but I cannot create more complex, real world tables. I looked through the AWS documentation and it's missing the explanation for nested AttributeDefinitions, or I could not find it. Here's a simple example that works (for creation through the AWS CLI):
{
"TableName": "fruitsTable",
"KeySchema": [
{
"AttributeName": "fruitId",
"KeyType": "HASH"
}
],
"AttributeDefinitions": [
{
"AttributeName": "fruitId",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
}
}
That works fine. aws dynamodb create-table --cli-input-json file:///Users/you/subfile/server/config/tables/fruits.json --endpoint-url http://localhost:8000
However I would like to see an example of creating an object that is more complex. What schema would work for this?
{
"ComplexFruit" : [
{
"complexFruitId": "redbanana-fromGroceryStore"
"name" : "redBanana",
"notes": "this one is red",
"count" : {
"ripe" : 5,
"total": 10
},
"stores" : [
{"storeName" : "Exito"}
]
}
]
}
I am stumped on how I can create a nested AttributeDefinition without a ton of guessing or digging through the code (if dynamodb is open source?).
Does anyone know? Also this obviously a contrived example but it would demonstrate how to create nested schemas.