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 (Amazon CloudWatch Events) 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:
Amazon CloudWatch Logs does not provide a direct mechanism to trigger notifications to a chat tool via a webhook. The logs can be used to capture events, but integrating them with a chat tool via SNS requires additional steps that are not straightforward in this case.
AWS CloudTrail logs events related to API calls, but CodePipeline events like state changes are not directly captured by CloudTrail. Lambda would be triggered for the wrong set of events, and this solution does not handle the required state changes effectively.
Amazon EventBridge can capture CodePipeline events and trigger an SNS topic. Using an AWS Lambda function subscribed to the SNS topic, the event details can be sent to the custom chat tool’s webhook. This is a clean, scalable, and efficient way to manage pipeline notifications.
Modifying the pipeline code to send event details manually at the end of each stage is not an automated approach. This solution would require additional management and is less efficient compared to using EventBridge or SNS for real-time notifications.