-
-
Save marcusjack/ae7f9fcf5f6d5a3f3a381e8ccb09303f to your computer and use it in GitHub Desktop.
Example of dynamo cloudformation with GSI and LSI
This file contains hidden or 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
| --- | |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Resources: | |
| myDynamoDBTable: | |
| Type: AWS::DynamoDB::Table | |
| Properties: | |
| AttributeDefinitions: | |
| - AttributeName: Album | |
| AttributeType: S | |
| - AttributeName: Artist | |
| AttributeType: S | |
| - AttributeName: Sales | |
| AttributeType: N | |
| KeySchema: | |
| - AttributeName: Album | |
| KeyType: HASH | |
| - AttributeName: Artist | |
| KeyType: RANGE | |
| ProvisionedThroughput: | |
| ReadCapacityUnits: '5' | |
| WriteCapacityUnits: '5' | |
| TableName: myTableName | |
| GlobalSecondaryIndexes: | |
| - IndexName: myGSI | |
| KeySchema: | |
| - AttributeName: Sales | |
| KeyType: HASH | |
| - AttributeName: Artist | |
| KeyType: RANGE | |
| Projection: | |
| NonKeyAttributes: | |
| - Album | |
| ProjectionType: INCLUDE | |
| ProvisionedThroughput: | |
| ReadCapacityUnits: '5' | |
| WriteCapacityUnits: '5' | |
| LocalSecondaryIndexes: | |
| - IndexName: myLSI | |
| KeySchema: | |
| - AttributeName: Album | |
| KeyType: HASH | |
| - AttributeName: Sales | |
| KeyType: RANGE | |
| Projection: | |
| NonKeyAttributes: | |
| - Artist | |
| ProjectionType: INCLUDE | |
| mySecondDDBTable: | |
| Type: AWS::DynamoDB::Table | |
| DependsOn: myDynamoDBTable | |
| Properties: | |
| AttributeDefinitions: | |
| - AttributeName: ArtistId | |
| AttributeType: S | |
| - AttributeName: Concert | |
| AttributeType: S | |
| - AttributeName: TicketSales | |
| AttributeType: S | |
| KeySchema: | |
| - AttributeName: ArtistId | |
| KeyType: HASH | |
| - AttributeName: Concert | |
| KeyType: RANGE | |
| TableName: myTableName2 | |
| ProvisionedThroughput: | |
| ReadCapacityUnits: '5' | |
| WriteCapacityUnits: '5' | |
| GlobalSecondaryIndexes: | |
| - IndexName: myGSI | |
| KeySchema: | |
| - AttributeName: TicketSales | |
| KeyType: HASH | |
| Projection: | |
| ProjectionType: KEYS_ONLY | |
| ProvisionedThroughput: | |
| ReadCapacityUnits: '5' | |
| WriteCapacityUnits: '5' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment