Failed deployments using ASGs and elb scripts reduce ASG capacity

Open
#70 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start in load-balancing/elb/common_functions.sh, especially the deregistration logic around lines 299-311 and restoration around line 394. Reproduce or trace a failed deployment involving an ASG, then inspect how the temporary flag is handled; done means capacity reductions are restored after failure, including multiple hosts, or the issue is confirmed superseded by CodeDeploy ELB support.

Written by the indexing model from the issue text.

Description

bug enhancement

During the deregister scripts, if the host is a part of an ASG and min size matches desired size, the ASG min size setting gets decremented so that ASG does not spin up a new instance, and when the host goes back into service, the ASG min size gets incremented. However, if the deployment fails, the script will never increase the capacity, leaving the ASG with one less min size. Since putting a host into standby reduces the desired capacity, an ASG could have its min size reduced by multiple hosts during a deployment, and it will never be increased back to where it was.

When the min size gets decremented, a flag gets set in a temporary file that's around for the life of the deployment, but will not be viewed by any subsequent deployments. One option might be to set the flag in a permanent location to track the state mutations.

Issue #57 is an example of this.

Supported Solution

If CodeDeploy customers are not aware, CodeDeploy has direct support for some ELB situations. As of 5/1/17, CodeDeploy started supporting classic ELB via the service, which handles all of the registering and deregistering from the load balancer and allows additional lifecycle events, and it solves many of the limitations in these scripts. If your use case is not currently supported (i.e. you use application ELB), check in occasionally here to see if CodeDeploy has added support.

If you onboard with CodeDeploy ELB support, you should no longer need to use these load balancer 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.