Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance configuration API #8

Merged
merged 25 commits into from
Jul 25, 2017
Merged

Enhance configuration API #8

merged 25 commits into from
Jul 25, 2017

Conversation

sbstjn
Copy link
Owner

@sbstjn sbstjn commented Jul 21, 2017

Tasks

  • Rewrite index support
  • Rewrite DependsOn handling
  • Update README.md
  • Add info about CloudWatch API rate limits
  • Add stage to naming schema
  • Extend tests for names.js

This branch supports flexible Auto Scaling for tables and/or global secondary indexes with the following configurations:

custom:
  capacities:
    - table: CustomTableA
      index: custom-index-global
      indexOnly: true
      read:
        minimum: 1
        maximum: 123
        usage: 0.80
      write:
        minimum: 10
        maximum: 100
        usage: 0.50
    - table: CustomTableB
      read:
        minimum: 1
        maximum: 123
        usage: 0.80
      write:
        minimum: 10
        maximum: 100
        usage: 0.50
    - table:
        - CustomTableC
        - CustomTableD
        - CustomTableE
      index:
        - custom-index
      read:
        minimum: 1
        maximum: 123
        usage: 0.80
      write:
        minimum: 10
        maximum: 100
        usage: 0.50

@charleswhchan
Copy link
Contributor

  1. Is indexOnly applicable for the "string style" only? (I am guessing not, but just want to be clear) To eliminate the need for this parameter, is it possibly to simply provide the index name as the resource without table name?
  2. The array format looks interesting and useful, but may become confusing when there are lots of tables and indexes. I supposed as long as your indexes follows some form of consistent naming format wrt to the table name it should't lead to readability problems.

Thanks @sbstjn 👍

@sbstjn
Copy link
Owner Author

sbstjn commented Jul 24, 2017

Thanks for the feedback. Based on the CloudFormation resource I think the global secondary index has no CloudFormation resource identifier. They seem to be always referenced by the combination of the table resource/name and the name of the index:

    CustomTableC:
      Type: AWS::DynamoDB::Table
      Properties:
        TableName: custom-table-C
        GlobalSecondaryIndexes:
          - IndexName: custom-index
            KeySchema:
              - AttributeName: key
                KeyType: HASH
            Projection:
              ProjectionType: ALL
            ProvisionedThroughput:
              ReadCapacityUnits: 5
              WriteCapacityUnits: 5

Based on this, I think it's not possible to just provide an index without table.

The indexOnly property should be used if you only want to apply autoscaling on the index, and not on the table. I don't know if this is real use case ;)

@sbstjn
Copy link
Owner Author

sbstjn commented Jul 25, 2017

I have extended the README.md with information about the indexOnly parameter. The list-support is working and tested, but to avoid irritation I'll skip explaining the feature in the readme ;)

README.md Outdated
[![license](https://img.shields.io/github/license/sbstjn/serverless-dynamodb-autoscaling.svg)](https://github.com/sbstjn/serverless-dynamodb-autoscaling/blob/master/LICENSE.md)
[![Coveralls](https://img.shields.io/coveralls/sbstjn/serverless-dynamodb-autoscaling.svg)](https://coveralls.io/github/sbstjn/serverless-dynamodb-autoscaling)

With this plugin for [serverless](https://serverless.com) you can set DynamoDB Auto Scaling configuratin in your `serverless.yml` file. The plugin supports multiple tables and separate configuration sets for `read` and `write` capacities using AWS [native DynamoDB Auto Scaling](https://aws.amazon.com/blogs/aws/new-auto-scaling-for-amazon-dynamodb/).
With this plugin for [serverless](https://serverless.com), you can enable DynamoDB Auto Scaling for tables and **Global Secondary Indexes** easily in your `serverless.yml` configuration file. The plugin supports multiple tables and indexes, as well separate configuration sets for `read` and `write` capacities using Amazon's [native DynamoDB Auto Scaling](https://aws.amazon.com/blogs/aws/new-auto-scaling-for-amazon-dynamodb/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... as well as separate configuration sets for read and write

src/plugin.js Outdated
assert(this.serverless.service.provider.stage, 'Invalid serverless configuration')

assert(this.serverless.service.custom, 'Not Auto Scaling configuration found')
assert(this.serverless.service.custom.capacities, 'Not Auto Scaling configuration found')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not Auto Scaling configuration found

@sbstjn
Copy link
Owner Author

sbstjn commented Jul 25, 2017 via email

src/plugin.js Outdated
* Generate CloudFormation resources for DynamoDB table and indexes
*
* @param {string} table
* @param {obejct} config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: object

@charleswhchan
Copy link
Contributor

Thanks, @sbstjn. Except for a couple of typos, changes looks good 👍

@sbstjn
Copy link
Owner Author

sbstjn commented Jul 25, 2017

Thanks for checking 👍

@sbstjn sbstjn merged commit 2c21710 into master Jul 25, 2017
@sbstjn sbstjn deleted the enhance-api branch July 25, 2017 21:38
@nasirumair
Copy link

@sbstjn Is there any support for scaling tables in other stacks at all? I am trying to autoscale a table that is currently existing but not in the stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants