EC2 – How do you tell the ELB when the machine is "ready"

rh0dium asked:

I have a autoscaling setup with monitoring and all is well. The process for code deployment is now well in hand and basically does this.

  1. Create a new launch_config which defines the git commit to pull
  2. Update the autoscale group with the new launch config.
  3. Scale up the min-size of the servers to ~2x what we have.
  4. Wait for them all to come online
  5. Scale down and the old ones get knocked off.

The problem that I am seeing is that while we are “waiting for them to come online” they are reporting “healthy” and “in service” before they are “ready” for service as they are updating the packages and pulling the relevant source code. This time varies greatly from 2 minutes to > 15 minutes per EC2 instance.

What I’m looking for is a way do you set the “in service/healtny” flag manually, or a better strategy for dealing with this lag.

I will note that when the instance fires off Nginx is started automatically. Is that what determines whether the instance is healthy? There is so little documentation (that I can find) on this process of boot to ready – any help would be appreciated.

This is behind an ELB if that helps. Health checks are enabled “/”. I wonder if it’s as simple as that..


My answer:

The Elastic Load Balancer health check determines whether ELB sends traffic to any particular instance.

What you want to do is very simple:

Don’t start the web server on your instances until you’ve finished bringing them up and configuring them.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.