by maciej on April 28, 2016

Running Boost Machine Images on Spot Instances

One of the nifty features of AWS is that one can utilize spot instances over on-demand instances in order to significantly reduce costs. To use spot instances, we need to create a spot instance request which includes a maximum price that we are willing to pay per hour, as well as a few other constraints such as the instance type and availability zone. You can find a detailed discussion of all the AWS spot instance parameters in the following AWS user guide.

All Bitfusion Machine Images can be run on top of spot-instances. While launching a spot instance is a fairly simple process, AWS does not make it easy to launch an AWS Marketplace AMI on a spot instance from the EC2 console. As a matter of fact, AWS pretty much discourages you from launching AWS Marketplace AMIs on spot instances from the EC2 console by graying out the check-box and making spot instances unavailable during the launch process.

request spot instance

Does this mean that one cannot start a Marketplace Machine Image on top of a spot instance? Of course not, so how do you do it?

To launch an AWS Marketplace AMI on a spot instance you need to launch it from the AWS Marketplace directly using the "manual launch" option.

Before we start, we first need to navigate to the AWS Marketplace and find the AMI that we are trying to launch. Interestingly enough, the EC2 console provides a link in the most bottom right corner, titled "Find more software on AWS Marketplace" which will take you precisely where you need to go. If you are looking for Bitfusion AMIs in the AWS Marketplace you can use this link which will list all the available Bitfusion AMIs.

For the rest of this tutorial we will be using the Bitfusion Boost Ubuntu 14 Cuda 7.5 AMI to demonstrate how to quickly launch an AMI on an AWS spot instance. However, this procedure will work with any AMI in the AWS Marketplace.

First, find the proper AWS Marketplace AMI product page

Bitfusion Boost Ubuntu 14 Cuda 7.5

Next, click on the bright orange "Continue" button towards to top right-hand side. At this point, if you are not logged in, you will be prompted to log into AWS.

AWS Log In Screen

Next, be sure to click on the "Manual Launch" tab as shown below, and then the orange "Accept Software Terms" button on the top right.

manual launch / accept software terms

Next you will receive a screen confirming your subscription and prompting you to re-fresh your page. You may need to wait at this point for a minute or two and refresh the page a couple of times, but eventually you will see the gray "Launch with EC2 Console" buttons change to blue towards the center of the page. Once they are blue you can click them to launch the AMI in the desired region.

Confirmation Screen

For the purpose of this tutorial we selected the button next to US East (N. Virginia), which leads us to the familiar Instance Type selection screen in the EC2 console, where we selected the g2.2xlarge instance and then clicked the gray "Next: Configure Instance Details" button.

Instance Type

Finally we are presented with the screen we have been looking for. We are now able to click the "Request Spot instance" check-box and then we are shown the current spot prices in that region. In the "Maximum price" box we can now specify the maximum hourly price that we are willing to pay for the g2.2xlarge instance.

Instance Details

The price you specify is up to you, but be sure to always check the spot-price against the on-demand price. While most of the time the spot price is a fraction of the on-demand price, should there be a sudden spike in demand, it can be higher than the on-demand price.

In the example above, we are willing to pay up to $0.65/hr for the g2.2xlarge, and we can see that the spot price in several availability zone is significantly below that, as such we could realize a saving of about 33% over the on-demand price and in many cases the savings can be significantly higher. At this point the rest of the flow for specifying the instance parameters will be similar to the regular on-demand flow. You will see that some of the windows here and there may have button titles which are slightly different, such as the modal below which shows "Request Spot Instances" instead of "Request Instances."

Key Pair

That's it, you  are all done. The instance requests may take a bit longer to fulfill than an on-demand instance request, however you will be rewarded with significant cost savings by running AWS Marketplace AMIs on top of spot instances. Be sure that you understand the fact that AWS can take away spot instances from you if there is significant demand, meaning your system will be terminated without warning.  When they do take spot instances away, they start with the lowest bid prices, so be sure to set your maximum price at a reasonable level or risk having your instance taken away.

Topics: tutorial, machine images


Bitfusion VMware
Solution Guide

Download Guide

Bitfusion Elastic AI Platform

Try FlexDirect Today