Skip to main content
Getting started with AWS CodeCommit webhooks

How to set up a CI job to deploy changes from an AWS CodeCommit repository when the source branch changes

Ali Daw avatar
Written by Ali Daw
Updated over a week ago

This document is a guide to setting up a CI job in Gearset that deploys changes from an AWS CodeCommit repository whenever the source branch changes.

In summary, per CI job configured to instigate a specific action, you will need the following set up on the AWS side:

  • 1 Simple Notification Service (SNS) Topic

  • 1 Subscription

  • 1 Trigger

  • 1 EventBridge rule (optional - for forward-looking validations when opening a PR)

Before creating a CI job triggered by a webhook, you need to have added a connection to your AWS CodeCommit from the Source control and services page.

Before performing the steps listed below, you need to ensure that the AWS code commit repository is not blank and has at least one branch (for e.g. main) to work with, otherwise, you will get an error when you select the Source repository field on the Add CI deployment job page.

CI Jobs

  1. To get started, from the Continuous integration page in Gearset, click ADD NEW JOB....

  2. Select AWS CodeCommit as the Source type.

  3. Under Deployment behavior, select when the source branch is updated.

  4. Once you’ve configured the other options, click Save and you’ll see another dialog box with the webhook information in it. You’ll need the Payload URL and Shared secret later on, so keep them around.

  5. In the AWS Management Console, go to the SNS section (searching for 'Simple Notification Service' at the top)

  6. Create a new topic, then create a new subscription for that topic.

  7. Select HTTPS as the Protocol.

  8. Set the Endpoint to the Payload URL from Gearset’s webhook setup dialog earlier.

  9. The new subscription’s ID will be Pending confirmation.

  10. Click the Request confirmations button and hit the refresh button in the table. The subscription should then be assigned a proper subscription ID.

  11. In the AWS Management Console, go to the AWS CodeCommit section.

  12. For the repository you’re deploying, go to the Settings section, and then to the Triggers tab.

  13. Click the Create new trigger button.

  14. Under Events, select Push to existing branch. 

  15. Under Branch names, select the branch (or just leave it blank if you want to select all branches).

  16. Under SNS topic, select the SNS topic you created earlier.

  17. Under Custom data, paste in the Shared secret from Gearset’s webhook setup dialog earlier.

You can test the trigger at this point to check that it can connect successfully.

Now the next time you push to this branch, it will trigger the CI job in Gearset.

If you then wanted validations to be triggered when opening a PR against that branch, you would also need to conduct additional steps by creating an EventBridge Rule. The steps to add these for CI jobs are documented under EventBridge configuration for the users using AWS CodeCommit.


When configuring a Gearset Pipeline using AWS CodeCommit, you will also be asked to add a specific SNS Topic, Subscription & EventBridge Rule to allow all the Pipeline functionality to work as expected.

  1. Head to the Pipeline page, and click on the settings cog, followed by 'Add webhook...'

  2. This will bring up an informational modal explaining how to add in the SNS Topic, Subscription and EventBridge rule for your pipeline.

    1. Note: This is over and above the CI job configuration SNS Topics and supporting elements written above, and is unique to the pipeline

  3. Once complete, your Pipeline will now be able to monitor the repository for Pull Requests opening across your Static Environments, and kick off validations accordingly.

Did this answer your question?