Explore the Approval Rule and Notification Rule in CodeCommit Repo
Tags: aws, awscodecommit, awsiam, awssns
Published: 2023-06-03 15:39:10

“ I have to make an approval and notification rule for codecommit repo so the user has a maintained way to have approval process and get notified while pull request : creation and merge. It's easy to create approval rules and notification rules in codecommit with IAM user creation and SNS topic with subscription. Pricing of codecommit and sns depends on users storage and requests.”

AWS CodeCommit is a version control service hosted by AWS that you can use to privately store and manage assets in the cloud. For information about pricing for codecommit, see [Pricing](http://aws.amazon.com/codecommit/pricing/).

In this post, you will get to know how to explore the approval rule and notification rule in codecommit repo. Here I have created codecommit repo, IAM user, SNS topic and subscription, codecommit approval and notification rule template.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/06e6r6cwoq7wr10fbtra.jpg)
The architecture diagram shows the overall deployment architecture with data flow, aws codecommit repo, approval rule, notification rule, iam user and sns.

#Solution overview
The blog post consist of the following phases:
1. Create of IAM User and SNS Topic with Subscription
2. Create of Approval Rule Template and Notification Rule in CodeCommit
3. Output as Creation of Pull Request and Approve with Merge on the Pull Request by IAM User. Checkout the Main Branch Files as Dev Branch after Merge of Branches

I have a codecommit repo with main and dev branch as below →
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jn565r132g0000ogpq2i.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pzyu27qh2938u6n5x3he.png)

##Phase 1: Create of IAM User and SNS Topic with Subscription
1. Open the IAM console and create a user with console administrator access. Also create a sns topic with subscription.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/by42p7mukyeei16yncjo.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8dsiwsjw004aodnlbmdf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m22j5lz6rj8f8d26czt6.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/innhqjm35maf8hd5uq27.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dpesggb03hinz8bq5l2b.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bp07db65sw9wnjz5lcz.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfcmhlr3mk6nqp54kyna.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nlrn3qrg61ymxxmjl2up.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mvmmo13d2z80puts7m1t.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b51g2skt8cpyaeazeeg9.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rao6a71f9xvqjqtvjh90.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ftl4ykkq2eoqjg9e3sml.png)

##Phase 2: Create of Approval Rule Template and Notification Rule in CodeCommit 
1. Open the CodeCommit console and create an approval rule template for user approval. Also open the repository as testrepo and create a notification rule for pull request creation and merge. Need to update the access policy for sns as the notification target is unreachable. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/udpthhpuxeqdhoyi32jq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2b22j8bzjxhpk4a9typc.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w3lq6wzpx3pk0d2juwew.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cr54hn5dw3hrscivn15x.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hm7dfsvchphaipnjv9ce.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lb30ijrzvfo9n3fale7t.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cblmzynedb4trk1y5rcb.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tirac0aazjlgdgfiarm.png)

##Phase 3: Output as Creation of Pull Request and Approve with Merge on the Pull Request by IAM User. Checkout the Main Branch Files as Dev Branch after Merge of Branches

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9v2z72zcz69wykku6dql.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ghgev90oufjn75ziry0f.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofuokcjwg0ton3j4ut6s.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uh42gfm5asuhse6vf3jy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uc032h3kwfcct8qth1yf.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91gfahe7rcz6kdnd54hc.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o04seru1n34zsy6swymg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fcue5o75ib4yi54fl5dd.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ucoj6stgcjtnkjguodv1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5rte2ozi24br0ss9meg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u21nhirquz3f3oaime7u.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t2jrhtzhw533gb1zjkda.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qzdrfbcfr3re0je9zvo.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7j5qf5jo7erj89nge5l3.png)

#Clean-up
Delete CodeCommit Repo, IAM User, SNS Topic, SNS Subscription, CodeCommit Approval Rule Template.

#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

Total Cost = $0.0

#Summary
In this post, I showed “explore the approval rule and notification rule in codecommit repo”.

For more details on AWS CodeCommit, Checkout Get started AWS CodeCommit, open the [AWS CodeCommit console](https://us-east-1.console.aws.amazon.com/codesuite/codecommit/repositories?region=us-east-1#). To learn more, read the [AWS CodeCommit documentation](https://docs.aws.amazon.com/codecommit/?icmpid=docs_homepage_devtools). 

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)