Skip to content

Instantly share code, notes, and snippets.

@ng-the-engineer
Created July 26, 2020 17:54
Show Gist options
  • Save ng-the-engineer/0e58f13ae2abe8a495cde67ec9008161 to your computer and use it in GitHub Desktop.
Save ng-the-engineer/0e58f13ae2abe8a495cde67ec9008161 to your computer and use it in GitHub Desktop.
Create model in local DynamoDB example

Create model programmatically

  1. Create a Json file mymodel.json for a basic model
{
  "TableName": "YOUR_TABLE_NAME",
  "KeySchema": [
    {
      "AttributeName": "KEY_COLUMN_NAME",
      "KeyType": "HASH"
    }
  ],
  "AttributeDefinitions": [
    {
      "AttributeName": "KEY_COLUMN_NAME",
      "AttributeType": "S"
    }
  ],
  "ProvisionedThroughput": {
    "ReadCapacityUnits": 5,
    "WriteCapacityUnits": 5
  }
}
  1. Create the model
> aws dynamodb create-table --cli-input-json file://YOUR_FULL_PATH/mymodel.json --endpoint-url http://localhost:9001
  1. Check the model
> aws dynamodb list-tables --endpoint-url http://localhost:9001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment