title: EC2: Waiting until a new instance is in running state
body: <p>I would like to create a new instance based on my stored AMI.</p>
  
  <p>I achieve this by the following code:</p>
  
  <pre><code>RunInstancesRequest rir = new RunInstancesRequest(imageId,1, 1);
  // Code for configuring the settings of the new instance
  ...
  RunInstancesResult runResult = ec2.runInstances(rir);
  </code></pre>
  
  <p>However, I cannot find a wait to "block"/wait until the instance is up and running apart from Thread.currentThread().sleep(xxxx) command.</p>
  
  <p>On the other hand, StartInstancesResult and TerminateInstancesResult gives you a way to have access on the state of the instances and be able to monitor any changes. But, what about the state of a completely new instance?</p>