Launching spot instances?

How can I launch spot instances using “knife ec2 server create”? I don’t
see any relevant command line switches.

Thanks for the help.

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I don't
see any relevant command line switches.

Thanks for the help.

I do not think it is a bad idea to add spot instance functionality to knife
ec2. Spot instances are great, not only because they are very inexpensive,
but because you can set an end date for your reservation. Load testing,
staging, queue workers, batch jobs, and map reduce are examples of
potential use cases. In cases where it would be ideal, but is not necessary
for a spot instance to stay up, you can bid higher than the on-demand
price. It is pretty rare for spot prices to exceed on-demand, so you will
most likely still save money with this tactic.

I think it is possible to add this functionality to knife ec2. You would
monitor the status of the bid request until it is fulfilled. It would
probably be ideal to write a basic cookbook to manage cleaning up the
nodes/clients when the spot instances are terminated.

Here is a blog on the new Spot Instance Status API:
http://aws.typepad.com/aws/2012/10/amazon-ec2-spot-instance-bid-status.html

James

On Thu, Oct 25, 2012 at 6:56 AM, Mike miketheman@gmail.com wrote:

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I don't
see any relevant command line switches.

Thanks for the help.

I could see a "knife ec2 stack create" that used a default cloud formation stack json and passed in the parameters. This could be customized then to run spot instances.

The issue with knife and spot instances is that they can take up to 15 minutes to start up. Basically (as I understand it) there is a batch job that takes the pool of bids and the available capacity and determines what to start and what to kill on a scheduled basis. That means that your request for spot instances cannot be instantaneous. This is not a model that the knife ec2 plugin can support.

--
Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Oct 25, 2012, at 6:56 AM, Mike wrote:

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I don't
see any relevant command line switches.

Thanks for the help.

James,

All the points about spot instances you reference are correct.

What I think I was trying to convey is that the behavior currently of
knife-ec2 is to perform the requested steps (provision, ssh,
bootstrap) in sequence, and exit upon completion.

How would you propose to do that with spot instances that are
_not_granted immediately? The request at the price is still made, and
will open up when available, but may not launch right now. There also
may be more than 1, and knife

Would the operator expect the shell session to remain open until one
spot instance is launched, so it can then perform bootstrapping, role
assignment etc? That is not a very tempting scenario to me.

I think a better use case for the utterly specific use case of spot
instances would be to leverage AWS's api and model, potentially
pre-bake your own AMI with a default chef client.rb and validation.pem
for your organization (and roles?) , so that when a spot request
launches, it can boot, register with chef, get the latest cookbook
code and run until it's terminated.

That's why I don't think this is a good fit for knife ec2 server create.

On Fri, Oct 26, 2012 at 3:09 PM, Jeffrey Hulten jeffh@automatedlabs.com wrote:

I could see a "knife ec2 stack create" that used a default cloud formation stack json and passed in the parameters. This could be customized then to run spot instances.

The issue with knife and spot instances is that they can take up to 15 minutes to start up. Basically (as I understand it) there is a batch job that takes the pool of bids and the available capacity and determines what to start and what to kill on a scheduled basis. That means that your request for spot instances cannot be instantaneous. This is not a model that the knife ec2 plugin can support.

--
Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Oct 25, 2012, at 6:56 AM, Mike wrote:

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I don't
see any relevant command line switches.

Thanks for the help.

Mike,

There are a number of ways to implement this, but it is not currently on my
or our roadmap, so I haven't put much thought into how I would design it. I
can say that this would benefit us, but not enough to warrant the effort
currently. We don't generally use knife ec2 to provision on EC2, we're
almost eliminating usage of EC2 org-wide, and in the use-case that is most
important for us to use spot instances (map reduce), we do so using boto +
custom stuff.

Most single instance reservations I make get filled quickly, but you could
definitely add some logic around this process in a number of different
ways. You could allow a timeout to define when to stop waiting and cancel
the bid. You could allow a price range as a parameter. I don't think any of
the other knife compute gems support creating multiple instances
simultaneously, so multiple instance reservations are probably not a
necessary feature.

Your implementation could work for some use cases.

Spot instances are a really great way to drop the cost of EC2, just have to
be aware of, and work around, limitations.

James

On Fri, Oct 26, 2012 at 2:07 PM, Mike miketheman@gmail.com wrote:

James,

All the points about spot instances you reference are correct.

What I think I was trying to convey is that the behavior currently of
knife-ec2 is to perform the requested steps (provision, ssh,
bootstrap) in sequence, and exit upon completion.

How would you propose to do that with spot instances that are
_not_granted immediately? The request at the price is still made, and
will open up when available, but may not launch right now. There also
may be more than 1, and knife

Would the operator expect the shell session to remain open until one
spot instance is launched, so it can then perform bootstrapping, role
assignment etc? That is not a very tempting scenario to me.

I think a better use case for the utterly specific use case of spot
instances would be to leverage AWS's api and model, potentially
pre-bake your own AMI with a default chef client.rb and validation.pem
for your organization (and roles?) , so that when a spot request
launches, it can boot, register with chef, get the latest cookbook
code and run until it's terminated.

That's why I don't think this is a good fit for knife ec2 server create.

On Fri, Oct 26, 2012 at 3:09 PM, Jeffrey Hulten jeffh@automatedlabs.com
wrote:

I could see a "knife ec2 stack create" that used a default cloud
formation stack json and passed in the parameters. This could be customized
then to run spot instances.

The issue with knife and spot instances is that they can take up to 15
minutes to start up. Basically (as I understand it) there is a batch job
that takes the pool of bids and the available capacity and determines what
to start and what to kill on a scheduled basis. That means that your
request for spot instances cannot be instantaneous. This is not a model
that the knife ec2 plugin can support.

--
Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Oct 25, 2012, at 6:56 AM, Mike wrote:

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I
don't
see any relevant command line switches.

Thanks for the help.

James,

As I mentioned, it seems like using the spot instance market via
direct api tools such as boto makes more sense than an interactive
knife session.
We also use spot instances for MapReduce, and use API tools for that -
not knife-ec2.

If you'd like to design and implement it, I'm sure it would make
Christopher (original thread starter) happy. :slight_smile:

Again, I'll reiterate - knife-ec2 plugin seems to provide the "I need
an instance now, please assign resources and bootstrap it" resource.
For multiple ec2 instances on the regular market, I've used
spiceweasel by Matt Ray (GitHub - mattray/spiceweasel: Generates Chef knife commands from a simple JSON or YAML file.) and
it's been a charm.

-Mike

On Sat, Oct 27, 2012 at 7:47 PM, James js@aegisco.com wrote:

Mike,

There are a number of ways to implement this, but it is not currently on my
or our roadmap, so I haven't put much thought into how I would design it. I
can say that this would benefit us, but not enough to warrant the effort
currently. We don't generally use knife ec2 to provision on EC2, we're
almost eliminating usage of EC2 org-wide, and in the use-case that is most
important for us to use spot instances (map reduce), we do so using boto +
custom stuff.

Most single instance reservations I make get filled quickly, but you could
definitely add some logic around this process in a number of different ways.
You could allow a timeout to define when to stop waiting and cancel the bid.
You could allow a price range as a parameter. I don't think any of the other
knife compute gems support creating multiple instances simultaneously, so
multiple instance reservations are probably not a necessary feature.

Your implementation could work for some use cases.

Spot instances are a really great way to drop the cost of EC2, just have to
be aware of, and work around, limitations.

James

On Fri, Oct 26, 2012 at 2:07 PM, Mike miketheman@gmail.com wrote:

James,

All the points about spot instances you reference are correct.

What I think I was trying to convey is that the behavior currently of
knife-ec2 is to perform the requested steps (provision, ssh,
bootstrap) in sequence, and exit upon completion.

How would you propose to do that with spot instances that are
_not_granted immediately? The request at the price is still made, and
will open up when available, but may not launch right now. There also
may be more than 1, and knife

Would the operator expect the shell session to remain open until one
spot instance is launched, so it can then perform bootstrapping, role
assignment etc? That is not a very tempting scenario to me.

I think a better use case for the utterly specific use case of spot
instances would be to leverage AWS's api and model, potentially
pre-bake your own AMI with a default chef client.rb and validation.pem
for your organization (and roles?) , so that when a spot request
launches, it can boot, register with chef, get the latest cookbook
code and run until it's terminated.

That's why I don't think this is a good fit for knife ec2 server create.

On Fri, Oct 26, 2012 at 3:09 PM, Jeffrey Hulten jeffh@automatedlabs.com
wrote:

I could see a "knife ec2 stack create" that used a default cloud
formation stack json and passed in the parameters. This could be customized
then to run spot instances.

The issue with knife and spot instances is that they can take up to 15
minutes to start up. Basically (as I understand it) there is a batch job
that takes the pool of bids and the available capacity and determines what
to start and what to kill on a scheduled basis. That means that your request
for spot instances cannot be instantaneous. This is not a model that the
knife ec2 plugin can support.

--
Jeffrey Hulten
Principal Consultant at Automated Labs, LLC
jeffh@automatedlabs.com 206-853-5216
Skype: jeffhulten

On Oct 25, 2012, at 6:56 AM, Mike wrote:

While the underlying library fog may provide this functionality, this
actually seems less useful to be part of the knife-ec2 command set.

knife ec2 server create attempts to create an instance, wait for it
to come up, bootstrap it via ssh, and start up chef-client (usually).

From what I garner, placing a spot request with a bid provide is not
ensured to be delivered at the time pf placing the request, and
therefore the flow of what "ec2 server create" does today would not be
the same, rather it seems like it would be: "If I can get a spot
request now, please give it to me, otherwise...?" Fail? The bid
request was probably placed, so this isn't a failure per se.

The other part of why I think this might not be a great idea is: Spot
instances come up and down whenever their bid price is met or outbid
respectively. This can cause easy buildup of cruft in your node/client
list if you are allowing these to auto-register/validate themselves,
and then have to clean up after them once they are gone.

All in all, I think spot instances have a use case, but I don't know
if during ec2 server create (and subsequently bootstrap phase) makes
sense to support this.

On Wed, Oct 24, 2012 at 1:44 PM, Christopher J. Bottaro
cjbottaro@academicworks.com wrote:

How can I launch spot instances using "knife ec2 server create"? I
don't
see any relevant command line switches.

Thanks for the help.