Skip to content

Send an AWS CloudWatch Alarm to Slack via SNS + Webhook

License

Notifications You must be signed in to change notification settings

nitrag/slack-sns

Repository files navigation

Slack App: Amazon CloudWatch SNS (HTTPS)

This Slack app automation will provide a Webhook (HTTPS URL) which you can configure an AWS SNS (Topic Subscription). Allowing Cloudwatch Alarms to be posted to your Slack Channel in a human readable format.

Please note that the features in this project requires that the workspace be part of a Slack paid plan.

PRs welcome!


Preview: slack-cloudwatch-sns-preview

Install the Slack CLI

To use this sample, you need to install and configure the Slack CLI. Step-by-step instructions can be found in our Quickstart Guide.

Deployment

Start by cloning this repository:

# Install the Slack CLI and login
slack login

# Create the App for your organization
slack create CloudWatch-SNS

# Register the trigger (Required?)
slack trigger create --trigger-def "./triggers/webhook_trigger.ts"

# If you want to test locally:
#  1) create an `.env` file
#  2) Fill in the appropriate values for Channel ID and AWS Region
slack run

# Deploy and receive your webhook URL
slack deploy

# Register your CHANNEL_ID to send the notification to
slack env add CHANNEL_ID C00X00XXXXX

# At this point you can plug the webhook into Topic Subscription,
# this integration will auto-confirm the subscription if setup correctly.