But its tough to decide on to estimate how long a machine might take to
reach STOPPED state.

Anyway other option would be check the node state again and send the
confirmation.

Yes, sorry, this is what I meant. I agree that inserting a "hopeful pause" is probably too brittle; what is probably needed here is something like:

for (i = 0 to max_attempts) {
  if stopped(instance) break
  sleep(pause_time)
}

The AWS API more or less "recommends" this as an approach by providing an explicit command for this:

http://docs.aws.amazon.com/cli/latest/reference/ec2/wait/instance-stopped.html

Regards

ap

Reply via email to