CloudWatch Alarm Percentage of errors API Gateway

Question:

I’m trying to setup and alarm in Cloudwatch using terraform.
My alarm basically needs to check if there is more than 5% of 5xx errors in the gateway during 2 periods of 1 minute.

I’ve tried the following code but it’s not working:

Even thee alert is deployed, the data is not displayed.
Doing some tests I’ve noticed that apparently the unit “percent” is not accepted for this alarm.

Does anyone have an example in terraform or cloudformation on how to configure this type of alarms?

Answer:

Based on the information provided in the comments by Marcin, I’ve found this info in the aws documentation:

The Average statistic represents the 5XXError error rate, namely, the total count of the 5XXError errors divided by the total number of requests during the period. The denominator corresponds to the Count metric (below).

My alarm configured in terraform looks as follow:

Leave a Reply