Temporarily disable aws CodePipeline?

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?

Solution 1:

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.

Solution 2:

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

Solution 3:

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.

Solution 4:

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.

Solution 5:

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"