Setup integration: AWS Auto Scaling Notification

You need to setup an AWS SNS HTTPS endpoint for this integration!

This integration requires marbot  plus

AWS Auto Scaling is a way to manage a dynamic fleet of EC2 instances. The Auto Scaling Group will keep the number of running instances in sync with the desired value. While the desired value stays in a boundary defined by min and max instances. AWS Auto Scaling Notifications are triggered on:

  • Successful instance launch
  • Failed instance launch
  • Successful instance termination
  • Failed instance termination

Depending on your use case you might only be interested in failures.

Allowing AWS to send messages to your topic

  1. Visit https://console.aws.amazon.com/sns/?region=us-east-1
  2. Click on the Topics link on the left
  3. Select the topic that you created for marbot
  4. Click on the Actions button, where you click on the Edit topic policy link.
    Edit SNS topic policy
  5. Select the Advanced view tab

If this is the first time you edit the SNS topic policy, you should see a default entry like this:

{
"Version": "2008-10-17",
"Id": "__default_policy_ID",
"Statement": [
{
"Sid": "__default_statement_ID",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
[...TRUNCATED...]
}
]
}

If you see the default entry, go to the next step. Otherwise, replace it with this policy:

{
"Version": "2008-10-17",
"Id": "__default_policy_ID",
"Statement": [
{
"Sid": "__default_statement_ID",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": [
"SNS:GetTopicAttributes",
"SNS:SetTopicAttributes",
"SNS:AddPermission",
"SNS:RemovePermission",
"SNS:DeleteTopic",
"SNS:Subscribe",
"SNS:ListSubscriptionsByTopic",
"SNS:Publish",
"SNS:Receive"
],
"Resource": "ARN",
"Condition": {
"StringEquals": {
"AWS:SourceOwner": "ACCOUNT_ID"
}
}
}
]
}
  1. Replace ARN with your SNS topic ARN that you created for marbot.
  2. Replace ACCOUNT_ID with your AWS Account ID.
  3. Click on the Update policy button to save the policy.

Save SNS topic policy

Now, AWS is allowed to send messages to your topic.

Monitoring an Auto Scaling Group

You need an existing Auto Scaling Group for this example to work!

  1. Visit https://console.aws.amazon.com/ec2/autoscaling/home?region=us-east-1
  2. Click on the Auto Scaling Groups link on the left
  3. Select the Auto Scaling Group you want to monitor
  4. Select the Notifications tab
    Select the Notifications tab
  5. Click on the Create notification button
  6. Set Send a notification to the marbot SNS topic
  7. In Whenever instances, select the events you are interested in
  8. Save by clicking the Save button.
    Create notification

Sample Alert

When an EC2 instance is started, e.g. because you increase the desired capacity manually, you should receive an alert in Slack:

Auto Scaling Alert