sbstjn / serverless-dynamodb-autoscaling

Serverless Plugin for Amazon DynamoDB Auto Scaling configuration.
https://sbstjn.com/serverless-dynamodb-auto-scaling-with-cloudformation.html
MIT License
148 stars 27 forks source link

The CloudFormation template is invalid: Template format error: Resource name DynamoDBAutoscaleRoletable_with_underscore is non alphanumeric. #4

Closed charleswhchan closed 7 years ago

charleswhchan commented 7 years ago

Tried using the plugin but ran into the following error:

The CloudFormation template is invalid: Template format error: Resource name DynamoDBAutoscaleRolemy_table_dev is non alphanumeric.

This is my serverless.yml file:

plugins:
  - serverless-dynamodb-autoscaling

custom:
  capacities:
    - name: my_table_dev
      read:
        minimum: 1
        maximum: 100
        usage: 0.70
      write:
        minimum: 1
        maximum: 100
        usage: 0.70

If I add the autoscaling via the AWS Console, it will default to creating a "DynamoDBAutoScaleRole" or use an existing role: image

Perhaps the easiest solution is to strip the underscore from the table name (if any) to create a valid resource name? What do you think?

sbstjn commented 7 years ago

Thanks for reporting this. I'm using input.replace(/\W/g, '') in names.js and W only matches for - and not for _. There should be more verbose tests to handle specials characters as well …

sbstjn commented 7 years ago

Deployment for v0.1.2 just started. This should include a fix of the regular expression to replace _ as well.

charleswhchan commented 7 years ago

Thanks @sbstjn. That was quick 😄 👍