You Should Move Compute To AWS EC2 Spot Instances

GorillaStack
3 min readMar 29, 2016

--

Amazon are celebrating 10 years of AWS. On Amazon’s celebration page, they include an interesting insight regarding EC2 Spot Instances:

“On average, every week, AWS customers are using more compute capacity on Amazon EC2 spot instances than customers in 2012 were running across all of Amazon EC2”https://aws.amazon.com/10year

Although many customers are utilising spot instances, AWS have made it so easy to launch on-demand instances that customers typically have the majority of their compute on the more costly on-demand pricing model.

Spot instances require the customer to identify the types of workload that can be handled by spot instances and understand the bidding process.

Spot instances can suit workloads that are time flexible and not sensitive to interruption e.g. Media encoding, scientific computing or financial modelling. Spot instances integrate with other services such as Auto Scaling, VPC, CloudFormation and EMR so they can be incorporated into existing architectures.

Spot Bid Advisor

To make a spot instance request, a bid price must be submitted. Spot Bid Advisor gives customers an idea how likely a bid price of 25%, 50% and 100% of the on-demand instance price is likely to be outbid. Example for 25% of the on-demand price for m3.medium instances in the Asian Pacific (Sydney) region right now:

From this, it looks likely that we can get some m3.medium spot instances for 25% of the on-demand price. The on-demand price is currently $0.093 per hour in Sydney (https://aws.amazon.com/ec2/pricing) so $0.02 could be a high enough bid price.

Spot Instance CloudFormation Template

To illustrate this, GorillaStack have open sourced this CloudFormation template to create a spot request for a 2 instance “fleet” of m3.medium instances for $0.02 per hour each: You can grab it from GorillaStack Github now.

Spot Fleets are a convenient way to manage EC2 spot instances. A fleet can be anything from one EC2 instance to thousands that are all working together as part of a distributed application. The instances may come and go from time to time as Spot prices change or if the fleet’s capacity is updated, but the fleet itself retains its identity and its properties.

At GorillaStack, we are relentless at finding AWS Cost Optimsations and spot instances & fleets can help to reduce cost.

“You can save up to 90% [using spot instances] compared to on-demand prices.” — AWS EC2 console (beta version).

Spot Bid Advisor is a good resource but we need to programmatically determine prices to automate anything. AWS provide spot price history for the past 90 days through their CLI and SDKs. Check out this example that uses the JavaScript SDK to get spot price history for m3.medium Linux/UNIX instances in all Sydney availability zones:

0.014500 was the price which you have to bid to guarantee that a single Spot request is fulfilled which later rose to 0.014700. If your bid price is below 0.014700 then AWS will terminate your spot instance(s) that are in service. Your bid price will be a trade off against uptime and speed of request fulfilment. Just like the financial markets: Keep in mind that the historical trends are not a guarantee of future results.

We believe that there’s a significant opportunity for AWS technology partners such as GorillaStack to help companies with their forays into the spot instance market space. Follow us to keep an eye on future developments.

In the meantime, what would help your company utilise spot instances? We’re constantly looking for ways to help our customers save money in the Cloud.

Happy bidding.

Originally published at blog.gorillastack.com on March 29, 2016.

--

--

GorillaStack

AWS Cost Management — Be a DevOps Hero with our automated cost optimisation software for Amazon Web Services