Last week, I worked with AWS to launch spot instances for the first time. We did this to test the Voila-Deer using traffic replayed from production with the help of Gor. Thanks to Emils, I got a nice first-time tour of the world of AWS. For someone who hasn’t worked with the AWS console, the simple task of spinning up an auto scaling group and adding the spot instances to the elastic load balancer can be a quite daunting.
It all comes down to costs. It’s important to know that spot instances can be lost quickly as explained here by Adam. Setting the maximum cost for the spot instance (the cost that we are willing to pay in order to not lose the instance), gives us the advantage of not overpaying like if we were running regular AWS instances. In our case, we wanted to test the Voila-Deer in the staging environment, therefore, we didn’t mind losing the instance as it wouldn’t blow up something important. At the moment, we are setting the maximum price a bit over the regular price so we can avoid losing the instances at the peak time.
launching spot instances
The first thing that came to my mind was to create separate AWS instances and then manually add them to one auto scaling group and to the elastic load balancer. However, thanks to the launch configurations, it’s much easier to start up multiple spot instances. Additionally this allows us to stop the spot instances and use the launch configuration later to quickly start up the ones that already are under one ASG and ELB. We need to select the AWS instance type and add a Puppet configuration that would deploy all the specified services on the instances.
ready for a launch
From this experience, I learnt why we use spot instances and the importance of setting the maximum price that we are willing to pay per hour.
If you enjoyed the read, drop us a comment below or share the article, follow us on Twitter or subscribe to our #MetaBeers newsletter. Before you go, grab a PDF of the article, and let us know if it’s time we worked together.