How to recover from failed deploy when using ASG lifecycle scripts?

Open
#42 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
aws, shell

Research direction

Start by reviewing register_with_elb.sh, deregister_from_elb.sh, and the deploy scripts that run between them. Reproduce the failed deployment and inspect how CodeDeploy handles the ASG instance afterward. Done means a failed deploy restores normal ASG capacity and moves the instance out of Standby without manual intervention.

Written by the indexing model from the issue text.

Description

bug

We just started using CodeDeploy with ASG and ELB, and we achieve zero downtime when we use register_with_elb.sh and deregister_from_elb.sh. Today I simulated a situation where a deploy step before deregister_from_elb.sh fails. In that case, the server instance in ASG stays in Standby mode and the capacity of ASG is decreased by one because deregister_from_elb.sh is never executed.

Currently, I have to manually increase the ASG capacity back to normal and move the server instance out of Standby. This isn't acceptable. Is there a way to do proper cleanup automatically after a failed deploy?

The only way that came to my mind is to add error handling logic to every deploy script I run between register_with_elb.sh and deregister_from_elb.sh scripts.

Dominant language
Shell
Stars
639
Forks
777
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aws-samples/aws-codedeploy-samples

All issues in aws-samples/aws-codedeploy-samples

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.