{"id":60764,"date":"2024-03-15T14:32:44","date_gmt":"2024-03-15T09:02:44","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=60764"},"modified":"2024-03-19T14:51:45","modified_gmt":"2024-03-19T09:21:45","slug":"send-cloudwatch-alarm-to-slack-via-aws-chatbot","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/send-cloudwatch-alarm-to-slack-via-aws-chatbot\/","title":{"rendered":"Send CloudWatch alarm to Slack via AWS Chatbot"},"content":{"rendered":"<h2><b>Introduction<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">One of the critical elements for production uptime is Monitoring and Alerts. Irrespective of the infrastructure types such as EC2 Servers, Serverless, containers, or microservices. There will always be observability needs.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are a lot of tools and software in this Observability market. However, this article focuses on cloud platform tools, such as <strong>AWS Cloudwatch<\/strong>.\u00a0<\/span><\/p>\n<h3><b>Objective<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">This article will help you to understand and configure AWS Cloudwatch to monitor applications efficiently. In this article, you will also see how\u00a0 to send Cloudwatch alarms to Slack using AWS Chatbot integration<\/span><\/p>\n<h3><b>Prerequisites<\/b><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">AWS Account<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Slack Channel<\/span><\/li>\n<\/ul>\n<h2><b>Steps by Step Procedure<\/b><\/h2>\n<h3><b>1. CloudWatch Alarm setup for ECS CPU Metric<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In your AWS console, visit <\/span><b>CloudWatch,<\/b><span style=\"font-weight: 400;\"> then to <\/span><b>Alarms<\/b><span style=\"font-weight: 400;\"> and click on <\/span><b>All-alarms<\/b><span style=\"font-weight: 400;\"> under the Alarms menu.<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60765 size-medium\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p1-300x294.png\" alt=\"\" width=\"300\" height=\"294\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p1-300x294.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p1-24x24.png 24w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p1-48x48.png 48w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p1.png 506w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After clicking on the <\/span><b>All-alarms<\/b><span style=\"font-weight: 400;\">, you will see a button on the top right named <\/span><b>Create Alarm<\/b><span style=\"font-weight: 400;\"> to create a new alarm. <\/span><span style=\"font-weight: 400;\">Click on <\/span><b>Create Alarm<\/b><span style=\"font-weight: 400;\"> and click on the <\/span><span style=\"font-weight: 400;\">Select Metric<\/span><span style=\"font-weight: 400;\"> button. Check the below image for reference.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60766 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-1024x313.png\" alt=\"\" width=\"625\" height=\"191\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-1024x313.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-300x92.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-768x235.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-1536x469.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2-624x191.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p2.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\">After you click the Select Metric button, you will be asked to fill in the metric of your choice &amp; metric conditions. Check the screenshot below for reference. <\/span><span style=\"font-weight: 400;\">Specify the Conditions as per the requirement, After specifying the conditions click on next to configure the SNS topic.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60767 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-1024x847.png\" alt=\"\" width=\"625\" height=\"517\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-1024x847.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-300x248.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-768x636.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-1536x1271.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3-624x516.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p3.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60768 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-1024x686.png\" alt=\"\" width=\"625\" height=\"419\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-1024x686.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-300x201.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-768x515.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-1536x1029.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4-624x418.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p4.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">In the Configure Actions screen, Choose the SNS Topic to receive a notification when an alarm triggers.\u00a0<\/span><span style=\"font-weight: 400;\">Either you can choose your existing SNS topic or Create a new topic.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60769 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-1024x612.png\" alt=\"\" width=\"625\" height=\"374\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-1024x612.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-300x179.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-768x459.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-1536x919.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5-624x373.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p5.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\">In my case, it is Cloudwatch-SNS-Topic.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Now the Cloud Watch Alarm is ready, Let\u2019s proceed to the Slack Integration with AWS Chatbot.<\/span><\/p>\n<h3><b>2. Creating AWS Chatbot and integration of SNS topic and Slack Channel<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">In the AWS console, Search\u00a0 and select AWS Chatbot and click on <\/span><span style=\"font-weight: 400;\">Configure New Client<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Once you click, you will see two options: Choose <\/span><span style=\"font-weight: 400;\">Slack<\/span><span style=\"font-weight: 400;\"> and <\/span><span style=\"font-weight: 400;\">Configure<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-60770 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6-1024x401.png\" alt=\"\" width=\"625\" height=\"245\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6-1024x401.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6-300x117.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6-768x301.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6-624x244.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p6.png 1206w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\">As you click the configure button, you will be redirected to a Slack authorization screen. <\/span><span style=\"font-weight: 400;\">If you are not already logged into Slack using the same browser, you will be asked to log in.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Once you have authorized it, you will be redirected to AWS, and you can see new <\/span><b>Configured Clients <\/b><span style=\"font-weight: 400;\">with your Slack Organization name.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-60771 size-large\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-1024x361.png\" alt=\"\" width=\"625\" height=\"220\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-1024x361.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-300x106.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-768x271.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-1536x541.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7-624x220.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p7.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Click on the <\/span><b>Configure new channel<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You Need to fill in the following items :\u00a0<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>Configuration name<\/b><span style=\"font-weight: 400;\">: Name for the Slack channel configuration<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Channel Type<\/b><span style=\"font-weight: 400;\">: Set channel type to be Public or Private<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Name of the Channel<\/b><span style=\"font-weight: 400;\">: Browse and select the channel where the alert should be sent.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Channel role<\/b><span style=\"font-weight: 400;\">: Leave this as the default. The AWS will create an IAM role.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Guardrail policy<\/b><span style=\"font-weight: 400;\">: Specify the minimal IAM Policy so that you can prevent Slack from connecting back to AWS. And even if it will limit the permission.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Notifications<\/b><span style=\"font-weight: 400;\"> \u2192 <\/span><b>SNS Topic<\/b><span style=\"font-weight: 400;\">: Choose the SNS topic where the chatbot would send alerts.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">After filling out the above details, click on the Configure button. You will now see the screen like this.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-60772 alignnone\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-1024x444.png\" alt=\"\" width=\"625\" height=\"271\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-1024x444.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-300x130.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-768x333.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-1536x666.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8-624x271.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p8.png 1600w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<h3><b>3. Add the AWS ChatBot App to the Slack Channel<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">Open the Slack channel, Goto Channel details tab, and <\/span><b>Add the AWS Chatbot app<\/b><span style=\"font-weight: 400;\"> using the <\/span><span style=\"font-weight: 400;\">Add Apps option<\/span><span style=\"font-weight: 400;\">.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the Search bar, input <\/span><b>AWS Chatbot<\/b><span style=\"font-weight: 400;\"> and choose the <\/span><b>AWS Chatbot<\/b><span style=\"font-weight: 400;\"> App, and click on <\/span><b>Add<\/b><\/p>\n<p><b><img decoding=\"async\" loading=\"lazy\" class=\"wp-image-60773 size-large alignnone\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-1024x430.png\" alt=\"\" width=\"625\" height=\"262\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-1024x430.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-300x126.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-768x323.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-1536x645.png 1536w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9-624x262.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p9.png 1576w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/b><\/p>\n<p><span style=\"font-weight: 400;\">A message will pop up saying, \u201c<strong>AWS app was added to the channel<\/strong><\/span><b>\u201d<\/b><span style=\"font-weight: 400;\"> on the channel itself.<\/span><\/p>\n<h2><b>Conclusion<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">Now, whenever the CloudWatch alarm transitions to an<strong> ALARM<\/strong> state,<\/span><span style=\"font-weight: 400;\">\u00a0you will be notified here on the Slack channel.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> <img decoding=\"async\" loading=\"lazy\" class=\"wp-image-60774 size-large alignnone\" src=\"https:\/\/www.tothenew.com\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10-1024x472.png\" alt=\"\" width=\"625\" height=\"288\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10-1024x472.png 1024w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10-300x138.png 300w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10-768x354.png 768w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10-624x288.png 624w, \/blog\/wp-ttn-blog\/uploads\/2024\/03\/p10.png 1366w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/><\/span><\/p>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Introduction One of the critical elements for production uptime is Monitoring and Alerts. Irrespective of the infrastructure types such as EC2 Servers, Serverless, containers, or microservices. There will always be observability needs. There are a lot of tools and software in this Observability market. However, this article focuses on cloud platform tools, such as AWS [&hellip;]<\/p>\n","protected":false},"author":1741,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":100},"categories":[2348],"tags":[1892],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60764"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1741"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=60764"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60764\/revisions"}],"predecessor-version":[{"id":60869,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/60764\/revisions\/60869"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=60764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=60764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=60764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}