amazon ec2 - AWS EC2 Spot request fulfillment waiter from PHP SDK waits indefinitely -


i'm trying through eventual consistency of spot instance can assign within application. here's i've seen, simple spot instance call.

the instance requested started (fast 15-30 second instance running state), waiter continues indefinitely.

i'm not sure if issue lies code, sdk, or aws not fulfilling request quickly.

$spotec2client = $this->sdk->createec2([]);  // create instance via spot request $result        = $spotec2client->requestspotinstances($spotconfig); $spotresult    = $result->getpath('spotinstancerequests'); $spotrequestid = $spotresult[0]['spotinstancerequestid'];  $now = date("f d, y h:i:s a"); echo "spot request id is: $spotrequestid\n"; echo "starting @ $now mst\n"; $spotec2client->waituntil(     'spotinstancerequestfulfilled',     [         'spotinstancerequestid' => $spotrequestid,         '@waiter' => [             'before' => function (commandinterface $command, $attempts) {                 $now = date("h:i:s");                 printf(                     "[$now] send %s. attempt %d\n",                     $command->getname(),                     $attempts                 );             }         ],     ] ); 

output:

spot request id is: sir-<my request id> starting @ august 18, 2017 10:10:20 mst [10:10:20] send describespotinstancerequests. attempt 1 [10:10:21] send describespotinstancerequests. attempt 2 [10:10:36] send describespotinstancerequests. attempt 3 [10:10:52] send describespotinstancerequests. attempt 4 [10:11:07] send describespotinstancerequests. attempt 5 [10:11:23] send describespotinstancerequests. attempt 6 [10:11:38] send describespotinstancerequests. attempt 7 

comparing check times against launch time:

spot instance launch time

i'm thinking need own polling against describeinstances looking spot instances @ running or init, , handle on own - because call describespotinstancerequests goes on indefinitely far i've been able tell.

i had misformatted argument spotrequestid. , kindly pointed out me on aws php sdk's github!

the formatting of spot instance request required plural , array argument.

$spotec2client->waituntil(     'spotinstancerequestfulfilled',     [         'spotinstancerequestid' => $spotrequestid,     ]     ... 

to be:

$spotec2client->waituntil(     'spotinstancerequestfulfilled',     [         'spotinstancerequestids' => [             $spotrequestid     ]     ... 

i think api user prefer exception or maybe warning incorrect argument that's discussion place.


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -