Skip to main content
Creating webhooks for AWS CodeCommit

How to configure webhooks for your CI job or pipeline, to deploy changes from an AWS CodeCommit repository when the source branch changes

Jack Parkinson avatar
Written by Jack Parkinson
Updated this week

This document is a guide on how to create a webhook trigger to trigger a CI job in Gearset each time pushes are made to a branch. To trigger validations when pull requests are opened against that branch, you will additionally need to follow this guide to set up an EventBridge rule.

Instructions

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

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

  3. Select HTTPS as the Protocol.

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

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

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

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

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

  9. Click the Create new trigger button.

  10. Under Events, select Push to existing branch.

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

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

  13. 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.


How to set up validations against an opened PR

If you want 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.

Did this answer your question?