Skip to content

Instantly share code, notes, and snippets.

@Pwntus
Created May 17, 2017 23:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pwntus/6988f8253c97d3c44f0743d0ef2c9c18 to your computer and use it in GitHub Desktop.
Save Pwntus/6988f8253c97d3c44f0743d0ef2c9c18 to your computer and use it in GitHub Desktop.
SLS DynamoDB GSI
resources:
Resources:
MyTableResource:
Type: AWS::DynamoDB::Table
Properties:
TableName: my-table-name
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
AttributeDefinitions:
- AttributeName: name
AttributeType: S
- AttributeName: category
AttributeType: S
- AttributeName: date
AttributeType: N
# Partition key: name
KeySchema:
- AttributeName: name
KeyType: HASH
# GSI: CategoryDate
# Partition key: category
# Sort key: date
GlobalSecondaryIndexes:
- IndexName: CategoryDate
KeySchema:
- AttributeName: category
KeyType: HASH
- AttributeName: date
KeyType: RANGE
# Project all attributes into the index
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment