Automating AWS monitoring with Slack
How to have AWS metrics displayed in Slack with a simple Slack Command
Requirements:
- AWS console access
- AWS IAM user with Cloudwatch read access
- AWS IAM user with read’/write to S3, Lambda, API Gateway
- Admin access to Slack workspace
Basic steps:
- Create Lambda to pull metric images from Cloudwatch using Flask backend to handle Slack POST requests
- Deploy Lambda using Zappa to automatically create Lambda and API Gateway
- Hook API Gateway into Slack slash command
Background
My work as production support involves a lot more staring at AWS Cloudwatch graphs than I would have thought. As anyone who has worked with AWS knows, it can be a pain to constantly open the AWS console, especially if you just want to check something simple like the current number of instances online. The more I logged into AWS, the more I thought that there had to be a better method for getting simple information from AWS than this, especially about being able to automatically share updated data with other who may not have access to AWS.
Here is an example of the final product