99x / 99x/serverless-dynamodb-local
serverless.yml support for AWS DynamoDB new On-Demand capacity mode missing
- Dominant language
- JavaScript
- Stars
- 621
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
With the introduction of the AWS DynamoDB On-Demand capacity model at re:Invent 2018, table definitions have been changed. As a result, serverless.yml files that use the new 'BillingMode' property result in the local DynamoDB instance failing to start:
$ serverless dynamodb start
Dynamodb Local Started, Visit: http://localhost:8000/shell
Serverless: DynamoDB - Error -
Multiple Validation Errors -----------------------------
There were 2 validation errors:
* MissingRequiredParameter: Missing required key 'ProvisionedThroughput' in params
* UnexpectedParameter: Unexpected key 'BillingMode' found in params
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: darwin
Node Version: 8.9.4
Serverless Version: 1.34.1
$
**Expected Behaviour**
The local DynamoDB instance should allow capacity properties in the serverless.yml file to be based on either 'ProvisionedThroughput' or 'BillingMode'. Since these properties should not influence DynamoDB API invocation (either local through the plugin or on AWS), allowing the changed definitions should be enough to start using it.
**Steps to reproduce it**
Take an existing serverless.yml file that holds a ProvisionedThroughput definition, e.g.:
mytable:
Type: AWS::DynamoDB::Table
Properties:
TableName: myTable
AttributeDefinitions:
- AttributeName: id
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
Change the ProvisionedThroughput part to the new BillingMode property:
mytable:
Type: AWS::DynamoDB::Table
Properties:
TableName: myTable
AttributeDefinitions:
- AttributeName: id
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
Start the local dynamodb with: serverless dynamodb start
Contributor guide
Research direction
Start with the serverless.yml table definition and reproduce the issue using `serverless dynamodb start` with BillingMode: PAY_PER_REQUEST. Trace the local DynamoDB validation path that rejects BillingMode and requires ProvisionedThroughput; done means both capacity definitions are accepted and the local instance starts successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100