You are currently viewing How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed how to create an AWS CodeCommit approver rule template using AWS CLI.

https://cloudaffaire.com/how-to-create-an-aws-codecommit-approver-rule-template-using-aws-cli/

In this blog post, we will discuss how to create a trigger in AWS CodeCommit repository using AWS CLI.

What Is Trigger In AWS CodeCommit Repository:

You can configure a CodeCommit repository so that code pushes or other events trigger actions, such as sending a notification from Amazon Simple Notification Service (SNS) or invoking a function in AWS Lambda. You can create up to 10 triggers for each CodeCommit repository. You can configure an SNS notification trigger to get an email notification every time someone pushes to the repository. You can also create a lambda trigger to notify an external build system to start a build after someone pushes to the main branch of the repository. In this demo, we will configure the SNS trigger using AWS CLI.

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI:

Requirements:

AWS CLI v2 installed and configured.

https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

Git installed and configured.

https://www.atlassian.com/git/tutorials/install-git

Step 1: Create a new AWS CodeCommit repository.

Step 2: Create a new SNS topic with an email subscription.

You will get an email notification to confirm your subscription. Click on the ‘Confirm subscription’.

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

Step 3: Create an SNS trigger for your CodeCommit repository.

Step 4: Test if the trigger is working by pushing a change in your repository.

You will get an email notification in your email.

How To Create A Trigger In AWS CodeCommit Repository Using AWS CLI

Step 5: Cleanup.

Hope you have enjoyed this blog post. To get more details on AWS CodeCommit, please refer below AWS documentation

https://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html

https://docs.aws.amazon.com/cli/latest/reference/codecommit/index.html

CodeCommit is a Git based version control system and you need to have basic understanding of Git in order to work with CodeCommit. You can follow below link to get a basic understanding of Git.

https://cloudaffaire.com/category/devops/git/

 

Leave a Reply