How to implement rate limiting in API gateway per user?


Hi, If I am understanding correctly, the throttling limit in API gateway stage is for the endpoint. So, a limit of 100 request per sec will mean the endpoint will only respond to the first 100 request from anyone accessing it and will throw error after the 10 requests. What I need is to restrict the endpoint to have only 5 requests per second per user and no overall quota limit for the endpoint. So how can I implement it?

1 Answer

You can rate limit per client (user) in API Gateway using Usage Plans with API Keys. The options are described in this document, page 9 (pdf page 12) :

This developer guide describes setting it up in the AWS Console:

Please note, there are two options for API Keys. First your API consumers can pass in the API Key you share with them in the X-API-Key header. Second option is to use a Lambda authorizer to return the API key as part of the authorization response.

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions