Triggers Notifications and Approval Rule Templates
Start course

This course provides you with an introduction to AWS CodeCommit and how it can be used to manage your source code. 

Learning Objectives

  • Understand what the service is and the benefit it provides 
  • Learn the core functionality of the service
  • Learn the important features such as notifications, triggers, and approval rule templates
  • Understand how to use the service

Intended Audience

  • Those who are implementing or managing CI/CD pipelines on AWS
  • Those who want to better understand CodeCommit and how it fits into a software development process
  • Anyone taking an AWS certification, such as the AWS Developer - Associate certification 




When an event happens in an AWS CodeCommit environment, you can choose to do two things: 

  1. You can be notified of the event or

  2. You can take action

To do this, you can use notifications, triggers, and approval rule templates. Let’s go through each of these options and talk about their use cases. The first option is the embedded repository notification functionality in CodeCommit. Once you create and connect to your repository, you can choose to be notified of any events, such as new commits, status changes, if a pull request was merged, and more. 

You can be notified through AWS Chatbot and receive notifications via Slack or other chat channels or via SNS topic, which enables you to send notifications to email addresses, phone numbers, AWS Lambda, Amazon SQS, Kinesis Firehose, or application endpoints.

Then, you can select whether these notifications contain either basic details about the event or full details. For example, if you select to be notified of a comment on a commit, a notification with full detail will show the content of the comment including any replies or comment threads, as well as the line number, and the line of code where the comment was made. 

The basic details would not include the content of the comment. line number, line of code, or any comment threads. It will simply just show the event. 

With repository triggers, you can take action based on repository events.  For example, you can kick off an SNS notification or a Lambda function if you create a branch or tag, if you delete a branch or tag, if you push to an existing branch, or for all repository events. 

There’s a few core differences between repository triggers and repository notifications:

  1. With triggers, you can easily trigger a Lambda function directly. 

  2. Triggers don’t use CloudWatch Events rules to evaluate repository events. 

  3. They are relatively limited in what they can do and can mostly only trigger based on branch or tag events. Triggers are very simplistic. 

If you’re looking for greater functionality when triggering off of events, it’s worth noting that CodeCommit also integrates with Amazon EventBridge. EventBridge is a little more complicated to set up than repository triggers, however, it can provide greater functionality. For example, with EventBridge, you can trigger actions based on more than just branch or tag events.

It’s also well integrated with other AWS services. Suppose you wanted to trigger a pipeline created within CodePipeline to execute when a commit takes place within your repository. With EventBridge, you can easily set this event-driven workflow up. 

The final way to take action on a CodeCommit repository is through approval rule templates. Approval rule templates are helpful when you require approval for your pull requests. For example, if a senior developer needs to look over changes before they’re merged. With approval rule templates, you can associate the approval to a certain repository. From there, you can specify how many approvals are needed and which IAM users or roles will approve the pull request. You can also filter based on the branch, for example, if you only need your senior developer to only approve pull requests before they’re merged into the main branch. 

To quickly summarize, repository notifications, triggers, and approval rule templates help you create event-driven workflows with CodeCommit. That’s it for this video - see you next time.  

About the Author
Learning Paths

Alana Layton is an experienced technical trainer, technical content developer, and cloud engineer living out of Seattle, Washington. Her career has included teaching about AWS all over the world, creating AWS content that is fun, and working in consulting. She currently holds six AWS certifications. Outside of Cloud Academy, you can find her testing her knowledge in bar trivia, reading, or training for a marathon.