aws-samples / aws-samples/aws-codedeploy-samples

Failed deployments using ASGs and elb scripts reduce ASG capacity

Aperta
#70 6 commenti 3 reazioni 0 assegnatari Vedi su GitHub
bug enhancement
Lingua principale
Shell
Stelle
639
Fork
778
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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](https://github.com/awslabs/aws-codedeploy-samples/blob/master/load-balancing/elb/common_functions.sh#L299) so that ASG does not spin up a new instance, and when the host goes back into service, the [ASG min size gets incremented](https://github.com/awslabs/aws-codedeploy-samples/blob/master/load-balancing/elb/common_functions.sh#L394). 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](https://github.com/awslabs/aws-codedeploy-samples/blob/master/load-balancing/elb/common_functions.sh#L311) 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](http://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-elastic-load-balancing.html). As of 5/1/17, [CodeDeploy started supporting classic ELB](https://aws.amazon.com/about-aws/whats-new/2017/05/aws-codedeploy-now-integrates-with-elastic-load-balancing/) 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](http://docs.aws.amazon.com/codedeploy/latest/userguide/integrations-aws-elastic-load-balancing.html) 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.