Serverless DynamoDB Auto Scaling with CloudFormation

July 19th, 2017 151 Words

Since a few days, Amazon provides a native way to enable Auto Scaling for DynamoDB tables! Luckily the settings can be configured using CloudFormation templates, and so I wrote a plugin for serverless to easily configure Auto Scaling without having to write the whole CloudFormation configuration.

You can find the serverless-dynamodb-autoscaling on GitHub and NPM as well. Just install it using npm or yarn and add it to our serverless.yml configuration:

plugins:
  - serverless-dynamodb-autoscaling

custom:
  capacities:
    - table: CustomTable  # DynamoDB resource name
      read:
        minimum: 5        # Minimum read capacity
        maximum: 1000     # Maximum read capacity
        usage: 0.75       # Usage percentage
      write:
        minimum: 40
        maximum: 200
        usage: 0.5

After your next deployment, Amazon will configure native Auto Scaling for your DynamoDB table. Before the native support from Amazon, you had to handle Auto Scaling on your own, with a custom AWS Lambda function for example. But those times a finally over!


View on GitHub Source code is published using the MIT License.