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

How to Start a Pipeline Execution in AWS CodePipeline

When a pipeline execution starts, it runs a revision through every stage and action in the pipeline.

There are two ways to start a pipeline execution:

  • Automatically: Using change-detection methods that you specify, you can make your pipeline start automatically when a change is made to a repository. You can also make your pipeline start automatically on a schedule.

  • Manually: You can use the console or the AWS CLI to start a pipeline, as described in Start a Pipeline Manually in AWS CodePipeline.

By default, pipelines are configured to start automatically using available change detection methods.

Note

Your pipeline runs only when something changes in the source repository and branch you have defined.

Change-Detection Methods Used to Start Pipelines Automatically

When you create or update a pipeline, you specify the change-detection method used to react to source repository changes. Your choice then determines how your pipeline is automatically started.

Source Detection Method Description Requires Additional Resources? Ways to Set Up Pipeline Manually Set Up Additional Resources?
Amazon S3 Periodic checks (recommended) AWS CodePipeline periodically contacts the source repository. No Console, CLI, CloudFormation N/A
AWS CodeCommit Amazon CloudWatch Events (recommended)

Note

Unavailable in Asia Pacific (Seoul) and Asia Pacific (Mumbai) regions.

  • Your pipeline is triggered as soon as a change is made to the repository.

  • Faster and more configurable than periodic checks.

Yes. Amazon CloudWatch Events rule must be applied. Console Console creates resources on your behalf.
CLI, CloudFormation
Periodic checks AWS CodePipeline periodically contacts the source repository. No Console, CLI, CloudFormation N/A
GitHub Periodic checks (recommended) AWS CodePipeline periodically contacts the source repository. No Console, CLI, CloudFormation N/A

How Do You Start Pipelines Using Amazon CloudWatch Events?

Amazon CloudWatch is a web service that monitors your AWS resources and the applications that you run on AWS.

In Amazon CloudWatch, an event indicates a change in your AWS environment. AWS resources can generate events when their state changes. Using simple rules that are set up in Amazon CloudWatch Events, you can match events and route them to one or more target functions or streams.

Amazon CloudWatch Events can be set up to point to AWS CodePipeline as a target. AWS CodePipeline uses Amazon CloudWatch Events to detect changes in the configured source repository and branch. When a change occurs, Amazon CloudWatch Events automatically starts your pipeline.

To configure CloudWatch Events to start your pipeline automatically when something in your source repository changes

  1. Create a CloudWatch Events rule that uses one of the available services as an event source.

  2. Create a target for your rule that selects AWS CodePipeline as a target.

  3. Grant permissions to CloudWatch Events to start the pipeline by creating or selecting an AWS CodePipeline service role that CloudWatch Events will assume.

When you create or update a pipeline in the console, as soon as you pick an AWS CodeCommit repository and branch, the AWS CodePipeline console creates the pipeline’s Amazon CloudWatch Events rule and automatically displays the rule name. If you have an AWS CodeCommit repository and are creating or updating a pipeline in the CLI, you should create an Amazon CloudWatch Events manually and disable periodic checks.