Notificaciones pipelines

Configuration of status notifications in Pipelines

By Josué Armando Vazquez, Infrastructure DevOps en Financial Solutions

Before, during and after the start of a project, it’s very important for the team to be in sync with the progress and needs of the project, in order to achieve this, we have tools like: CodePipeline which allows us to schedule notifications about the actions that are performed in the project through a pipeline.

These notifications can be general or detailed, in order to inform your team about the status of your development, either if it was approved, there was a change or update, or if the deployment failed.

At Financial Solutions, communication in every sense is very important, so we will share with you the easiest way to create notifications from a previously created pipeline flow.

Step 1: Set up email notifications using Amazon SNS

After setting up a pipeline in AWS CodePipeline, a CloudWatch event rule can be configured to send notifications when there’s an execution state change in the pipeline’s stages or actions.

Amazon SNS manages the use of topics to deliver messages to customers or subscription endpoints. We use Amazon SNS to create a notification topic and then subscribe to the topic with an email address,  then the Amazon SNS topic will be added as a destination to the CloudWatch Events rule.

To create a topic:

1. Open the Amazon SNS console at https://console.aws.amazon.com/sns.

2. Choose Create new topic.

3. In the create new topic dialog box, in topic name, type a name for the topic (for example, PipelineNotificationTopic).

4. Subscribe one or more recipients to the topic to receive email notifications.

To subscribe a recipient to a topic:

5. In the Amazon SNS console in the topics list, select the check box next to the new topic. Choose Actions, subscribe to topic.

6. In the create subscription dialog box, verify that an ARN appears under Topic ARN.

7. For Protocol, choose email.

8. On endpoint, type the recipient’s full email address. Your screen should look as follows:

9. Choose Create Subscription.

10. Amazon SNS will send an email confirming the subscription to the recipient, to receive email notifications, the recipient must click on the confirm subscription link in this email. When the recipient clicks the link, if the subscription was successful, Amazon SNS will display a confirmation message in the web browser.

Step 2: Create a rule and add the SNS topic as a destination

  1. Select in Code Pipeline, the pipeline where you want to add a status change alarm.

2. In the options menu choose the notify option:

3. It will display two options: “create notification rule” and “manage notification rules”. Here we will select for the first time, create notification rule:

4. We will add a name for the rule and a type. Whether you require a detailed or simple notification (depending on your needs):

5. In the next section, we will select the events that will trigger notifications:

Amazon allows us to have a wide selection of events for which we need to have a notification, either at the time of failure, at each of its stages, and why not, the status of the approvals that we have.

Finally, we have the destination section. Here we can select all the SNS groups we need to notify about the events we have chosen for our configuration:

It even allows us to create the group of notifications from this section.

We told you that it was necessary to create an SNS topic to understand how to configure these groups of notifications, however, on CodePipeline’s configuration of alerts, we will have the opportunity to create these destinations more quickly and easily by skipping some steps.

Let me know if this tutorial was useful for you and share if you would like some other tutorials!

Related Post