Reputation: 2851
Does AWS API Gateway allows limiting a number of requests from a single IP?
I'm building a public API and would like to prevent it from being abused by establishing a limit on a number of times the API can be called from a single IP address (like 100 requests per minute).
Thanks,
Upvotes: 43
Views: 25530
Reputation: 83
Check this guide for implementing WAF Rate Based Rules, which act based on source IP.
To implement WAF Rate Based rules you can do the following:
Open the AWS WAF console.
Select Web ACLs.
Select the web ACL and then select the Rules tab.
Select Add rules.
Select Add my own rules and rule groups.
Select Rule builder for the Rule type.
Enter a Name and select Rate-based rule as the Type.
Enter the following parameters for the Request rate details:
In the Action section, select Block.
Select Add rule. Move the rule to the correct priority for your use case and then select Save.
API Gateway also does have the ability to throttle requests. However, it is based on API Keys and not source IP. For more information on API Gateway throttling the links below may be helpful.
Upvotes: 2
Reputation: 14543
AWS API Gateway does not offer the functionality that you are looking for but there is a workaround.
What you can do is Integrate AWS API gateway with AWS Cloud Front and use AWS Web Application Firewall Rules to limit the API call from a Specific IP address.
Check this Guide for implementing the WAF. http://docs.aws.amazon.com/waf/latest/developerguide/tutorials-rate-based-blocking.html
Upvotes: 34