How should the DevOps engineer configure status updates for pipeline activity and approval requests to post to the chat tool?
Create an Amazon CloudWatch Logs subscription that filters on CodePipeline Pipeline Execution State Change. Publish subscription events to an Amazon Simple Notification Service (Amazon SNS) topic. Subscribe the chat webhook URL to the SNS topic, and complete the subscription validation.
Create an AWS Lambda function that is invoked by AWS CloudTrail events. When a CodePipeline Pipeline Execution State Change event is detected, send the event details to the chat webhook URL.
Create an Amazon EventBridge rule that filters on CodePipeline Pipeline Execution State Change. Publish the events to an Amazon Simple Notification Service (Amazon SNS) topic. Create an AWS Lambda function that sends event details to the chat webhook URL. Subscribe the function to the SNS topic.
Modify the pipeline code to send the event details to the chat webhook URL at the end of each stage. Parameterize the URL so that each pipeline can send to a different URL based on the pipeline environment.
Explanations:
While this option uses CloudWatch Logs and SNS, which can relay notifications, it doesn’t directly support filtering on CodePipeline events nor can SNS subscriptions validate custom webhook URLs directly for delivery confirmation.
CloudTrail logs CodePipeline events, but it’s not ideal for near-real-time event processing. Also, the option lacks a scalable, event-driven approach for handling real-time notifications effectively.
EventBridge can filter CodePipeline state changes in near real time. Coupled with SNS and a Lambda function to relay details to the chat webhook, this setup provides an effective, flexible, and scalable solution for notifications.
Modifying pipeline code for notification purposes adds unnecessary complexity. Also, embedding webhook URLs in the pipeline code is not scalable, as it requires changes to the code for each environment.