Quick Tutorial: How to Manually Test an AWS CloudWatch Alarm Without Triggering It

At times, you may have set up a CloudWatch alarm that you don’t want to trigger, but you still need to ensure that the actions tied to it function correctly. This tutorial will guide you through a simple command to test your CloudWatch alarm manually without actually setting it off.


Step-by-Step:

  1. Access the CloudWatch Dashboard: Begin by navigating to your CloudWatch dashboard. For this example, let’s consider you have an S3 size alarm that triggers when a specific bucket reaches a large size. Instead of populating the bucket with a massive amount of files to trigger the alarm, there’s a more straightforward way to test this alarm.
  2. Use the AWS Command Line Tool: Head over to your AWS command line tool.
  3. Enter the Set Alarm State Command: The AWS command line tool has a set-alarm-state command. This command requires three parameters:
    • An alarm name

    • A state value (set this to “alarm” to trigger the alarm without any actual event)

    • A state reason
  4. The command will look something like this:
aws cloudwatch set-alarm-state --alarm-name "YOUR_ALARM_NAME" --state-value ALARM --state-reason "Testing the alarm manually"
  1. Observe the Alarm State: After running the command, you’ll notice that your CloudWatch alarm enters the “ALARM” state. This allows you to observe any actions or other functionalities you’ve linked to this alarm.
  2. Return to the OK State: Don’t worry about the alarm staying in the “ALARM” state. It will revert to the “OK” state after the next scheduled check of that CloudWatch alarm.

Leave a Reply

Your email address will not be published. Required fields are marked *