Git Product home page Git Product logo

Comments (7)

leeper avatar leeper commented on August 24, 2024 1

The EC2 API has an endpoint for it, but I haven't implemented it yet. I would gladly welcome a pull request implementing it!

from aws.ec2.

dselivanov avatar dselivanov commented on August 24, 2024

@leeper thx! will take a look.

from aws.ec2.

peterfoley avatar peterfoley commented on August 24, 2024

We currently kick out to the aws cli tools for some requests that aren't implemented here yet. Specific ones that I see in our code are request-spot-instances, describe-spot-instance-requests, cancel-spot-instance-requests, describe-spot-price-history, so those 4 (or at least the first 3) seem like the minimal set required for managing spot requests.

I'd be happy to collaborate on getting those working within aws.ec2 itself.

from aws.ec2.

leeper avatar leeper commented on August 24, 2024

Would be great to have this. If you can at least outline how you're currently using those commands, it should be pretty simple to incorporate this into the package as a set of related functions.

from aws.ec2.

peterfoley avatar peterfoley commented on August 24, 2024

Our basic workflow for spinning up the machines looks like:

  • construct spot request json file for the cli tool (not needed for query API)
    • that contains stuff like ImageId, KeyName, SecurityGroupIds, UserData, InstanceType, SubnetId, Monitoring, and optionally IamInstanceProfile
  • place the spot request using aws ec2 request-spot-instances
    • here we also specify the spot price, instance count, expiration, and path to the json file
    • it returns us json describing a set of SpotInstanceRequests (ex. if you request 5 instances, SpotInstanceRequests will be a length-5 array)
  • we poll aws ec2 describe-spot-instance-requests with the request ID's that haven't started yet. As requests are fulfilled we store the instance id's that were started by each request.
  • once the instances start machines or the requests time out, we cancel the requests with aws ec2 cancel-spot-instance-requests so they don't count against our limits (cancelling the request does not terminate the machine that the request started)

from aws.ec2.

peterfoley avatar peterfoley commented on August 24, 2024

Recent API changes have made this much easier -- it's just a matter of run_instances adding additional parameters in query before calling ec2HTTP. ec2HTTP call also has to be passed version="2016-11-15", because earlier versions don't accept InstanceMarketOptions. I'm finalizing a patch that I'll be submitting shortly.

from aws.ec2.

leeper avatar leeper commented on August 24, 2024

I think this was fully closed by #34. If not, I'll reopen.

from aws.ec2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.