A plugin for the Serverless framework which configures throttling for API Gateway endpoints.
npm install serverless-api-gateway-throttling
!npm

This plugin makes it easy to configure those limits.
It supports both API Gateway v1 (REST API) and API Gateway v2 (HTTP API).
ANY, the settings will be applied to all methods: GET, DELETE, HEAD, OPTIONS, PATCH, POST and PUT.
sls reset-all-endpoint-settings
`Examples
`yml
plugins:
- serverless-api-gateway-throttlingcustom:
# Configures throttling settings for the API Gateway stage
# They apply to all http endpoints, unless specifically overridden
apiGatewayThrottling:
maxRequestsPerSecond: 1000
maxConcurrentRequests: 500
functions:
# Throttling settings are inherited from stage settings
update-item:
handler: rest_api/item/post/handler.handle
events:
- http:
path: /item
method: post
# Requests are throttled using this endpoint's throttling configuration
list-all-items:
handler: rest_api/items/get/handler.handle
events:
- http:
path: /items
method: get
throttling:
maxRequestsPerSecond: 2000
maxConcurrentRequests: 1000
# Requests are throttled for both endpoints
get-item:
handler: rest_api/items/get/handler.handle
events:
- http: # throttling settings are inherited from stage settings
path: /item/{itemId}
method: get
- http:
path: /another/item/{itemId}
method: get
throttling:
maxRequestsPerSecond: 2000
maxConcurrentRequests: 1000
# Requests are throttled for both endpoints
get-blue-item:
handler: rest_api/items/blue/get/handler.handle
events:
- http:
path: /item/blue/{itemId}
method: get
throttling:
maxRequestsPerSecond: 300
# maxConcurrentRequests are inherited from stage settings
- http:
path: /item/dark-blue/{itemId}
method: get
throttling:
# maxRequestsPerSecond are inherited from stage settings
maxConcurrentRequests: 300
# Throttling is disabled for this endpoint
list-more-items:
handler: rest_api/items/get/handler.handle
events:
- http:
path: /more-items
method: get
throttling:
disabled: true
# Also supports httpApi
list-http-api-items:
handler: rest_api/items/get/handler.handle
events:
- httpApi:
path: /http-api-items
method: get
throttling:
maxRequestsPerSecond: 3000
maxConcurrentRequests: 1000
``