AWS Databases: New Auto Scaling for Amazon DynamoDB

  • September 19, 2017

Amazon DynamoDB is a very popular NoSQL database service. Among AWS databases, the Flux7 AWS consultants like DynamoDB for its fast, reliable performance, especially for real time apps where we need faster access of data e.g. commerce, big data analytics, and IoT applications. Moreover, as a managed service, AWS takes care of the administrative burden (e.g. hardware provisioning, setup and configuration, replication, software patching, etc.) for you. While this database is well-loved, one feature that has been in high-demand–and we are happy to say was just released by AWS–is Auto Scaling for DynamoDB. We are really excited to see AWS deliver Auto Scaling to DynamoDB customers as it will make administration and managing capacity of data even easier, will help maximize availability for applications, all of which will positively impact cost savings.

This was a much-requested feature because without auto scaling, you had to find an alternate solution which involved the use of lambda function(s). The work around involved a lambda function where, if the read/write throughput reached capacity, the lambda function triggered a CloudWatch alarm. This would trigger a lambda function which tuned the provisioned capacity of the DynamoDB table to meet the throughput demand. Now that same CloudWatch alarm can trigger the auto scaling feature built into DynamoDB which saves us administrative work, removing room for potential error and streamlining the process.

Application auto scaling is used to scale up/down DynamoDB throughput. Enabling auto scaling for DynamoDB involves the creation of three additional resources:


  1. An IAM Role which gives specific permissions to the application auto scaling service.
  2. A scalable target
  3. A scaling policy

As strong supporters of AWS automation, we created a simple CloudFormation template to enable auto scaling for DynamoDB. Here is a snippet of the template which creates a scalable target and a scaling policy to scale DynamoDB read throughput.

    Type: AWS::IAM::Role
          - Action:
            - sts:AssumeRole
            Effect: Allow
      Path: /
        - PolicyName: DynamoDBAutoscaling
            Version: 2012-10-17
              - Action:
                  - "dynamodb:DescribeTable"
                  - "dynamodb:UpdateTable"
                  - "cloudwatch:PutMetricAlarm"
                  - "cloudwatch:DescribeAlarms"
                  - "cloudwatch:DeleteAlarms"
                Effect: "Allow"
                Resource: "*"

   Type: AWS::ApplicationAutoScaling::ScalableTarget
     ScalableDimension: 'dynamodb:table:ReadCapacityUnits'
     MinCapacity: !Ref ReadCapacityUnitsMin
     MaxCapacity: !Ref ReadCapacityUnitsMax
     ResourceId: !Sub table/${myDynamoDBTable}
     RoleARN: !GetAtt DynamoDBAutoscalingRole.Arn
     ServiceNamespace: dynamodb

    Type: "AWS::ApplicationAutoScaling::ScalingPolicy"
      PolicyName: Read Scaling Policy
      PolicyType: TargetTrackingScaling
      ScalingTargetId: !Ref DynamoDBReadScalableTarget
          PredefinedMetricType: DynamoDBReadCapacityUtilization
        ScaleOutCooldown: 60
        ScaleInCooldown: 60
        TargetValue: 30.0

Subscribe to our blog


Related Blog Posts