Set up Amazon CloudWatch synthetics canary and Amazon CloudWatch alarm - DevOps Monitoring Dashboard on AWS

Set up Amazon CloudWatch synthetics canary and Amazon CloudWatch alarm

You can use the solution to monitor the MTTR metrics of your REST API. To do so, you can choose one of the following two ways to set up Amazon CloudWatch Synthetics canary and its Amazon CloudWatch Alarm. The goal is to create an Amazon CloudWatch alarm that monitors the state (success or failure) of a new or existing canary job. Whenever the canary job state changes, it invokes the alarm. This will generate events that are needed for calculating MTTR metrics.

  1. (Recommended) Automated setup:

    • This solution provides a canary-alarm.template that you can deploy to create an Amazon CloudWatch alarm and/or canary into your AWS account where you deployed the main AWS CloudFormation template.

  2. Manual setup

    • If you don’t have a canary, sign in to the AWS Management Console and create a canary. To create a canary, refer to Creating a canary in the Amazon CloudWatch User guide to create one. If you have already created one, skip to the next step.

    • To create an alarm, refer to Create a CloudWatch Alarm Based on Static Threshold in the Amazon CloudWatch User Guide When you reach the select metrics step, make sure you select CloudWatchSynthetics metrics, your canary and SuccessPercent metric as shown below.

      • Select CloudWatchSynthetics metrics for the alarm.

      All metrics tab

      Select CloudWatchSynthetics metrics

      • From the All metrics tab, select By Canary and then select your canary and SuccessPercent metric name.

      Select your canary

      Select your canary and SuccessPercent metric

      • Name the alarm SO0143-[my-application-name]-[my-repository-name]-MTTR. For example, SO0143-[MyDemoApplication]-[MyDemoRepo]-MTTR. SO0143 is the solution ID. Application name is the name of the application that your canary monitors and repository name is the name of the repository where the source code for your application resides. This solution uses alarm name to determine if an alarm is used for MTTR metrics and what application and repository are associated with the metrics.

      • Under Conditions of the alarm, leave threshold type as Static and choose whenever SuccessPercent is Lower than 100 or enter a threshold value that fits your use case.

      • For an example of the alarm, refer to the following figure.

        Alarm example

        Alarm example