As part of our developing automation pipeline, we’re leveraging Amazon Simple Notification Services (SNS) to send notifications of job completion, failure, and other status messages. SNS provides topics to which endpoints can subscribe. Services can then post messages to these SNS topics for fanning out to all the various subscribers over a variety of different protocols. In our setup, we have two primary topics - one for CloudWatch alarms and one for all Data Pipeline notifications. CloudWatch alarms are primarily routed via PagerDuty while Data Pipeline messages go to a couple of different mailboxes in either plaintext or JSON format.

This was all well and good, but we’re working towards having a running stream of status messages, interesting data outputs, and other situational activity coming into our team’s Slack channel. While Slack has a very impressive suite of native integrations, the ability to natively subscribe and process Amazon SNS messages isn’t one of them. This necessitates some sort of intermediate service that can talk with both SNS and Slack. Enter Heroku!

The Slack-SNS Node.JS application on GitHub is a very simple and effective bridge between Slack and SNS. It does necessitate a Node.JS platform on which to run, however. This is something I didn’t have and which Amazon Lambda isn’t quite ready to fulfill. Heroku provides the perfect PaaS solution for this itch and the Slack-SNS app has instructions for deploying on Heroku. I did have to make a few minor updates to account for a change in the Slack webhook format (pull request is currently pending and should get merged soon). The full GitHub clone, push to Heroku, and test process took no more than 30-45 minutes. I’m not a JavaScript developer by any stretch of the imagination, but working with enough JSON files made it easy enough to hack on the code to account for the new Slack URL format.

The Slack-SNS app has some nice templates by which it can detect certain common types of SNS messages (CloudWatch alarms vs. plain text, for example) and provide custom formatting in Slack for the SNS type. I’ll eventually use this functionality to customize both the Slack message template as to make the Slack postings a bit more polished, but the solution works as is today and is effective at providing ticklers of process status without excessive amounts of email.