AWS CodePipeline
User Guide (API Version 2015-07-09)

A new console design is available for this service. Although the procedures in this guide were written for the older version of the console, you will find many of the concepts and basic procedures in this guide still apply.

Create a CloudWatch Events Rule That Starts Your AWS CodeCommit Pipeline (Console)

To create a CloudWatch Events rule for use in AWS CodePipeline operations

  1. Open the CloudWatch console at

  2. In the navigation pane, choose Events.

  3. Choose Create rule, and then under Event source, choose CodeCommit from the Service Name drop-down list.

  4. The service name specifies the service that owns the event resource. For example, choose AWS CodeCommit to trigger a pipeline when there are changes to the AWS CodeCommit repository associated with a pipeline.

  5. From the Event Type drop-down list, choose CodeCommit Repository State Change.

                            Create repository state change rule
  6. To make a rule that applies to all repositories, choose Any resource.

    To make a rule that applies to one or more repositories, choose Specific resource(s) by ARN, and then enter the ARN.


    You can find an AWS CodeCommit repository ARN on the Settings page in the AWS CodeCommit console.

    To specify the branch to associate with the repository, choose Edit, and type the resource type branch and the branch name. Use the event pattern options for detail. The preceding example shows the detail options for an AWS CodeCommit repository branch named "master." Choose Save.

    In the Event Pattern Preview pane, view the rule.

  7. In the Targets area, choose CodePipeline.

  8. Enter the pipeline ARN for the pipeline to be started when triggered by this rule.


    You can find the pipeline ARN in the metadata output after you run the get-pipeline command. The pipeline ARN is constructed in this format:


    Sample pipeline ARN:


  9. Create or specify an IAM service role that grants Amazon CloudWatch Events permissions to invoke the target associated with your Amazon CloudWatch Events rule (in this case, the target is AWS CodePipeline).

    • Choose Create a new role for this specific resource to create a service role that gives Amazon CloudWatch Events permissions to your start your pipeline executions when triggered.

    • Choose Use existing role to enter a service role that gives Amazon CloudWatch Events permissions to your start your pipeline executions when triggered.

  10. Review your rule setup to make sure it meets your requirements.

  11. Choose Configure details.

  12. On the Configure rule details page, type a name and description for the rule, and then choose State to enable the rule.

  13. If you're satisfied with the rule, choose Create rule.