Skip to content

Add on Demand mode#183

Open
aneilbaboo wants to merge 2 commits intoclarkie:masterfrom
aneilbaboo:aneil/enableOnDemand
Open

Add on Demand mode#183
aneilbaboo wants to merge 2 commits intoclarkie:masterfrom
aneilbaboo:aneil/enableOnDemand

Conversation

@aneilbaboo
Copy link
Copy Markdown
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

Comment thread README.md Outdated
dynogels.createTables({
'BlogPost': {readCapacity: 5, writeCapacity: 10},
'BlogPost': {
billingMode: 'PAY_PER_REQUEST'
Copy link
Copy Markdown

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?

Copy link
Copy Markdown

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 aneilbaboo force-pushed the aneil/enableOnDemand branch from 9fd1395 to ef54ad4 Compare May 17, 2020 20:42
@aneilbaboo
Copy link
Copy Markdown
Contributor Author

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

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

@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
Copy Markdown
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.

@aneilbaboo aneilbaboo force-pushed the aneil/enableOnDemand branch from 9717ea8 to c5b285c Compare June 6, 2020 21:00
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