Metric Alarms

A metric alarm watches a single CloudWatch metric or the result of a math expression based on CloudWatch metrics. The alarm performs one or more actions based on the value of the metric or expression relative to a threshold over a number of time periods. The action can be an Amazon EC2 action, an Amazon EC2 Auto Scaling action, or a notification sent to an Amazon SNS topic.

Create a Metric Alarm

  1. In the AWS Management Console on the Services menu, click CloudWatch.
  2. In the left navigation menu, click on Alarms.
  3. Click the Create alarm button.
  4. Click Select metric.

This will take you to the Metrics home page, where you will see all the Namespaces available in the account.

  1. Select ContainerInsights or ECS/ContainerInsights namespace

Alarms

Inside the Namespace, you will see all the dimensions under which the metrics are aggregated under. 6. Select the ClusterName dimension and select one of the CPU Utilization metrics.

If you see pod_cpu_utilization, select that one.

Your screen should look similar to the one below.

Alarms2

  1. Click Select metric in the bottom right corner.

This will take you to the screen as the one below.

Alarms3

  1. Enter the threshold value (for example, 50 which means 50% CPU utlization because this metric is a percent type) that you want the metric data to be monitored. (Notice that Static option is selected by default, which means we will be setting a static value as the threshold to be monitored.)

  2. Expand Additional configuration where you can indicate how many occurences of the breach qualifies for the alarm to be triggered.

  3. Set the values to 2 out of 5.

This will make the alarm get triggered if there has been 2 breaches in 5 evaluation periods. Notice the message at the top of the graph describing the setting as This alarm will trigger when the blue line goes above the red line for 2 datapoints within 25 minutes.

  1. Click Next.
  • In the Configure actions screen, you can set what action you want to take when the alarm changes to different states such as

    • In alarm
    • OK
    • Insufficient data
  • The available options for actions include

    • Send a notification to an SNS topic
    • Take an Auto scaling action
    • EC2 action if the metric is from an EC2 instance
  1. Select Create a new topic to create a new SNS topic to send the notification to and provide your email address.

Alarms4

  1. Enter your email address into the field.
  2. Click Create topic to create the SNS topic.
  3. Click Next, then give the alarm a name and click Next again to review the configuration.
  4. Click Create to create the alarm.

Once you have created the alarm, you will notice that the alarm is now in Insufficient data state which indicates that there is not enough data to validate the alarm. Waiting for 5 minutes will change the alarm state to OK in green.

Alarms5

  1. Click on the alarm to see the alarm details as shown below.

Notice the alarm state now changed to ‘OK’ after evaluation was complete.

Alarms6

This concludes this section. You may continue on to the next section.