Send AWS Cloudwatch Alarm to Slack using AWS Lambda.
Note: If you want solution in node runtime. You may check this solution: https://github.com/widdix/cloudwatch-alarm-to-slack
→ Lambda Configs
Clone the repository, go to repository folder and use following commands to create lambda package:
pip install requests -t ./ chmod -R 755 . zip -r ../myDeploymentPackage.zip .
Note: We have do this because we're using 3rd party package "requests" which doesn't come with python lambda runtime. So we have to include it in our package.
→ AWS Configs
- Create SNS Topic.
- Setup AWS Cloudwatch Alarm on your required matrics and set SNS topic as the SNS Topic created in previous step.
- Create Lambda function.
- Upload Lambda deployment package to lambda function.
- Setup Lambda environment variable "SLACK_WEBHOOK_URL" and set it to your incoming slack webhook url.
- Create subscriber on SNS topic as lambda function and select the lambda created in previous step.
→ Slack Configs
- Create slack channel.
- Go to slack workspace settings and setup incoming webhook.
- Select the channel created in first step for incoming webhook.
- And boom, you should start receiving your alarm notifications on slack channel.
Licensed Under GPL 2.0.