putting DynamoDB scalability knobs on autopilot

one small change to your serverless.yml file that can get you on your way

AWS Reinvent never fails to deliver as was the case this year. This year the AWS DynamoDB team announced support for an automatic provisioning pricing plan. What does that mean for you? It means you now have a path for removing need to apply guesswork in the tuning of scalability knobs on your DynamoDB tables. This is a pay-for-what-you-use model. Sound familiar? It should if you are doing anything in the serverless space.

It’s sometimes unclear how to immediately take advantage of these offerings so I wanted write up a quick example of how to start taking advantage of this in your serverless framework applications today.

Below is what you’re probably used to with serverless framework, guessing ProvisionedThroughput values, hopefully tweaking through experimentation.

Today you can now replace ProvisionedThoughput with BillingMode PAY_PER_REQUEST to immediately start taking advantage of this offering. Since serverless framework uses cloud formation under the you can also just do this with your plain cloud formation templates.

Just run npx serverless deploy and rejoice. When your deployment completes you should see a capacity configuration like the following in the AWS DynamoDB console.

Note the billing option is called pay per request. This means you must now pay of course. You are charged $1.25 per million write requests units and $0.25 per million read request units, plus the usual data storage costs. For most cases thats incredible value considering what you pay for a star bucks coffee in the morning!