SNS2IFTTT is a sample AWS Lambda function to push EC2 Auto Scaling notifications to IFTTT via the Maker channel.

You can choose what Action you want to do on IFTTT, for example: 1. iOS or Android Notifications to receive it on your mobile (you need the IF app from IFTTT installed on the device) 2. 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 3. Slack to send a message to your team 4. Trello to create a new card

You can find AutoScaling2IFTTT in its GitHub repository.

Fork me on GitHub

Installation

On IFTTT

  1. Go to https://ifttt.com/maker and write down your secret key

On AWS

  1. Create a new Amazon SNS topic, e.g. autoscaling
  2. Configure the Auto Scaling group to send notifications to the SNS topic created at the previous step
  3. Create a new AWS Lambda function, e.g. autoscaling-2-ifttt
  4. Use Node.js as runtime
  5. Paste the code inline from the index.js file included in this repository
  6. Replace the iftttMakerSecretKey with the one you wrote down at step 1
  7. (Optional) Replace the iftttMakerBaseEventName with the one you want to use
  8. Leave the default handler
  9. Use a basic execution role
  10. Leave the default memory (128MB) and timeout (3s)
  11. Add SNS as an event source to the Lambda function
  12. Choose the SNS topic created at step 1
  13. 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
  1. Select My Recipes
  2. Create a Recipes
  3. Choose Maker as Trigger (‘this’)
  4. Select Receive a Web Request
  5. Write the Event Name exacly as the concatenation of:
    • the iftttMakerBaseEventName variable 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 be autoscaling_web_EC2_INSTANCE_LAUNCH
  6. Select Create Trigger
  7. Value1 contains the Auto Scaling group name
  8. Value2 contains the Notification type as in the table above
  9. Choose whatever you want as Action (‘that’), for example:
  10. 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
  11. 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
  12. Slack to send a message to your team
  13. Trello to create a new card

Contribute

Please give me your feedback and fork the repository on GitHub.