Maximizing Productivity with Personalized AWS SNS Notifications for Code Pipeline

Maximizing Productivity with Personalized AWS SNS Notifications for Code Pipeline

SNS Customised Notification

We created a new SNS topic in my previous blog, Introduction to AWS SNS: A Beginner’s Guide to Setting up Notification Services., In this blog, we will explore how to set up a customized notification from AWS that can be easily read compared to a JSON format.

Why do we need to customize?

JSON format can be tedious to read, especially when dealing with multiple resources. It is not easy to determine which resource and service the notification is from. To eliminate this issue, we can customize the AWS notification into simple English. For example, let’s take a CICD AWS Pipeline. We need to know when a pipeline starts, and if it succeeds or fails. In JSON format, it can be hard to read, especially when dealing with multiple pipelines. That’s why we need to customize it.

To set up customized notifications, follow these steps:

  1. Log into your AWS console.

  2. Navigate to AWS Event Bridge –> Rules –> Create Rule. Enter a name and leave everything to the default value.

  3. Scroll down to creation mode and enter the AWS service for which we want to set a custom notification. For this example, we are using CodePipeline as the AWS service, and we want to know the state change of the pipeline. We can even specify which state we wish to get notified. Click “Next.”

  4. Choose the target as “SNS topic” and select the topic we want.

  5. Click “Additional settings.” Select “Configure target input” as “input transformer” and then “Configure Input Transformer.”

  6. Scroll down to “Target input transformer” and enter this: {“pipeline”:”$.detail.pipeline”,”state”:”$.detail.state”} This will pull the value we configured in step 3.

  7. Scroll down and enter “The Pipeline has.” This will set up the template. Then click “Confirm.”

  8. Leave everything else to the default value and create the rule. This rule is now applied to all pipelines in the account, including future pipelines.

You can see for yourself how's easy is it to read the above notification compared with the JSON You can try this method for any other AWS services and let me know the results on any of my social media platforms.

Next up, we will write a blog on how to set up a CodePipeline. Stay tuned!