Last active
May 23, 2019 08:59
-
-
Save sonjisov/effbb1e62b75fdcbcb23700ea988b572 to your computer and use it in GitHub Desktop.
Deploying a DynamoDB table using a JSON definition file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Passing the region name as a parameter | |
region=$1 | |
tableName="JohnWickQuotes" | |
dir="${BASH_SOURCE%/*}" | |
tableDefinitionPath="$dir/table-definition.json" | |
# Trigger table creation | |
aws dynamodb create-table --cli-input-json "file://$tableDefinitionPath" --region $region | |
# Wait till the table is active | |
aws dynamodb wait table-exists --table-name "$tableName" --region $region |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"TableName": "JohnWickQuotes", | |
"AttributeDefinitions": [ | |
{ | |
"AttributeName": "author", | |
"AttributeType": "S" | |
} | |
], | |
"KeySchema": [ | |
{ | |
"AttributeName": "author", | |
"KeyType": "HASH" | |
} | |
], | |
"BillingMode": "PAY_PER_REQUEST" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment