Question:
AWS API Gateway provides a way to rate limit requests using the Usage plan for different users.
But the rate limit is applicable for all end-points.
So, if I have a GET
request and another POST
request endpoints, can I set different limits for the GET
request and separate limit for the POST
requests?
Example:
GET request end-point
1 2 |
https://aws.api.gateway/v1/get_data <- set rate limit to 10,000 |
POST request end-point
1 2 |
https://aws.api.gateway/v1/post_data <- set rate limit to 100 |
The POST requests is a costly operation, hence I would want to limit the number of requests by a certain user whereas allow for a large number of GET
requests.
Requirement is basically to have 2 different rate limits for 2 different end-points.
Answer:
You can have two different rate limits for two different endpoints.
If you go to your gateway’s stages and click one of the endpoints, you’ll see something like this…
So, by default all endpoints use your stage-level rate limits. But you choose “Override for this method”, you’ll get this…
You can then set your method-level rate limit for that HTTP method.
Reference: http://docs.aws.amazon.com/apigateway/latest/developerguide/stages.html#how-to-stage-settings
- To override the stage-level throttling for individual methods, expand the stage under the Stages secondary navigation pane, choose a method of interest, and, back in the stage editor, choose Override for this method for Settings. In the Default Method Throttling area, select appropriate options.