Amazon EC2 Auto Scaling Integration

Amazon EC2 Auto Scaling sends notifications of scale changing events through SNS. Amazon EC2 is a web service that provides automatic increases or decreases in the number of EC2 instances within an application's architecture.

​What does Opsgenie offer Amazon Auto Scaling users?

Amazon Auto Scaling sends notifications of scale changing events through SNS. Opsgenie acts as a dispatcher for these notifications, determines the right people to notify based on on-call schedules– notifies them via email, text messages (SMS), phone calls and iPhone & Android push notifications, and escalates alerts until the alert is acknowledged or closed.

Functionality of the integration

When an alert is created in Amazon EC2 Auto Scaling, an alert is created in Opsgenie automatically through the integration.

Add Amazon EC2 Auto Scaling Integration in Opsgenie

  1. Please create an Opsgenie account if you haven't done so already.
  2. Go to Opsgenie Amazon EC2 Auto Scaling Integration page.

🚧

For Free and Essentials plans, you can only add the integrations from the Team Dashboards, please use the alternative instructions given below to add this integration.

  1. Specify who is notified of Auto Scaling alerts using the Teams field. Auto-complete suggestions are provided as you type.

📘

An alternative for Step 2) and Step 3) is to add the integration from the Team Dashboard of the team which will own the integration. To add an integration directly to a team, navigate to the Team Dashboard and open Integrations tab. Click Add Integration and select the integration that you would like to add.

  1. Copy the integration URL which includes Opsgenie endpoint as well as the API key.
  2. Click Save Integration.
2292

Setup Subscription on Amazon EC2 Auto Scaling

  1. Create an SNS topic.
527
  1. Add an HTTPS subscription to your topic with the Opsgenie API endpoint using the URL provided from Opsgenie Integration.
526

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

524
  1. Configure your Auto Scaling group to send notifications to the SNS topic you created.
1199
  1. Right after the notifications configuration is saved, Auto Scaling sends a test notification to Opsgenie that creates an alert.

Sample payload sent from Amazon EC2 Auto Scaling

Create Alert payload:

{
  "Type": "Notification",
  "MessageId": "1cf7a0eb-4179-4181-b15b-ea22c5aa0280",
  "TopicArn": "arn:aws:sns:us-east-1:3779xxxxxx:otoSkeyl",
  "Subject": "Auto Scaling: test notification for group \"otoskeylGroup\"",
  "Message": {
    "StatusCode": "InProgress",
    "Service": "AWS Auto Scaling",
    "AutoScalingGroupName": "otoskeylGroup",
    "Description": "Launching a new EC2 instance: i-257654cf",
    "ActivityId": "a1920e24-523b-4d71-8abb-c93704c4a01c",
    "Event": "autoscaling:EC2_INSTANCE_LAUNCH",
    "Details": {
      "Availability Zone": "us-east-1d"
    },
    "AutoScalingGroupARN": "arn:aws:autoscaling:us-east-1:37797zxxxxx:autoScalingGroup:59016df3-65d4-4d06-95ba-xxxxxx0:autoScalingGroupName/otoskeylGroup",
    "Progress": 50,
    "Time": "2014-12-01T12:30:12.513Z",
    "AccountId": "377976xxxxx",
    "RequestId": "a1920e24-523b-4d71-8abb-c93704c4a01c",
    "StatusMessage": "statusmesic",
    "EndTime": "2014-12-01T12:30:12.513Z",
    "EC2InstanceId": "i-257654cf",
    "StartTime": "2014-12-01T12:29:38.644Z",
    "Cause": "At 2014-12-01T12:29:29Z a user request update of AutoScalingGroup constraints to min: 1, max: 2, desired: 2 changing the desired capacity from 1 to 2.  At 2014-12-01T12:29:37Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 1 to 2."
  },
  "Timestamp": "2014-12-01T09:48:46.429Z",
  "SignatureVersion": "1",
  "Signature": "XrsO2wtE0b+xxxxxx1fMuv07uRttlimTUg+rV4U9RmNSSBEdlmyWvtGgpjebsmNv1wkjUsBQOJZjZnpZp5FBn6quAn3twNdRMmMLf15lv6ESbYF8xxxxxxxxxjj/ZLwiH9Pr/cxVYOR0aPQBPDwTYn8w6g=",
  "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfxxxxxxxxxx",
  "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:089311xxxxx:CloudWatchHTTPAlarms:1841c5ca-ddda-450e-bbfb-xxxxxxx"
}

This payload is parsed by Opsgenie as:

{
  "AutoScalingGroupName": "otoskeylGroup",
  "Service": "AWS Auto Scaling",
  "Time": "2014-12-01T12:30:12.513Z",
  "AccountId": "37797xxxxxx",
  "Event": "autoscaling:EC2_INSTANCE_LAUNCH",
  "RequestId": "a1920e24-523b-4d71-8abb-c93704c4a01c",
  "AutoScalingGroupARN": "arn:aws:autoscaling:us-east-1:377976xxxxxxx:autoScalingGroup:xxxxxx-65d4-4d06-95ba-93403737f3d0:autoScalingGroupName/otoskeylGroup",
  "StatusCode": "InProgress",
  "Description": "Launching a new EC2 instance: i-257654cf",
  "ActivityId": "a1920e24-523b-4d71-8abb-c93704c4a01c",
  "Progress": 50,
  "StatusMessage": "statusmesic",
  "EndTime": "2014-12-01T12:30:12.513Z",
  "EC2InstanceId": "i-257654cf",
  "StartTime": "2014-12-01T12:29:38.644Z",
  "Details": {
    "Availability Zone": "us-east-1d"
  }
}