I set up an AWS Codepipeline, which sources from Github, build by CodeBuild, and then deploy to ec2 instance via CodeDeploy. This ec2 instance is the development environment.

Since my team decided we won't be using this server/code for while, we stopped the ec2 instance. So I'd like to halt the Codepipeline temporarily, for now (CodeBuild and CodeDeploy is not free, even very small price...) However, I cannot find option for temporarily disabling codepipeline.


  • Can I disable codepipeline temporarily?

Using the AWS CLI, you can disable the triggering event.

The syntax of the command is

aws events disable-rule --name [name of rule]

To find the name of the rule, you view all the rules in the CloudWatch console. You may have to open each one to see which is the rule for your pipeline. To more directly find the rule for your pipeline, you can run

aws events list-rule-names-by-target --target-arn [arn of pipeline]

To get the arn of the pipeline, you can

aws codepipeline get-pipeline --name [name of pipeline]

and look at metadata.pipelineArn in the result.

| improve this answer | |

If you don't trigger CodePipeline with something (eg. a change or a CloudWatch event rule) then it won't run. Assuming you don't push any changes, your pipeline shouldn't run, and you shouldn't incur costs from CodeDeploy or CodeBuild.

If you still need to push changes but you don't want your pipeline to run, then you could create a branch which you don't push to and then update your pipeline to use that branch.

The advantage of these approaches is that your pipeline will still be ready to go if you ever need to push a change in a hurry.

Another option is to disable the stage transition out of the source stage (click the arrow beneath your source stage). Your pipeline will still run (and therefore you will still incur CodePipeline charges if you push changes), but at least none of the later stages will run.

| improve this answer | |
  • Using a dedicated branch to kick off the Pipeline build is the way to go. Don't set the trigger to master branch or other branches that are pushed to without a need to build. – ADTC Mar 17 '18 at 3:42

Better option is to go to the github repo, click settings, click webhooks, find the one to aws (like https://us-east-1.webhooks.aws/trigger) and click the edit . button next to it. Then scroll down to the checkbox labeled "Active" and uncheck it. This disables the push from github to the codepipeline, so the build will only happen when you manually run it, and you haven't scuttled any of your AWS config.

| improve this answer | |

My preference is the last option suggested by TimB, which is to disable one of the transitions:

aws codepipeline disable-stage-transition --pipeline-name my-pipeline \
    --stage-name Test  --transition-type Inbound --reason "my-reason"
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.