Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

waitFor spotInstanceRequestFulfilled doesn't wait. #642

Closed
amiorin opened this issue Jun 26, 2015 · 2 comments · Fixed by #647
Closed

waitFor spotInstanceRequestFulfilled doesn't wait. #642

amiorin opened this issue Jun 26, 2015 · 2 comments · Fixed by #647

Comments

@amiorin
Copy link

amiorin commented Jun 26, 2015

The status is pending-evaluation and not fulfilled.
I tried the callback version too. Same problem. Did a miss anything in the api docs?

'use strict';

let co = require('co');
let promise = require('bluebird');
let prettyjson = require('prettyjson');
let AWS = require('aws-sdk');
let ec2 = new AWS.EC2({apiVersion: '2015-04-15', region: 'eu-west-1'});
let waitFor = promise.promisify(ec2.waitFor.bind(ec2));
let requestSpotInstances = promise.promisify(ec2.requestSpotInstances.bind(ec2));

co(function*() {
  let spotId = yield startSpotInstance();
  let res = yield waitFor('spotInstanceRequestFulfilled', {SpotInstanceRequestIds: [spotId]});
  console.log(prettyjson.render(res.SpotInstanceRequests[0]));
}).catch(function(e) {
  console.log(e);
});

function* startSpotInstance() {
  let params = {
    SpotPrice: '0.004',
    InstanceCount: 1,
    LaunchSpecification: {
      ImageId: 'ami-5da23a2a',
      InstanceType: 't1.micro',
      KeyName: '***',
      Monitoring: {
        Enabled: true
      },
      NetworkInterfaces: [{
          AssociatePublicIpAddress: true,
          DeleteOnTermination: true,
          DeviceIndex: 0,
          SubnetId: 'subnet-***',
          Groups: [
            'sg-***'
          ]
      }],
      Placement: {
        AvailabilityZone: 'eu-west-1b'
      }
    },
    Type: 'one-time'
  };
  return (yield requestSpotInstances(params)).SpotInstanceRequests[0].SpotInstanceRequestId;
}
@AdityaManohar
Copy link
Contributor

@amiorin
I can replicate this issue, and I'm working on a fix for this. I should have it out in master soon.

Thanks very much for reporting!

@lock
Copy link

lock bot commented Sep 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants