serverless-api-gateway-throttling is a plugin for the Serverless framework designed to manage and configure API Gateway throttling settings at both the stage and individual endpoint levels. Its current stable version is 2.0.3, with an active release cadence that includes regular bug fixes and feature enhancements, such as the major addition of HTTP API (API Gateway v2) support in version 2.0.0. This plugin differentiates itself by addressing a common pitfall where default API Gateway account-level throttling limits can unintentionally impact all APIs in a region, potentially leading to exhaustion by a single method. It allows developers to specify custom maxRequestsPerSecond and maxConcurrentRequests for REST APIs and HTTP APIs, overriding the inherited stage settings and offering fine-grained control over API traffic. It also provides a CLI command to easily reset all endpoint settings.
npm install serverless-api-gateway-throttlingVerified import paths — ran on the pinned version, not inferred.
This 'serverless.yml' configuration snippet demonstrates how to enable the plugin, set global stage-level throttling, override settings for specific REST API endpoints, disable throttling for an endpoint, and configure throttling for HTTP API (v2) endpoints. Although the language is specified as 'javascript', this example provides the YAML configuration directly.
Upgrade your Serverless framework to version 2.11.1 or newer by running `npm install -g serverless`.
Ensure you are using `serverless-api-gateway-throttling` version 2.0.0 or greater when configuring throttling for HTTP API endpoints. Update your plugin via `npm install serverless-api-gateway-throttling@latest`.
Be mindful of the `ANY` method's behavior; if you need different throttling for specific methods under the same path, define them individually instead of relying solely on `ANY` with custom throttling.
Always define `apiGatewayThrottling` settings, either globally at the stage level or specifically per endpoint, to override the restrictive account-level defaults and protect your APIs from resource starvation.
Upgrade to version 2.0.3 or newer of the plugin (`npm install serverless-api-gateway-throttling@latest`), which includes a fix for this routing issue.
Upgrade to version 2.0.2 or newer (`npm install serverless-api-gateway-throttling@latest`). This version includes a fix to handle deployments gracefully when the stack is initially being created.
Upgrade to version 2.0.1 or newer (`npm install serverless-api-gateway-throttling@latest`) to resolve issues with HTTP API resource lookup during deployment.
Upgrade to version 1.1.0 or newer (`npm install serverless-api-gateway-throttling@latest`) to ensure proper inheritance of stage-level throttling settings.
Execute the command `sls reset-all-endpoint-settings` from your project root. This command will clear all custom endpoint settings, allowing them to inherit from the stage configuration again.