Support wait_until :instance_pending
Closed this issue · 4 comments
Currently wait_until supports running, stopped and terminated for instances according to http://docs.aws.amazon.com/sdkforruby/api/frames.html.
It would be useful to support pending as well. This is predominantly a timing optimisation, presuming pending happens quicker than running.
The valid states are: pending | running | shutting-down | terminated | stopping | stopped
. An instance is pending immediately after you request to run an instance. It remains pending until it has reach the running state. I'm not sure I see the value of pending as that is the state it starts in.
The situation that arose was:
- run_instances creates an instance, and returns an instance id
- create_tags fails because the instance doesn't exist yet
The majority of times this works, but we've seen transient failures, presumably down to eventually consistent data stores behind the scenes. The theory was that a wait for pending would further reduce the occurrence of this issue, without the much longer time spend waiting for running.
Ultimately, I'd love to be able to create and tag an instance (even just the Name tag) within a transaction/single HTTP request.
If tagging on instance create were possible, that would be the best solution.
I'm not certain how a pending waiter should work. When the #run_instances
call returns, it gives a list of new instances for that reservation, and each of those instances has a pending state. There is no state before pending, so the waiter would terminate straightway.
Have you considered a simple sleep(2)
or similar manual delay?
Closing old issues from the old-repo. If you'd like to discuss this issue further, hop into the gitter channel gitter.im/aws/aws-sdk-ruby or open the issue in aws/aws-sdk-ruby.