Sep 17, 2018

How to setup an alarm when your Lambda fails

Go to your CloudWatch Console:
Click "Alarms" at the left, and then Create Alarm.
Click "Lambda Metrics".
Look for your Lambda name in the listing, and click on the checkbox for the row where the metric name is "Errors". Click "Next".
Enter a name and description for this alarm.
Setup the alarm to be triggered whenever "Errors" is above 0, for 1 consecutive period(s).
Select "Sum" as the Statistic and the amount of minutes that's reasonable for your use case in the "Period" dropdown.
In the "Notification" box, click the Select a notification list dropdown and select your new SNS endpoint.
Click "Create Alarm".

You will always know if your code reported an error when finished. The error could be because of an error in the code itself or because your website is down.