AutoScaling2IFTTT
AutoScaling2IFTTT copied to clipboard
A sample AWS Lambda function to push EC2 Auto Scaling notifications to IFTTT via the Maker channel
AutoScaling2IFTTT
A sample AWS Lambda function to push EC2 Auto Scaling notifications to IFTTT via the Maker channel.
License
Copyright (c) 2015 Danilo Poccia, http://danilop.net
This code is licensed under the The MIT License (MIT). Please see the LICENSE file that accompanies this project for the terms of use.
Installation
On IFTTT
- Go to https://ifttt.com/maker and write down your secret key
On AWS
- Create a new Amazon SNS topic, e.g.
autoscaling - Configure the Auto Scaling group to send notifications to the SNS topic created at the previous step
- Create a new AWS Lambda function, e.g.
autoscaling-2-ifttt - Use Node.js as runtime
- Paste the code inline from the
index.jsfile included in this repository - Replace the
iftttMakerSecretKeywith the one you wrote down at step 1 - (Optional) Replace the
iftttMakerBaseEventNamewith the one you want to use - Leave the default handler
- Use a basic execution role
- Leave the default memory (128MB) and timeout (3s)
- Add SNS as an event source to the Lambda function
- Choose the SNS topic created at step 1
- In the options, enable the event source now (not later)
On IFTTT
You can create a recipe for any event you want to monitor from IFTTT:
| Notification type | Event |
|---|---|
| EC2_INSTANCE_LAUNCH | Successful instance launch |
| EC2_INSTANCE_LAUNCH_ERROR | Failed instance launch |
| EC2_INSTANCE_TERMINATE | Successful instance termination |
| EC2_INSTANCE_TERMINATE_ERROR | Failed instance termination |
- Select My Recipes
- Create a Recipes
- Choose Maker as Trigger ('this')
- Select Receive a Web Request
- Write the Event Name exacly as the concatenation of:
- the
iftttMakerBaseEventNamevariable of the Lambda function (step 4.4 on AWS) - the underscore character (
_) - the Auto Scaling group name
- the underscore character (
_) - the Notification type as in the table above (you can find more info on Auto Scaling notifications here)
- for exaple, if you leave the default
iftttMakerBaseEventName('autoscaling'), to monitor new instance launches on an Auto Scaling group named 'web' the Event Name to use would beautoscaling_web_EC2_INSTANCE_LAUNCH
- Select Create Trigger
Value1contains the Auto Scaling group nameValue2contains the Notification type as in the table above- Choose whatever you want as Action ('that'), for example:
- iOS or Android Notifications to receive it on your mobile (you need the IF app from IFTTT installed on the device), e.g. you can set the notification to
Auto Scaling {{Value1}} {{Value2}} - A Channel from the Connected Home category to have a visible effect, e.g. Philips Hue to change the color of your lights to green when scaling up, yellow when scaling down, red in case of errors
- Slack to send a message to your team
- Trello to create a new card
Feedback
Please give me your feedback here.