sbstjn / serverless-dynamodb-autoscaling

Serverless Plugin for Amazon DynamoDB Auto Scaling configuration.

Home Page:https://sbstjn.com/serverless-dynamodb-auto-scaling-with-cloudformation.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apply same settings to global secondary indexes

yosriady opened this issue · comments

screen shot 2017-07-20 at 1 41 34 pm

What do you think of adding support for the ability to 'Apply same settings to global secondary indexes'?

Sure, would make sense to support this well. Hopefully I can find the time to look at the CloudFormation docs in the next days. But you are always welcome to provide a pull request :)

Have you checked the docs for this topic? I just had a quick look and found nothing about applying the settings to all index. Anyway, the target template has a ResourceId, which is per default table/${tablename} and should easily be extended to indexes.

Hmm right there might not be official CF support for this yet, so perhaps we can wait for it for now.

Otherwise, we will need to add the Autoscaling resources (Policy, Role, Target) to each table Index manually.

I think we could easily add this feature by updating the configuration syntax and offer a table and index property:

Table

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

Index

custom:
  capacities:
    - index: custom-index  # DynamoDB index name
      read:
        minimum: 5        # Minimum read capacity
        maximum: 1000     # Maximum read capacity
        usage: 0.75       # Targeted usage percentage
      write:
        minimum: 40       # Minimum write capacity
        maximum: 200      # Maximum write capacity
        usage: 0.5        # Targeted usage percentage

This would be the easiest way to achieve this.

With v0.2.x I changed the name configuration to table. There is still no index support, but the basics are prepared now ;)

Thanks @sbstjn. I look forward to the upcoming 'index' supporting 👍

#8 is a first spike to support global secondary indexes.

Feedback regarding the YAML configuration syntax for tables/indexes would be appreciated :)

Version 0.3.0 with support for the index property should be on NPM in a couple of minutes.