5

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.

Question:

  • Can I disable codepipeline temporarily?
5

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.

1

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.

1
  • 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
1

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.

1

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"
1

Following on from some of the other answers, you can disable a transition from the AWS Console. Open the Pipeline, and between the Stages you'll see a little "Disable transition" button.

Disable Stage transition button Disable Stage transition button

Disable Stage transition button modal Disable Stage transition button modal

0

Not sure if this is a newer option, but the aws cli gives you the option to deregister the webhook with a thirdparty - https://docs.aws.amazon.com/codepipeline/latest/userguide/appendix-github-oauth.html#pipelines-webhooks-delete

Doing it this way, leaves your aws architecture intact and (assuming you are getting triggers from a third party like github) only removing the trigger from your source.

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.