How to do it...

  1. Create the project from the following template:
$ sls create --template-url https://github.com/danteinc/js-cloud-native-cookbook/tree/master/ch9/frp-batching --path cncb-frp-batching
  1. Navigate to the cncb-frp-batching directory, cd cncb-frp-batching.
  2. Review the file named serverless.yml.
  3. Review the file named handler.js with the following content:
module.exports.listener = (event, context, cb) => {  _(event.Records)    .map(recordToUow)    .filter(forPurple)    .ratelimit(Number(process.env.WRITE_CAPACITY) /      Number(process.env.SHARD_COUNT) /      Number(process.env.WRITE_BATCH_SIZE) / 10, 100)    .batch(Number(process.env.WRITE_BATCH_SIZE))    .map(batchUow)    .flatMap(batchWrite)    .collect().toCallback(cb);};const batchUow = batch => ({ batch ...

Get JavaScript Cloud Native Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.