AWS CodeCommit
User Guide (API Version 2015-04-13)

The procedures in this guide support the new console design. If you choose to use the older version of the console, you will find many of the concepts and basic procedures in this guide still apply. To access help in the new console, choose the information icon.

Edit Triggers for an AWS CodeCommit Repository

You can edit the triggers that have been created for an AWS CodeCommit repository. You can change the events and branches for the trigger, the action taken in response to the event, and other settings.

Edit a Trigger for a Repository (Console)

  1. Open the AWS CodeCommit console at https://console.aws.amazon.com/codesuite/codecommit/home.

  2. In Repositories, choose the repository where you want to edit a trigger for repository events.

  3. In the navigation pane for the repository, choose Settings. In Settings, choose Triggers.

  4. From the list of triggers for the repository, select the trigger you want to edit, and then choose Edit.

    If this feature does not appear available in the new console experience, choose the navigation bar option Return to the old experience.

  5. Make the changes you want to the trigger, and then choose Update to save your changes.

Edit a Trigger for a Repository (AWS CLI)

  1. At a terminal (Linux, macOS, or Unix) or command prompt (Windows), run the get-repository-triggers command to create a JSON file with the structure of all of the triggers configured for your repository. For example, to create a JSON file named MyTriggers.json with the structure of all of the triggers configured for a repository named MyDemoRepo:

    aws codecommit get-repository-triggers --repository-name MyDemoRepo >MyTriggers.json

    This command returns nothing, but a file named MyTriggers.json is created in the directory where you ran the command.

  2. Edit the JSON file in a plain-text editor and make changes to the trigger block of the trigger you want to edit. Replace the configurationId pair with a repositoryName pair. Save the file.

    For example, if you want to edit a trigger named MyFirstTrigger in the repository named MyDemoRepo so that it applies to all branches, you would replace configurationId with repositoryName, and remove the specified master and preprod branches in red italic text. By default, if no branches are specified, the trigger applies to all branches in the repository:

    { "repositoryName": "MyDemoRepo", "triggers": [ { "destinationArn": "arn:aws:sns:us-east-2:80398EXAMPLE:MyCodeCommitTopic", "branches": [ "master", "preprod" ], "name": "MyFirstTrigger", "customData": "", "events": [ "all" ] } ] }
  3. At the terminal or command line, run the put-repository-triggers command. This updates all triggers for the repository, including the changes you made to the MyFirstTrigger trigger:

    aws codecommit put-repository-triggers --repository-name MyDemoRepo file://MyTriggers.json

    This command returns a configuration ID, similar to the following:

    { "configurationId": "0123456-I-AM-AN-EXAMPLE" }