Skip to content

Latest commit

 

History

History
 
 

4_AWSNotifications

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Module 4: Monitoring the bot with AWS Chatbot

AWS Chatbot enables your team to receive AWS notifications in Slack. To enable notifications, you need to configure the Chatbot with a Slack channel and choose SNS topics that will notify the channel. Then you configure other AWS services to publish notifications to SNS topics and AWS Chatbot will format and deliver notifications to Slack. See Chatbot documentation for the list of AWS services integrated with AWS Chatbot.

Your application already includes a CloudWatch Alarm preconfigured to send a notification to an SNS topic when a Lambda function invocation fails.

Chatbot diagram

Implementation Instructions

❗ Ensure you've completed the Slack app setup before beginning this module.

Each of the following sections provides an implementation overview and detailed, step-by-step instructions. The overview should provide enough context for you to complete the implementation if you're already familiar with the AWS Management Console or you want to explore the services yourself without following a walkthrough.

1. Configure AWS Chatbot

Configure AWS Chatbot with your Slack workspace. Use the SNS topic that was created by the application.

✅ Step-by-step directions

  1. Go to the AWS Chatbot console.

  2. In Configure a chat client, choose Slack, and choose Configure client.

    Chatbot home

  3. In the next screen, choose Allow.

    Chatbot Slack OAuth

  4. In the Configure Slack channel screen, choose the Slack channel where you want to receive notifications. We recommend creating a new public channel for monitoring the Slack app.

  5. Under IAM permissions, leave the default settings and give a name to the role.

    Chatbot role

  6. Under SNS topics, select the region where you created the application (US East - Ohio) and choose the SNS topic named APP_NAME-OpsNotificationsTopic-RANDOM_STRING.

  7. Choose Configure.

    Chatbot topics


2. Test AWS Chatbot notifications

In the Lambda console, create a test event that will guarantee the function to fail. Wait until you receive a CloudWatch Alarm in Slack from AWS Chatbot.

✅ Step-by-step directions

  1. Go back to the Lambda applications console and find the application you created in module 1.

  2. Under the Resources section, choose SlackLambdaFunction.

  3. Choose Test in the top right corner.

  4. In the pop-up form, give the event a name and paste the following snippet into the code editor:

    {
        "body": "non-JSON"
    }
    

    Test event fail

  5. Choose Create.

  6. Choose Test button again.

  7. The Lambda function will fail and display a failure message.

    Failed Lambda

  8. Within a couple of minutes, you will receive a CloudWatch Alarm notification in the Slack channel where you configured AWS Chatbot.

    CloudWatch Alarm

⭐ Recap

🔧 In this module you've configured AWS to send CloudWatch Alarms to your Slack bot.

⭐ Congratulations, you have completed the Building Serverless Bots on AWS Workshop! While this was a simple example you could easily extend this to handle further reporting of issues in your infrastructure or in response to events from AWS services.

Next

✅ See this workshop's cleanup guide for instructions on how to delete the resources you've created.