Start a Pipeline Execution in CodePipeline - CodePipeline

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 in AWS CodePipeline:

  • 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 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 rule 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 webhook. For more information, see Use Webhooks to Start a Pipeline (GitHub Source).

    • Most source actions in CodePipeline, such as GitHub, require either a configured change detection resource (such as a webhook or CloudWatch Events rule) or use the option to poll the repository for source changes. For pipelines with a Bitbucket Cloud source action, you do not have to set up a webhook or default to polling. The connections action manages your source change detection for you.

  • 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 to Start Pipelines

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.

Source Detection Method Description Requires Additional Resources?
Amazon S3 Amazon CloudWatch Events (recommended) and an AWS CloudTrail trail. 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. See Create a Pipeline in CodePipeline, Use CloudWatch Events to Start a Pipeline (Amazon S3 Source) and Events Placeholder Bucket Reference.
Periodic checks CodePipeline periodically contacts the source. No.
AWS 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. See Create a Pipeline in CodePipeline and Use CloudWatch Events to Start a Pipeline (CodeCommit Source).
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. See Create a Pipeline in CodePipeline and Use Webhooks to Start a Pipeline (GitHub Source).
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. See Create a Pipeline in CodePipeline and Use CloudWatch Events to Start a Pipeline (Amazon ECR Source).

If you have a pipeline that uses polling, you can update it to use the recommended detection method. For more information, see Update Polling Pipelines to the Recommended Change Detection Method.