Amazon CloudWatch
User Guide

Create a Load Balancer Latency Alarm that Sends Email

This scenario demonstrates how to set up an Amazon SNS notification and configure an alarm that monitors latency exceeding 100 ms for your Classic Load Balancer.

Set Up a Latency Alarm Using the AWS Management Console

To create a load balancer latency alarm that sends email

  1. Open the CloudWatch console at

  2. In the navigation pane, choose Alarms.

  3. Choose Create Alarm.

  4. Under CloudWatch Metrics by Category, select the ELB Metrics category.

  5. Select the row with the Classic Load Balancer and the Latency metric.

  6. For the statistic, choose Average.

  7. For the period, choose 1 Minute.

  8. Choose Next.

  9. Under Alarm Threshold, type a unique name for the alarm (for example, myHighCpuAlarm) and a description of the alarm (for example, Alarm when Latency exceeds 100s).

  10. Under Whenever, for is, select > and type 0.1. For for, type 3.

  11. Under Actions, for Whenever this alarm, choose State is ALARM. For Send notification to choose an existing SNS topic or create a new one.

    To create an SNS topic, choose New list. For Send notification to, type a name for the SNS topic (for example, myHighCpuAlarm), and for Email list, type a comma-separated list of email addresses to be notified when the alarm changes to the ALARM state. Each email address will be sent a topic subscription confirmation email. You must confirm the subscription before notifications can be sent.

  12. Choose Create Alarm.

Set Up a Latency Alarm Using the AWS CLI

To create a load balancer latency alarm that sends email

  1. Set up an SNS topic. For more information, see Set Up Amazon SNS Notifications

  2. Create the alarm using the put-metric-alarm command as follows:

    aws cloudwatch put-metric-alarm --alarm-name lb-mon --alarm-description "Alarm when Latency exceeds 100s" --metric-name Latency --namespace AWS/ELB --statistic Average --period 60 --threshold 100 --comparison-operator GreaterThanThreshold --dimensions Name=LoadBalancerName,Value=my-server --evaluation-periods 3 --alarm-actions arn:aws:sns:us-east-1:111122223333:my-topic --unit Seconds
  3. Test the alarm by forcing an alarm state change using the set-alarm-state command.

    1. Change the alarm state from INSUFFICIENT_DATA to OK:

      aws cloudwatch set-alarm-state --alarm-name lb-mon --state-reason "initializing" --state-value OK
    2. Change the alarm state from OK to ALARM:

      aws cloudwatch set-alarm-state --alarm-name lb-mon --state-reason "initializing" --state-value ALARM
    3. Check that you have received an email notification about the alarm.