100 Days of AWS — Day 12 — Integrating AWS Chatbot with Slack- ChatOps for AWS

Prashant Lakhera
4 min readApr 15, 2022

To view the complete course, please enroll it using the below link(it’s free)

https://www.101daysofdevops.com/courses/100-days-of-aws/

Welcome to Day 12 of 100 Days of AWS. The topic for today is using Integrating AWS Chatbot with Slack- ChatOps for AWS

In the current DevOps world, teams rely on communication channels like chat rooms to interact with team members and the system they operate. This is done with the help of bots that help facilitate the interaction and deliver important notifications and are sometimes used to relay commands back to the server.

AWS provides a service, AWS Chatbot, which helps the DevOps team to receive notifications and execute commands. Currently, it supports:

  • Slack
  • Amazon Chime

It takes minimum effort to set up, and AWS fully manages the integration. It supports receiving notifications from the following services:

  • Amazon CloudWatch
  • AWS Health
  • AWS Budgets
  • AWS Security Hub
  • Amazon GuardDuty
  • AWS CloudFormation

How it works

AWS Chatbot uses SNS to integrate with other AWS Services. The way it works, CloudWatch triggers an alarm that notifies the SNS topic, which activates Chatbot to notify the chat room.

Reference: https://aws.amazon.com/blogs/devops/introducing-aws-chatbot-chatops-for-aws/

These are the steps you need to follow in order to set it up

  • In the next screen click on configure channel
  • Give your configuration some name(my-test-chatbot), and select the slack channel(It can be a public or private channel). AWS Chatbot needs an IAM role to respond to interactive messages. Give your IAM role some name and select the policy template. I am selecting all that will generate the IAM role for you for this demo. For more info, check this link. Next step, select Channel guardrail policies, which provide detailed control of what actions your channels members can take. Finally, set up a notification to send event and alarm notifications to supported AWS services. Click on Configure.
  • One additional step you need to perform. go to the slack channel you configured in the previous step and invite the AWS app.
  • Under Graphed metrics, click the bell icon
  • Keep all the setting as default, select threshold as 10 i.e when CPU utilization goes more than 10% it will trigger an alarm.
  • In the next screen select an SNS topic, you have configured earlier. As you can SNS is now referring to chatbot endpoint.
  • Give your alarm some name
  • In the next screen review all the configuration and select Create alarm
  • For the purpose of this demo, let’s install stress rpm on server
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
  • In order to generate load on server, run the below command. Stress command will spawn 6 workers spinning on sqrt() with a timeout of 60 seconds
sudo stress --cpu  6--timeout 60

--

--

Prashant Lakhera

AWS Community Builder, Ex-Redhat, Author, Blogger, YouTuber, RHCA, RHCDS, RHCE, Docker Certified,4XAWS, CCNA, MCP, Certified Jenkins, Terraform Certified, 1XGCP