'Does Amazon AWS API gateway charge for failed requests? (HTTP status not in 200-299)

Does Amazon AWS API gateway, namely HTTP API gateway (not Lambda functions), charge for failed request? I.e. such requests that made it through to their destination but the return code is other than HTTP 200-299?

To put it in context, I am trying to determine if given that a "bad person" created a while true; curl http://i-dont-like.com/dummy; done script could result in a huge AWS charge for the domain owner - if they used AWS HTTP API gateway?



Solution 1:[1]

The AWS documentation says - Pay only for the API calls you receive and the amount of data transferred out - https://aws.amazon.com/api-gateway/pricing/ - So indeed, you are paying for the 4xx and 5xx requests as well.

What you can do is to set up a WAF and create a rule to block this kind of behavior. https://aws.amazon.com/blogs/compute/protecting-your-api-using-amazon-api-gateway-and-aws-waf-part-i/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sándor Bakos