{"library":"serverless-api-gateway-throttling","title":"Serverless API Gateway Throttling Plugin","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install serverless-api-gateway-throttling"],"cli":{"name":"serverless","version":null}},"imports":["plugins:\n  - serverless-api-gateway-throttling","custom:\n  apiGatewayThrottling:\n    maxRequestsPerSecond: 1000\n    maxConcurrentRequests: 500","events:\n  - http:\n      path: /item\n      method: post\n      throttling:\n        maxRequestsPerSecond: 2000\n        maxConcurrentRequests: 1000"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"plugins:\n  - serverless-api-gateway-throttling\n\ncustom:\n  apiGatewayThrottling:\n    maxRequestsPerSecond: 1000\n    maxConcurrentRequests: 500\n\nfunctions:\n  # Throttling settings are inherited from stage settings\n  update-item:\n    handler: rest_api/item/post/handler.handle\n    events:\n      - http:\n          path: /item\n          method: post\n\n  # Requests are throttled using this endpoint's throttling configuration\n  list-all-items:\n    handler: rest_api/items/get/handler.handle\n    events:\n      - http:\n          path: /items\n          method: get\n          throttling:\n            maxRequestsPerSecond: 2000\n            maxConcurrentRequests: 1000\n\n  # Throttling is disabled for this endpoint\n  list-more-items:\n    handler: rest_api/items/get/handler.handle\n    events:\n      - http:\n          path: /more-items\n          method: get\n          throttling:\n            disabled: true\n  \n  # Supports httpApi (API Gateway v2)\n  list-http-api-items:\n    handler: rest_api/items/get/handler.handle\n    events:\n      - httpApi:\n          path: /http-api-items\n          method: get\n          throttling:\n            maxRequestsPerSecond: 3000\n            maxConcurrentRequests: 1000","lang":"javascript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}