Skip to content

Commit

Permalink
feat(dynamo-autoscale): scale Dynamo capacity dynamically - EUBFR-25 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuard authored and kalinchernev committed Sep 28, 2017
1 parent 12397aa commit df81799
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
3 changes: 2 additions & 1 deletion services/db/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"deploy": "sls deploy -v"
},
"devDependencies": {
"serverless": "1.23.0"
"serverless": "1.23.0",
"serverless-dynamodb-autoscaling": "0.6.2"
}
}
21 changes: 17 additions & 4 deletions services/db/serverless.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
service: db

plugins:
- serverless-dynamodb-autoscaling

custom:
eubfrEnvironment: ${opt:eubfr_env, file(../../config.json):eubfr_env, env:EUBFR_ENV, 'dev'}
DYNAMODB_TABLE: ${self:provider.stage}-projects
capacities:
- table: ProjectsDynamoDbTable
read:
minimum: 5 # Minimum read capacity
maximum: 1000 # Maximum read capacity
usage: 0.75 # Targeted usage percentage
write:
minimum: 5 # Minimum write capacity
maximum: 1000 # Maximum write capacity
usage: 0.5 # Targeted usage percentage

provider:
name: aws
Expand All @@ -16,9 +29,10 @@ provider:
resources:
Resources:
ProjectsDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain
Properties:
TableName: ${self:custom.DYNAMODB_TABLE}
AttributeDefinitions:
-
AttributeName: id
Expand All @@ -28,6 +42,5 @@ resources:
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 100
WriteCapacityUnits: 100
TableName: ${self:custom.DYNAMODB_TABLE}
ReadCapacityUnits: 5
WriteCapacityUnits: 5
24 changes: 0 additions & 24 deletions services/db/webpack.config.js

This file was deleted.

0 comments on commit df81799

Please sign in to comment.