8

I've been using AWS CodeDeploy to push our applications live, but it always takes ages doing the BlockTraffic and AllowTraffic steps. Currently, I have an application load balancer(ALB) with three EC2 nodes initially(behind an autoscaling group). So, If I do a CodeDeploy OneAtATime, the whole process takes up to 25 minutes.

The load balancer I'm using it with had connection draining set to 300s. I thought it was the reason for drag out. However, I disabled Connection Draining and got the same results. I then enabled Connection Draining and set timeout to 5 seconds and still got the same results.

Further, I found out CodeDeploy depends on the ALB Health Check settings. according to the AWS documentation

After an instance is bound to the ALB, CodeDeploy waits for the status of the instance to be healthy ("inService") behind the load balancer. This health check is done by ALB and depends on the health check configuration.

So I tried by setting low timeouts and thresholds for health check settings. Even those changes didn't reduce the deployment time much.

Can someone direct me to a proper solution to speed up the process?

Chamin Wickramarathna
  • 1,672
  • 2
  • 20
  • 34

1 Answers1

9

The issue is the de-registration of instances from the AWS target group. You want to change this value:

enter image description here

or find a way to update the deregistration_delay.timeout_seconds property - by default it's 300s, which is 5 minutes. The docs can be found here).

Prisoner
  • 27,391
  • 11
  • 73
  • 102
  • 1
    I set deregistration delay to 30 seconds, with 2 of 10 second health checks, but the BlockTraffic step is still consistently taking 1m30s, whereas it should be ~40s. AllowTraffic only takes 20 seconds. Any idea what else could cause it? – timetofly Aug 31 '20 at 15:16
  • Maybe need to restart the codedeployagent again. not sure. – Santosh Nov 23 '22 at 14:36