AWS CodePipeline Notifications: Email and SMS for Pipeline Failures

Set up Notifications for Failed Pipelines in AWS CodePipeline

Prev Question Next Question

Question

You work in the Site Reliable Engineering team as a DevOps engineer.

Your team is maintaining several pipelines in the AWS CodePipeline service.

However, you have found no notifications to your team even if a certain pipeline has failed.

You want to set up a feature so that your on-call team can get an email and an SMS when the whole pipeline or certain stage inside the pipeline changes the state to “FAILED”

Which combinations of services should you use to implement this? (Select TWO.)

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answer - A, C.

Amazon CloudWatch Events can be used to detect and react to changes in the state of a pipeline, stage, or action.

Then, based on rules, CloudWatch Events invokes one or more target actions when a pipeline, stage, or action enters the specified state.

An SNS topic can be configured as a target for the above CloudWatch Events rule.

Then users can create subscriptions of Email or SMS to this new topic so that the on-call team will be notified when the state changes to unsuccessful.

Option A and C are CORRECT: For CodePipeline, CloudWatch Events rule supports the state change of pipeline, stage or action:

The relevant CodePipeline documentation can be found in https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html.

Options B, D, E are incorrect: Refer to the above explanations.

Policy ARN —_arn:aws:iamn EEE olicy/CodeDeployDemo-EC2-Permissions (2)

Description

Permissions  Policyusage Policy versions += Access Advisor

Access advisor shows the service permissions granted to this user and when those services were last accessed. You can use this information to revise your policies. Learn more

Note: Recent activity usually appears within 4 hours. Data is stored for a maximum of 365 days, depending when your region began supporting this feature. Learn more

Filter: No filter ~

Service Name + Access by Entities Last Accessed ~

‘Amazon $3 s8-admin-access and 1 more 101 days ago

Showing 1 results

To implement the desired feature of getting email and SMS notifications when a pipeline or stage fails in AWS CodePipeline, we can use AWS Simple Notification Service (SNS) and AWS CloudWatch Events.

AWS Simple Notification Service (SNS) is a fully managed messaging service that enables you to send notifications to recipients or other applications. We can use SNS to send email and SMS messages to the on-call team when a pipeline or a stage fails.

AWS CloudWatch Events is a service that enables you to respond to changes in AWS resources. It can detect state changes in AWS services and react to them. We can create a CloudWatch Event rule that listens for changes in the state of the pipeline or the stage, and when a failure is detected, it can trigger a notification to be sent to the SNS topic.

Therefore, to implement the desired feature, we can follow the below steps:

  1. Create an SNS topic and subscribe the on-call team's email and phone numbers to it.
  2. Create a CloudWatch Event rule that listens for changes in the state of the pipeline or the stage.
  3. Configure the CloudWatch Event rule to trigger a notification to the SNS topic when the state of the pipeline or the stage changes to "FAILED."
  4. When the notification is triggered, SNS will send an email and an SMS to the subscribed recipients.

Therefore, the correct answers are A (AWS Simple Notification Service) and C (AWS CloudWatch Events). AWS CloudTrail is not relevant here because it is a service that logs API activity in your AWS account. AWS Simple Queue Service is not relevant here because it is a service for queuing and processing messages. AWS CloudWatch Alarms are not relevant here because they are used to monitor metrics and take actions based on predefined thresholds.