title: How do I create a dynamodb schema with nested attribute definitions via aws-cli?
body: <p>I have been using the command <code>aws dynamodb create-table --cli-input-json</code> to create local dynamodb tables for testing on my local box. </p>
  
  <p>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):</p>
  
  <pre><code>{
    "TableName": "fruitsTable",
    "KeySchema": [
      {
        "AttributeName": "fruitId",
        "KeyType": "HASH"
      }
    ],
    "AttributeDefinitions": [
      {
        "AttributeName": "fruitId",
        "AttributeType": "S"
      }
    ],
    "ProvisionedThroughput": {
      "ReadCapacityUnits": 5,
      "WriteCapacityUnits": 5
    }
  }
  </code></pre>
  
  <p>That works fine. <code>aws dynamodb create-table --cli-input-json file:///Users/you/subfile/server/config/tables/fruits.json --endpoint-url http://localhost:8000</code></p>
  
  <p>However I would like to see an example of creating an object that is more complex. What schema would work for this?</p>
  
  <pre><code>{
    "ComplexFruit" : [
      {
        "complexFruitId": "redbanana-fromGroceryStore"
        "name" : "redBanana", 
        "notes": "this one is red",
        "count" : {
          "ripe" : 5,
          "total": 10
         },
        "stores" : [ 
            {"storeName" : "Exito"}
         ]
       }
     ]
  }
  </code></pre>
  
  <p>I am stumped on how I can create a nested <code>AttributeDefinition</code> 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.</p>