• Products
  • Get started
  • Documentation
  • Resources

Integrate Opsgenie with Amazon CloudWatch

CloudWatch metrics play a critical role in the monitoring of the applications running on AWS cloud.

Watch the video: Integrating Opsgenie and AWS CloudWatch.

What does Opsgenie offer CloudWatch users?

A CloudWatch alarm watches a single metric over a specified time period and executes automated actions based on the value of the watched metric and given threshold. Opsgenie acts as a dispatcher for these alarms, determines the right people to notify based on on-call schedules– notifies them using email, text messages (SMS), phone calls and iPhone & Android push notifications, and escalates alerts until the alert is acknowledged or closed. CloudWatch detects problems and Opsgenie ensures the right people are working on them.

Functionality of the integration

  • When an alert is created in CloudWatch, an alert is created in Opsgenie automatically through the integration.

  • When alert is closed in CloudWatch, related alert is closed in Opsgenie automatically through the integration.

Add CloudWatch Integration in Opsgenie

You can add this integration from your team dashboard

If you're using Opsgenie's Free or Essentials plan, or if you’re using Opsgenie with Jira Service Management's Standard plan, you can only add this integration from your team dashboard as the Integrations page under Settings is not available in your plan.

Adding the integration from your team dashboard will make your team the owner of the integration. This means Opsgenie will assign the alerts received through this integration to your team only.

To do that,

  1. Go to your team’s dashboard from Teams,

  2. Select Integrations, and select Add integration.

Follow the rest of the steps to complete the integration.

  1. Go to Settings > Integrations. Search for CloudWatch and select Add

  2. Specify who is notified of CloudWatch alerts using the Responders field. Autocomplete suggestions are provided as you type.

  3. Copy the integration URL.

  4. Select Save Integration.

Set up Alarms on CloudWatch

  1. Create an SNS topic with the name Opsgenie.

CloudWatch SNS Topic

2. Add an HTTPS subscription to the topic with the Opsgenie API endpoint. Use the URL provided from Opsgenie’s Integration page for CloudWatch (as shown below).


CloudWatch create subscription

Upon successfully configuring SNS subscription to Opsgenie a confirmation alert is created in Opsgenie:

CloudWatch confirmation alert

3. Create a CloudWatch alarm with any metric and select the SNS topic as the action.

CloudWatch alarm actions

Make sure the Alarm Name on CloudWatch includes resource and metric names for uniqueness and ease of readability : Sample : SQS Queue chat_webhook messageCount Too High
Make sure that notifications are sent for all of the states ALARM, OK and INSUFFICIENT to Opsgenie. Notifications with state ALARM create alerts, and notifications with states OK and INSUFFICIENT close the matching alerts by default.

By default the Opsgenie Integration creates alias for each alert by using Region - AlarmName, this way Opsgenie uniquely identifies each CloudWatch alarm, creates, and closes them respectively.

Test Alerts

  1. After setting up Notifications for an alarm on CloudWatch, for testing purposes modify the threshold of the alarm on CloudWatch so that it creates an alarm.

  2. When the alarm condition is met, AWS CloudWatch passes alarm details to Opsgenie, and Opsgenie notifies the specified users (recipients parameter) based on the recipients’ notification preferences. The Opsgenie alert contains all the relevant information provided by CloudWatch.

CloudWatch alert details

3. Make sure to revert the CloudWatch alarm threshold configuration back after testing is completed with CloudWatch.

Sample payload sent from CloudWatch

Create Alert payload:


1 2 3 4 5 6 7 8 9 10 11 12 { "Type": "Notification", "MessageId": "1cf7a0eb-4179-4181-b15b-ea22c5aa0280", "TopicArn": "arn:aws:sns:us-east-1:08931xxxxxx:CloudWatchHTTPAlarms", "Subject": "ALARM: \"cpuUtilTest\" in US - N. Virginia", "Message": "{\"AlarmName\":\"cpuUtilTest\",\"AlarmDescription\":\"testing alarms for cpu utilization\",\"AWSAccountId\":\"08931xxxxxx\",\"NewStateValue\":\"ALARM\",\"OldStateValue\":\"OK\",\"NewStateReason\":\"Threshold Crossed: 1 datapoint (5.199) was greater than or equal to the threshold (5.0).\",\"StateChangeTime\":\"2012-08-05T22:31:25.524+0000\",\"Region\":\"US - N. Virginia\",\"Trigger\":{\"MetricName\":\"CPUUtilization\",\"Namespace\":\"AWS/EC2\",\"Statistic\":\"AVERAGE\",\"Unit\":null,\"Dimensions\":[{\"name\":\"InstanceId\",\"value\":\"i-39e64c5f\"}],\"Period\":900,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanOrEqualToThreshold\",\"Threshold\":5.0}}", "Timestamp": "2012-08-05T22:31:30.673Z", "SignatureVersion": "1", "Signature": "XrsO2wtE0b+ofOl1ZxxxxxxxxlimTUg+rV4U9RmNSSBEdlmyWvtGgpjebsmNv1wkjUsBQOJZjZnpZp5FBn6quAn3twNdRMmMLf15lv6ESbYFxxxxxxxx0vmjj/ZLwiH9Pr/cxVYxxxxxxxYn8w6g=", "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c72xxxxxxxxx6de52f.pem", "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:08931xxxxxxxx:CloudWatchHTTPAlarms:1841c5ca-ddda-450e-bbfb-xxxxxxxxx" }

This payload is parsed by Opsgenie as:


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 { "TopicArn": "arn:aws:sns:us-east-1:08931xxxxxxx:CloudWatchHTTPAlarms", "AlarmName": "cpuUtilTest", "Subject": "ALARM: \"cpuUtilTest\" in US - N. Virginia", "AlarmDescription": "testing alarms for cpu utilization", "NewStateReason": "Threshold Crossed: 1 datapoint (5.199) was greater than or equal to the threshold (5.0).", "NewStateValue": "ALARM", "OldStateValue": "OK", "StateChangeTime": "2012-08-05T22:31:25.524+0000", "Region": "US - N. Virginia", "Trigger": { "MetricName": "CPUUtilization", "Namespace": "AWS/EC2", "Statistic": "AVERAGE", "Unit": null, "Dimensions": [ { "name": "InstanceId", "value": "i-39e64c5f" } ], "Period": 900, "EvaluationPeriods": 1, "ComparisonOperator": "GreaterThanOrEqualToThreshold", "Threshold": 5 } }

Our AWS CloudWatch Integration was updated on December 8, 2015 to cover CloudWatch events with an INSUFFICIENT state. After this update, by default, events with state ALARM result in creating alerts and events with states OK and INSUFFICIENT result in closing the matching alerts by default after this update. Therefore, please make sure that CloudWatch events that are directed to Opsgenie also includes the state INSUFFICIENT.

If using advanced settings for the AWS CloudWatch integration, set up the filtering condition rules as follows to make the AWS CloudWatch integration works as described above:

  • The filtering rule for Create Alert to be matched if NewStateValue is ALARM.

  • The filtering rule for Close Alert to be matched if NewStateValue is not ALARM. *

Additional Help