I have a AWS lambda function that does some processing, sometimes the processing fails due to problems with another 3rd party service going down. Sometimes it fails due to bad inputs.
I want to be informed when the 3rd party service has gone down. Bad inputs failures are rare & sporadic and don't need to cause alerts.
When the 3rd party service goes down the lamdba will fail every consecutive execution this is when I want a cloudwatch alarm to go off.
The lambda function is called an unknown number of times per hour and at unpredictable intervals (it depends on how many users are logged in and when they are logged in)
I was planning on creating a custom metric which tracks the success / failure state of the lambda (1
for failure, 0
for success) each time the lambda is run. (Perhaps there is a pre-created metric for this?)
My question is: is it possible to create a cloudwatch alarm to alert if there are 5 consecutive failures (1
s) on my lambda failure metric?