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

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

charleswhchan opened this issue · comments

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?

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 …

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

Thanks @sbstjn. That was quick 😄 👍