This is a code snippet I am using to manipulate my EC2 instance.
$ec2 = Aws::factory(array(
'key' => $key,
'secret' => $secret,
'region' => $region)
)->get('ec2', true);
$volId = createVol();// This step creates the volume correctly
$ec2->waitUntil('__VolumeStatus', array(
'VolumeIds' => array($volId),
'waiter.success.value' => VolumeState::AVAILABLE
));
attachVolume();//Error
The problem is attachVolume function is throwing error that volume is not available that means waitUntil function is not working correctly. Is there somethings wrong with the way I called this function?
It seems that the EC2 API is eventually consistent. So waiters are working correctly but sometimes the API is returning the wrong statuses
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/query-api-troubleshooting.html
http://blog.cloudfoundry.com/2013/06/18/dealing-with-eventual-consistency-in-the-aws-ec2-api/