DEV Community

GargeeBhatnagar for AWS Community Builders

Posted on

Customize the Notification Format for Pull Request State Change Using Amazon EventBridge Rule

“ I have checked the documents of AWS to customize the notification format for pull request state change in codecommit repo. So I got the Amazon Eventbridge Rule as a solution. Pricing of solution depends on codecommit repo, eventbridge rule and sns topic cost.”

Amazon EventBridge is a serverless event bus service that you can use to connect your applications with data from a variety of sources. EventBridge delivers a stream of real-time data from your applications, software as a service (SaaS) applications, and AWS services to targets such as AWS Lambda functions, HTTP invocation endpoints using API destinations, or event buses in other AWS accounts.

In this post, you will get to know how to customize the notification format for pull request state change using amazon eventbridge rule. Here I have used a sns topic, eventbridge rule and codecommit repository for notification format creation for pull request state change as create and merge using eventbridge rule.

Prerequisites

You’ll need an Amazon SNS for this post. Getting started with amazon SNS provides instructions on how to create a topic and subscription.

You’ll need an AWS CodeCommit Repositories for this post. Getting started with AWS CodeCommit provides instructions on how to create a codecommit repository. For this blog, I assume that I have a codecommit repository and a sns topic created.

Architecture Overview

Image description
The architecture diagram shows the overall deployment architecture with data flow, amazon eventbridge rule, aws codecommit repo, sns topic and mail box.

Solution overview

The blog post consists of the following phases:

  1. Create Eventbridge Rule with Required Details of Customize Mail Format
  2. Output of Notification in Mail for Pull Request Creation and Merge

I have sns topic with subscription and codecommit repository with branch as below →
Image description
Image description
Image description

Phase 1: Create Eventbridge Rule with Required Details of Customize Mail Format

  1. Open the Eventbridge console and create a eventbridge rule with required rule detail, build event pattern with codecommit service, define target as sns topic with additional settings for customize mail format.

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Phase 2: Output of Notification in Mail for Pull Request Creation and Merge

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Clean-up

Delete SNS Topic, Eventbridge Rule and CodeCommit Repository.

Pricing

I review the pricing and estimated cost of this example.

Cost of Simple Notification Service = Free for notifications and requests = $0.0

Cost of CodeCommit = $0.00 for first 5 CodeCommit users = $0.0

Cost of EventBridge Rules = $0.0

Total Cost = $0.0

Summary

In this post, I showed “how to customize the notification format for pull request state change using amazon eventbridge rule”.

For more details on Amazon EventBridge Rules, Checkout Get started Amazon EventBridge Rules, open the Amazon EventBridge console. To learn more, read the Amazon EventBridge documentation.

Thanks for reading!

Connect with me: Linkedin
Image description

Top comments (0)