How to set up alerts for your Lambdas
Published: 2019-10-21 12:01:07

---
title: How to set up alerts for your Lambdas
published: true
description: 
tags: 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yw1waoa7coiyxxe81h0p.jpg
---

In this article, we’ll make a brief introduction, and we’ll also talk about the differences between CloudWatch alerts vs. Dashbird alerts. Which one is better and why?

<h2>What Is Amazon CloudWatch Used For?  </h2>
Amazon CloudWatch is built for system operators, site reliability engineers (SRE), IT managers and developers as well. CloudWatch allows you to monitor your applications via data access and insights it provides. It can also recognize, understand and respond to all changes happening throughout the entire system. 

<a href="https://aws.amazon.com/cloudwatch/">CloudWatch</a> is also collecting monitoring and operational data through metrics, events, and logs which further provides you with a unique view over the AWS resources, services and apps that run on AWS as well as in the localized servers. CloudWatch enables you to set alarms (or alerts), troubleshoot for issues, and discover the insights for application optimization which will ensure that the application runs smooth.

<h2>  The CloudWatch Alerts Explained</h2>
<img src="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/images/monitoring_create_alarm.png">
A CloudWatch alert (a.k.a. alarm) can watch over a single CloudWatch metric or even a result of math expression found in CloudWatch metrics. 

Alerts will perform single or multiple actions based on the value of metric or expression which is relative to a threshold over a number of time periods. Adding alarms to CloudWatch dashboard is enabled and that way you’ll be able to monitor them visually. There are three alarm states:

* <strong>OK</strong> - meaning that the expression or metric is found inside the already defined threshold;
* <strong>ALARM</strong> - implies that the expression or metric are located outside of the specified threshold;
* <strong>INSUFFICIENT_DATA</strong> - this alert is shown when the alarm has already started but the metric is not available, or there’s not enough data for the metric to realize in which state the alarm is.

When creating an alarm, you are able to specify three settings which will allow CloudWatch to evaluate when to change the alarm state:

* <strong>Period</strong> - will enable you to evaluate the time length of metric or expression in order to create an individual data point for an alarm;
* <strong>Evaluation Period</strong> - is the number of the recent data points you need to evaluate to be able to determine the state of the alarm; 
* <strong>Datapoints to Alarm</strong> - is the number of data points in the evaluation period which must be breached, so it’s causing the alarm to go to the ALARM state. These breaching data points must all be within the last number of data points which is equal to the Evaluation Period. 

There are a lot of features that apply to all CloudWatch alarms, and we’ll go through some of them. For example, the number of evaluation periods for an alarm if multiplied by the length of every evaluation period can’t surpass the one day limit. Another feature worth mentioning is that ASCII characters must be included in alarm naming. You are also able to create 5000 alarms within every region per a single AWS account.

<h2>Dashbird Alerts Explained  </h2>
<img src="https://dashbird.io/images/docs/errors-teaser.png">
Dashbird’s instant alerting system will notify you if any issue shows up within any part of your application. Its system offers messages and realistic logs that can be easily read and understood by humans, which will save you and your company a lot of debugging time. 

Dashbird monitors your application and is able to detect all kinds of errors by using various programming languages. Dashbird’s instant alert system will alert you about crashes, timeouts, runtime errors, cold starts, early exits, and configuration errors. 

Dashbird interface also provides an option in the left navigation panel to press the “alert button” which will further take you to the alert page in the Dashbird app. There you have a showcase of all errors occurring in your system. 

Everything mentioned above works for programming languages that are supported by AWS Lambda which also includes Java, Python, C#, and Node.js.

All the needed data to successfully go through troubleshooting event and resolve any issues inside your application are entirely at your disposal. A human-friendly interface will present you with any previous occurrences, stack traces, logs and trends for every issue or error are also available. You can also use a “more info” button for every single error you face, and that way you’ll see the error page with all the needed info for debugging the current issue.

Pro-active alerts are another one of Dashbird’s features. Basically, you could set up an email notification alert system, so when your functions are about to reach memory limitations, you will be notified about it. Dashbird provides seamless integration with Slack as well. If you wish to read more about the Dashbird alerts and serverless monitoring tools, how it all works compared to other services, follow this link to our <a href="https://dashbird.io/blog/serverless-monitoring-tools-2018/">blog</a>.

As of January 2019, the new alerting system is out and with the new and improved design 
<h2>Conclusion</h2>

Both CloudWatch and Dashbird have their pros and cons, and we’ll wrap up here after mentioning a few. 

While Cloudwatch is mostly an excellent choice for users who are already inside the AWS ecosystem, it's right there the second you need it but as we established Cloudwatch can be difficult to work with. The alerting options for CloudWatch are not as boundless since they’re available with third-party services.

Cloudwatch doesn’t offer pre-configured alerts, but you need to create custom alerts on your own which further means you must be very familiar with how everything works in order to create them properly.

On the other hand, Dashbird’s alert notification system is automated and instant which surely provides you comfort and ease in case something happens within your application.

If you have any ideas, questions or thoughts, feel free to share them in our comment section below.