Skip to content

Instantly share code, notes, and snippets.

@crissilvaeng
Last active September 24, 2018 13:06
Show Gist options
  • Save crissilvaeng/7620d6681d6b1741e8112986e29d46bb to your computer and use it in GitHub Desktop.
Save crissilvaeng/7620d6681d6b1741e8112986e29d46bb to your computer and use it in GitHub Desktop.
{
"AttributeDefinitions": [
{
"AttributeName": "birth_day",
"AttributeType": "N"
},
{
"AttributeName": "birth_month",
"AttributeType": "N"
},
{
"AttributeName": "friend_id",
"AttributeType": "N"
}
],
"TableName": "Friends3",
"KeySchema": [
{
"AttributeName": "friend_id",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 2
},
"GlobalSecondaryIndexes": [
{
"IndexName": "birthday-index",
"KeySchema": [
{
"AttributeName": "birth_month",
"KeyType": "HASH"
},
{
"AttributeName": "birth_day",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 2
}
}
]
}
aws dynamodb create-table \
--attribute-definitions AttributeName=birth_day,AttributeType=N AttributeName=birth_month,AttributeType=N AttributeName=friend_id,AttributeType=N \
--table-name Friends \
--key-schema AttributeName=friend_id,KeyType=HASH \
--global-secondary-indexes IndexName=birthday-index,KeySchema=[{AttributeName=birth_month,KeyType=HASH},{AttributeName=birth_day,KeyType=RANGE}],Projection={ProjectionType=ALL},ProvisionedThroughput={ReadCapacityUnits=5,WriteCapacityUnits=2} \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment