Get notified in Slack when changes to your Cloud Formation stack are made.
Switch branches/tags
Nothing to show
Clone or download
akash1810 Merge pull request #7 from obazoud/patch-2
Fix slack.py indentation
Latest commit 473e145 Mar 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore initial commit Nov 9, 2015
README.md added aws cli profile Mar 1, 2017
cf-notify.json add support for multiple stacks pushing to custom channels Mar 14, 2017
deploy.sh Fix slack.py indentation Jul 10, 2017
example.jpeg initial commit Nov 9, 2015
lambda_notify.py New AWS Region in France (Paris - eu-west-3) Jan 18, 2018

README.md

CF Notify

What?

An AWS Lambda function that will post Cloud Formation status updates to a Slack channel via a Slack Web Hook.

Why?

To give visibility of Cloud Formation changes to the whole team in a quick and simple manner. For example:

example Slack messages

How?

CF Notify has a stack of AWS resources consisting of:

  • An SNS Topic
  • A Lambda function, which uses the SNS Topic as an event source
  • An IAM Role to execute the Lambda function

We add the SNS Topic of CF Notify to the notification ARNs of the Stack we want to monitor. Search for NotificationARNs.member.N here for more information on notification ARNs.

Setup

To setup CF Notify, we need to do the following.

Prerequisites

Slack incoming webhook

You can create an incoming webhook here.

Deploy Lambda

This is done using the script deploy.sh.

./deploy.sh $CHANNEL $WEBHOOK $AWS_PROFILE

Where:

  • CHANNEL is the Slack channel or user to send messages to. It will be used in the naming of the Lambda artifact file stored in S3.
  • WEBHOOK is the Web Hook URL of an Incoming Web Hook (see https://api.slack.com/incoming-webhooks).
  • AWS_PROFILE is the aws cli profile you want to use for deploy. Default profile is "default"

deploy.sh will create a zip file and upload it to S3 and also create a cloud formation stack using the template.

Usage

Once setup is complete, all you need to do now is set the notification ARN when you update any Cloud Formation stack:

SNS_ARN=`aws cloudformation describe-stacks --stack-name cf-notify-$CHANNEL | jq ".Stacks[].Outputs[].OutputValue"  | tr -d '"'`

aws cloudformation [create-stack|update-stack|delete-stack] --notification-arns $SNS_ARN

You should now see messages in Slack!