Serverless Provisioned Concurrency Autoscaling

Serverless Plugin for AWS Lambda Provisioned Concurrency Auto Scaling configuration

logo

⚡️ serverless-provisioned-concurrency-autoscaling

npm build license pr

Serverless Plugin for AWS Lambda Provisioned Concurrency Auto Scaling configuration.

Related blog post can be found on the Neiman Marcus Medium page.

Usage

Add the NPM package to your project:

$ npm install serverless-provisioned-concurrency-autoscaling

Add the plugin to your serverless.yml:

plugins:
  - serverless-provisioned-concurrency-autoscaling

Configuration

Add concurrencyAutoscaling parameters under each function you wish to autoscale in your serverless.yml.

Add customMetric: true if you want to use Maximum instead of Average statistic.

# minimal configuration

functions:
  hello:
    handler: handler.hello
    provisionedConcurrency: 1
    concurrencyAutoscaling: true

# full configuration

  world:
    handler: handler.world
    provisionedConcurrency: 1
    concurrencyAutoscaling:
      enabled: true
      maximum: 10
      minimum: 1
      usage: 0.75
      scaleInCooldown: 120
      scaleOutCooldown: 0
      customMetric:
        statistic: maximum

That's it! With the next deployment, serverless will add Cloudformation resources to scale provisioned concurrency!

You must provide atleast provisionedConcurrency and concurrencyAutoscaling to enable autoscaling. Set concurrencyAutoscaling to a boolean, or object with configuration. Any omitted configuration will use module defaults.

Defaults

maximum: 10
minimum: 1
usage: 0.75
scaleInCooldown: 120
scaleOutCooldown: 0

Known Issues/Limitations

N/A

Authors

Conduct / Contributing / License

  • Refer to our contribution guidelines to contribute to this project. See CONTRIBUTING.md.
  • All contributions must follow our code of conduct. See CONDUCT.md.
  • This project is licensed under the Apache 2.0 license. See LICENSE.

Acknowledgments