1
votes

We trigger autoscaling on a TargetResponseTime threshold. Launch and turning healthy for new EC2 instance takes close to 20 mins. When we check the codedeploy we see two kinds of time, one in Deployment history start time Aug 22, 2019 3:10 PM and end time Aug 22, 2019 3:28 PM. Going to that particular deployment, we see duration as 2 minutes 21 seconds, from ApplicationStop to AfterAllowTraffic. Where is the rest of the time spent? Why is that Deployment history shows 18 mins whereas the deployment time is 2 mins 21 sec?

How can we reduce this time?

Background: To launch EC2 instance by autoscaling we have a launch configuration that installs the codedeploy agent. The instance would be in Pending:Wait state in Auto Scaling Group Instances' lifecycle, with a hook CodeDeploy-managed-automatic-launch-deployment-hook-DGENSVPC1b-f51a955c-194e-4a51-ad9b-1489101325ba autoscaling:EC2_INSTANCE_LAUNCHING,ABANDON,600

2

2 Answers

0
votes

It's hard to say without more visibility into your system. It could range from your tasks within your EC2 User Data or ELB health check settings. Could you take another look at the different CodeDeploy lifecycle events and see where the time is aggregating? E.g. If you view the specific CodeDeploy action, you can "view events" to see a list of deployment lifecycle events and the time it took to complete each of them. After you find out what's taking the longest time, you can began to narrow down the root cause.enter image description here

0
votes

Using Amazon's AMI instead of custom AMI helped reduce this time to ~5-6mins from the previous 20mins.