Skip to content

Instantly share code, notes, and snippets.

@sonjisov
Last active May 23, 2019 08:59
Show Gist options
  • Save sonjisov/effbb1e62b75fdcbcb23700ea988b572 to your computer and use it in GitHub Desktop.
Save sonjisov/effbb1e62b75fdcbcb23700ea988b572 to your computer and use it in GitHub Desktop.
Deploying a DynamoDB table using a JSON definition file
# 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
{
"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