2 Answers
- Newest
- Most votes
- Most comments
0
Use API Gateway's throttling feature to control the number of WebSocket connections per user or API key.
https://www.beabetterdev.com/2021/10/01/aws-api-gateway-request-throttling/
Similar to connection throttling, you can set limits on the number of messages per WebSocket connection by configuring route-level throttling in API Gateway. For logging WebSocket messages, employ a Lambda Authorizer, which can be used for access control and message logging, as direct usage plans for WebSocket are not available like they are for HTTP connections
https://github.com/aws-samples/api-gateway-websocket-saas-rate-limiting-using-aws-lambda-authorizer
Relevant content
- asked 4 years ago
- asked 7 months ago
- asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Hello, Thank you for commenting! I've checked API Gateway console and trying to configure it.
However,
Different from HTTP/REST, WebSocket API doesn't have throttling setting section in console as I attached an image below, and linked article doesn't include topics about Websocket specifically (for e.g. how to configure websocket connections limit per apikey) Is it configurable by CLI?
Do you mean Account throttling by route-level throttling in API Gateway? It has two values "Burst limit" and "Rate limit", do they apply to WebSocket messages as well? (The background of asking this is most of API Gateway services' rate limit doesn't apply to WebSocket messages due to its protocol uniqueness)
Thank you! I'll go deeper into this.
Basically, We'd like to apply WebSocket connections limit and messages limit in a connection "per api key".