Skip to content

Instantly share code, notes, and snippets.

@bensie
Created June 15, 2021 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bensie/f0bd57e5f000f31b3be622b646183e97 to your computer and use it in GitHub Desktop.
Save bensie/f0bd57e5f000f31b3be622b646183e97 to your computer and use it in GitHub Desktop.
CloudFormation - Generic DynamoDB table schema
AWSTemplateFormatVersion: "2010-09-09"
Resources:
Table:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: PK
AttributeType: S
- AttributeName: SK
AttributeType: S
- AttributeName: GSI1PK
AttributeType: S
- AttributeName: GSI1SK
AttributeType: S
- AttributeName: GSI2PK
AttributeType: S
- AttributeName: GSI2SK
AttributeType: S
- AttributeName: GSI3PK
AttributeType: S
- AttributeName: GSI3SK
AttributeType: S
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: PK
KeyType: HASH
- AttributeName: SK
KeyType: RANGE
GlobalSecondaryIndexes:
- IndexName: GSI1
KeySchema:
- AttributeName: GSI1PK
KeyType: HASH
- AttributeName: GSI1SK
KeyType: RANGE
Projection:
ProjectionType: ALL
- IndexName: GSI2
KeySchema:
- AttributeName: GSI2PK
KeyType: HASH
- AttributeName: GSI2SK
KeyType: RANGE
Projection:
ProjectionType: ALL
- IndexName: GSI3
KeySchema:
- AttributeName: GSI3PK
KeyType: HASH
- AttributeName: GSI3SK
KeyType: RANGE
Projection:
ProjectionType: ALL
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
TimeToLiveSpecification:
AttributeName: ExpiresAt
Enabled: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment