If an ip address exceeds its rate limit and a WAF rule blocks it for a period of time, do the future requests from that ip address still get charged to me by the WAF service?
(And if so, why it beneficial to even use a WAF service if I am charged for unauthorized requests with or without it? - Either by WAF or by Lambda. Especially since WAF costs 3 times as much as Lambda for requests. Maybe I could just put my rate limiting logic in the lambda function and save money.)
Note: My plan is to use: WAF → API Gateway → Lambda
I guess what I’m wondering, is why I (or anyone) should bother blocking them if their requests will cost me anyway. Letting them into a small lambda function will only cost $0.20/million which is a third of the cost of blocking with with WAF.
You have to pay for memory/CPU also with a lambda function? If you have API Gateway in from that would have cost even more. WAF is cheaper, faster and fit for purpose. If you use it with Cloudfront there’s a discount bundle to get WAF almost for free.
Other issues with lambda:
You can quickly reach your capacity limit by a bot and not have lambda to serve
The cost is not just the request and then memory/CPU but also logs, metrics and anything else you have with the lambda
How do you block with lambda if it’s stateless? E.g. 100 requests / minute. How do you keep track? If you need a cache or some storage that increases the cost further and also the complexity.
WAF will scale and mitigate a high volume / well coordinated DDOS / call flood. Having that reach your backend would be catastrophic and you will almost immediate see degradation / outages.
Move to Cloudflare. Had massive DDOS attacks from Russia and China and it cost me $3700/month in WAF rule requests for a $1600 infrastructure. Moved to cloudflare and even paid the $200/mo. WAF rule costs dropped back to zero.