AWS Certified DevOps Engineer – ProfessionalMonitoring and LoggingEasy

A company uses AWS CodeBuild for its CI/CD pipeline. They want to ensure that all build failures trigger an immediate notification to a Slack channel, including details about the build project, status, and a link to the CodeBuild console for quick investigation. The solution must be highly available and require minimal custom code. Which approach should a DevOps engineer implement?

  1. AUse AWS Chatbot to integrate CodeBuild notifications directly with Slack, configuring a CloudWatch Event Rule to filter for build failures.
  2. BConfigure a CloudWatch Event Rule to detect CodeBuild state changes, target an SNS topic, and subscribe a Lambda function to format and send the message to Slack.
  3. CEnable CodeBuild notifications directly within the CodeBuild project settings, configuring an SNS topic as the target for build failure events and subscribing an HTTP endpoint to Slack.
  4. DCreate a custom Python script running on an EC2 instance that polls CodeBuild project status every minute and sends a notification to Slack when a failure is detected.
Show answer & explanation

Correct answer: A. Use AWS Chatbot to integrate CodeBuild notifications directly with Slack, configuring a CloudWatch Event Rule to filter for build failures.

AWS Chatbot provides direct integration with Slack and Amazon Chime for AWS service notifications. By configuring a CloudWatch Event Rule for CodeBuild state changes and targeting AWS Chatbot, build failure notifications can be sent to Slack with minimal configuration and no custom code.

Why the other options are wrong

  • B. This approach is viable but requires writing and maintaining a Lambda function for message formatting, which AWS Chatbot handles inherently, making it less 'minimal custom code'.
  • C. CodeBuild does not directly support HTTP endpoints for SNS subscriptions to Slack. An intermediate service like Lambda or AWS Chatbot is needed to translate SNS messages for Slack.
  • D. Polling is inefficient, introduces latency, and managing an EC2 instance for this purpose goes against the 'minimal custom code' and 'highly available' requirements due to single point of failure and operational overhead.

AWS Chatbot

A service that makes it easy to monitor and interact with your AWS resources from Slack or Amazon Chime. It can deliver notifications, run commands, and retrieve diagnostic information.

  • Integrates AWS services with Slack and Amazon Chime.
  • Delivers notifications from services like CloudWatch, SNS, Security Hub.
  • Allows running AWS CLI commands directly from chat.

Memory trick: Chatbot Connects CodeBuild's Cries to Slack.

More Monitoring and Logging questions