You need to setup an AWS SNS HTTPS endpoint for this integration!
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.
- Visit https://console.aws.amazon.com/sns/?region=us-east-1
- Click on the Topics link on the left
- Select the topic that you created for marbot
- Click on the Actions button, where you click on the Edit topic policy link.
- 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:
If you see the default entry, go to the next step. Otherwise, replace it with this policy:
- Replace ARN with your SNS topic ARN that you created for marbot.
- Replace ACCOUNT_ID with your AWS Account ID.
- Click on the Update policy button to save the policy.
Now, AWS is allowed to send messages to your topic.
You need an existing Auto Scaling Group for this example to work!
- Visit https://console.aws.amazon.com/ec2/autoscaling/home?region=us-east-1
- Click on the Auto Scaling Groups link on the left
- Select the Auto Scaling Group you want to monitor
- Select the Notifications tab
- Click on the Create notification button
- Set Send a notification to the marbot SNS topic
- In Whenever instances, select the events you are interested in
- Save by clicking the Save button.
When an EC2 instance is started, e.g. because you increase the desired capacity manually, you should receive an alert in Slack: