Run autoscaling group on spot instance in a smart way


Spot fleet is good, but it may not fit every use case. E.g you can not easily shutdown the non-prod environment with spot fleet, due to its scalable target only allows 1 – 3000. In some scenarios, running autoscaling group on spot instance is a better way to go.

And essentially, it is all about the launch configurations and spot instance request. I developed a bot (named Huggies) to manipulate it. Here is a quick demo.

This is how a typical autoscaling group looks like. Lets say I name my autoscaling group as newsapi-jackie for convenience.

huggies_01.jpg

Now I am telling Huggies to use spot instance for my environment by giving the bidding request (bid m1.small for 0.001 per hour).

huggies_02_cmd.png

Under the hood, Huggies makes a copy of the existing launch configurations then add the bidding parameters into it.

huggies_02.jpg

To spin up new instances, I need to tell Huggies to start my environment.

huggies_03_cmd.png

Start/Stop environment is just a matter of updating the minimum and maximum size of the autoscaling group.

huggies_03.jpg

However my bid price $0.001 is too low to get a m1.small instance. But fortunately Huggies is smart enough to know it, and make a new bid price for me.

huggies_04_cmd.png

How does Huggies know it?

huggies_04.jpg

Huggies logs it as:

low_price.png

 

What if I want to change back to on-demand instance or the spot instance is out of capacity?

huggies_06_cmd.png

Huggies will switch back to the original launch configuration if spot instance is out of capacity or user asks so.

huggies_06.jpg

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s