We all know it, we have created several CloudWatch alarms to monitor our application. If an alarm set  s off we get a wall of text and don’t really

Customize CloudWatch alarms with Lambda, SES, HTML, and CDK.

submited by
Style Pass
2021-07-14 19:30:12

We all know it, we have created several CloudWatch alarms to monitor our application. If an alarm set s off we get a wall of text and don’t really know what to do. To get the problem solved asap the first contact with the alarm has to be clear about what the problems and actions are. For that I always recommend getting rid of the default message and use a HTML template for giving the specific information the person who receives the alarm needs. The main benefit here is really to use a HTML template so that you can be flexible with which information you want to give. Typical use cases are links to some portals and monitoring systems. The final alarm we receive looks like that:

That’s it. Test your alarm either by invoking your lambda function 5 times or with the AWS CLI aws cloudwatch set-alarm-state --alarm-name ALARM_NAME --state-value ALARM --state-reason "Testing" . The alarm name is in the output after the deployment.

First of all, we create one lambda function for getting any metrics intro CloudWatch. I absolutely don’t recommend having the code inline but for the example it is fine.

Leave a Comment