Reputation: 499
I'm building serverless application on AWS and trying to create DynamoDB tables with certain values of ProvisionedThroughput or auto scaling enabled using Serverless Framework.
For example:
I know how to configure settings for 1 environment by serverless.yml, but how can I manage different values for each environment using same serverless.yml file. Is it possible to change values or enable/disable auto scaling for each env in any way?
Upvotes: 1
Views: 516
Reputation: 1166
You can use the plugin
https://github.com/sbstjn/serverless-dynamodb-autoscaling
So, for the configuration you could use serverless variables like
custom:
capacities:
- table: CustomTable # DynamoDB Resource
index: # List or single index name
- custom-index-name
read:
minimum: ${file(../config.${self:provider.stage}.json):MinReadThroughput}
maximum: ${file(../config.${self:provider.stage}.json):MaxReadThroughput}
usage: 0.75
write:
minimum: 40 # Minimum write capacity
maximum: 200 # Maximum write capacity
usage: 0.5 # Targeted usage percentage
provider:
name: aws
stage: ${opt:stage, 'dev'}
Upvotes: 2