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/ch8/backpressure-ratelimit --path cncb-backpressure-ratelimit
  1. Navigate to the cncb-backpressure-ratelimit directory with cd cncb-backpressure-ratelimit.
  2. Review the file named serverless.yml with the following content:
service: cncb-backpressure-ratelimit...functions:  listener:    handler: handler.listener    timeout: 240 # headroom for retries    events:      - stream:          batchSize: 1000 # / (timeout / 2) < write capacity          ...    environment:      WRITE_CAPACITY_UNITS: 10      SHARD_COUNT: 1...resources:  Resources:    Table:      Type: AWS::DynamoDB::Table      Properties:        ...        ProvisionedThroughput:          ...          WriteCapacityUnits

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.