Skip to content

Instantly share code, notes, and snippets.

@BrettFieber
Last active October 24, 2018 08:42
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 BrettFieber/019708518fd2ce4307ba03a360f20551 to your computer and use it in GitHub Desktop.
Save BrettFieber/019708518fd2ce4307ba03a360f20551 to your computer and use it in GitHub Desktop.
# Table Autoscaling Configuration
#
# ** There is an outstanding issue with the serverless-dynamodb-autoscaling plugin
# where attempting to provision auto scaling watches on multiple tables at once, fails in cloudformation.
# For now, I'm only enabling for loans table.
# When issue is resolved, uncomment the config for the other tables.
#
- table: MyTable1
read:
minimum: 5
maximum: 50
usage: 0.75
write:
minimum: 5
maximum: 50
usage: 0.75
- table: MyTable2
read:
minimum: 5
maximum: 50
usage: 0.75
write:
minimum: 5
maximum: 50
usage: 0.75
- table: MyTable3
read:
minimum: 5
maximum: 50
usage: 0.75
write:
minimum: 5
maximum: 50
usage: 0.75
- table: MyTable4
read:
minimum: 5
maximum: 50
usage: 0.75
write:
minimum: 5
maximum: 50
usage: 0.75
- table: MyTable5
read:
minimum: 5
maximum: 50
usage: 0.75
write:
minimum: 5
maximum: 50
usage: 0.75
service: autoscale
plugins:
- serverless-dynamodb-autoscaling
custom:
capacities: ${file(./autoscale.yml)}
defaultStage: dev
stage: ${opt:stage, self:custom.defaultStage}
provider:
name: aws
runtime: nodejs6.10
stage: ${self:custom.stage}
region: us-west-2
resources:
Resources:
MyTable1:
Type: AWS::DynamoDB::Table
# DeletionPolicy: Retain
Properties:
TableName: ${self:provider.stage}-table1
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
MyTable2:
Type: AWS::DynamoDB::Table
# DeletionPolicy: Retain
DependsOn: MyTable1
Properties:
TableName: ${self:provider.stage}-table2
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
MyTable3:
Type: AWS::DynamoDB::Table
# DeletionPolicy: Retain
DependsOn: MyTable2
Properties:
TableName: ${self:provider.stage}-table3
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
MyTable4:
Type: AWS::DynamoDB::Table
# DeletionPolicy: Retain
DependsOn: MyTable3
Properties:
TableName: ${self:provider.stage}-table4
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
MyTable5:
Type: AWS::DynamoDB::Table
# DeletionPolicy: Retain
DependsOn: MyTable4
Properties:
TableName: ${self:provider.stage}-table5
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment