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

Start a Pipeline Execution in 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 when a change is made to a repository. You can also make your pipeline start on a schedule. The following are the automatic change detection methods:

    • When you use the console to create a pipeline that has a CodeCommit source repository or Amazon S3 source bucket, CodePipeline creates an Amazon CloudWatch Events rule that starts your pipeline when the source changes. This is the recommended change detection method. If you use the AWS CLI to create the pipeline, the change detection method defaults to starting the pipeline by periodically checking the source (CodeCommit, Amazon S3, and GitHub source providers only). We recommend that you disable periodic checks and create the change detection resources manually. For more information, see Use CloudWatch Events to Start a Pipeline (CodeCommit Source).

    • When you use the console to create a pipeline that has a GitHub repository, CodePipeline creates a webhook that starts your pipeline when the source changes. This is the recommended change detection method. If you use the AWS CLI to create the pipeline, the change detection method defaults to starting the pipeline by periodically checking the source. We recommend that you disable periodic checks and create the additional resources manually. For more information, see Use Webhooks to Start a Pipeline (GitHub Source).

  • Manually: You can use the console or the AWS CLI to start a pipeline manually. For information, see Start a Pipeline Manually in AWS CodePipeline.

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

Note

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

Change Detection Methods Used to Start Pipelines Automatically

When you create or update a pipeline, you specify the method to use to react to source repository changes. Your choice determines how your pipeline is started.

You can use the console, CLI, or AWS CloudFormation to specify your change detection method.

Source Detection Method Description Requires Additional Resources? How to Migrate Pipelines to the Recommended Change Detection Method
Amazon S3 Amazon CloudWatch Events (recommended). This is the default for pipelines with an Amazon S3 source created or edited in the console.
  • Your pipeline is triggered as soon as a change is made to the repository. Events in your bucket are filtered by AWS CloudTrail, and then the Amazon CloudWatch Events rule triggers your pipeline to start.

  • Faster and more configurable than periodic checks.

Yes. Amazon CloudWatch Events rule and an AWS CloudTrail trail must be applied. To create a pipeline that uses source triggers (not periodic checks), see Configure Your Pipelines to Use Amazon CloudWatch Events for Change Detection (Amazon S3 Source). To update a pipeline to use source triggers, see Edit Pipelines to Use Push Events.
Periodic checks CodePipeline periodically contacts the source. No
CodeCommit Amazon CloudWatch Events (recommended). This is the default for pipelines with an CodeCommit source created or edited in the console.
  • 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. To create a pipeline that uses source triggers (not periodic checks), see Configure Your Pipelines to Use Amazon CloudWatch Events for Change Detection (CodeCommit Source). To update a pipeline to use source triggers, see Edit Pipelines to Use Push Events.
Periodic checks CodePipeline periodically contacts the source repository. No
GitHub Webhooks (recommended). This is the default for pipelines with a GitHub source created or edited in the console.
  • Your pipeline is triggered as soon as a change is made to the repository.

  • Faster and more configurable than periodic checks.

Yes To create a pipeline that uses source triggers (not periodic checks), see Configure Your Pipelines to Use Webhooks for Change Detection (GitHub Source). To update a pipeline to use source triggers, see Edit Pipelines to Use Push Events.
Periodic checks CodePipeline periodically contacts the source repository. No
Amazon ECR Amazon CloudWatch Events. This is created by the wizard for pipelines with an Amazon ECR source created or edited in the console.
  • Your pipeline is triggered as soon as a change is made to the repository.

  • Periodic checks are not applicable for this source provider.

Yes When you use the CLI or AWS CloudFormation to create a pipeline, make sure you create your CWE rule for change detection. To create your rule, see Use CloudWatch Events to Start a Pipeline (Amazon ECR Source).