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

Add on Demand mode #183

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aneilbaboo
Copy link
Contributor

This adds a new schema attribute, billingMode, which can be set to 'PROVISIONED' (the default) or 'PAY_PER_REQUEST', which causes the table to run in On Demand mode. This value can also be provided on a per-table basis to the dynogels.createTables` function.

  • Set billingMode as an attribute of the schema:
const Account = dynogels.define('Account', {
  hashKey : 'id',
  schema : {
    id : Joi.string()
  },
  billingMode: 'PAY_PER_REQUEST'
});
  • Pass it billingMode as a parameter to dynogels.createTables (overrides schema):
dynogels.createTables({
  'Account': {
    billingMode: 'PAY_PER_REQUEST'
  }
}, function(err) {
  if (err) {
    console.log('Error creating tables: ', err);
  } else {
    console.log('Tables has been created');
  }
});

Fixes #182

README.md Outdated
@@ -134,7 +134,9 @@ When creating tables you can pass specific throughput settings or stream specifi

```js
dynogels.createTables({
'BlogPost': {readCapacity: 5, writeCapacity: 10},
'BlogPost': {
billingMode: 'PAY_PER_REQUEST'
Copy link

Choose a reason for hiding this comment

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

Since this part of documentation is not specifically about 'on-demand' mode, maybe leave as it was before?

Choose a reason for hiding this comment

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

Let’s add one example for each option so the developer can see what is possible

PAY_PER_REQUEST is super convenient

This adds a new schema attribute, billingMode, which can be set to
'PROVISIONED' (the default) or 'PAY_PER_REQUEST', which causes the table
to run in On Demand mode. This value can also be provided on a per-table basis
to the dynogels.createTables` function.
@aneilbaboo
Copy link
Contributor Author

Rebased on current master and addressed the comment from @rchl.

package.json Outdated
"aws-sdk": "^2.408.0",
"lodash": "^4.17.15",
"aws-sdk": "^2.441.0",
"lodash": "4.17.4",
Copy link

@rchl rchl Jun 5, 2020

Choose a reason for hiding this comment

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

Why downgrading lodash?
Also the aws-sdk version changed but it's not reflected in package-lock.
Should run npm i.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I think this was a rebase issue. I just pushed a fix.

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

Successfully merging this pull request may close these issues.

Enable On-Demand Billing Mode
3 participants