Here at nClouds, we build cloud infrastructures for various companies. Spot instances is the equivalent of running chaos monkey. Instances can go away anytime. But it helps us to think in terms of automation. And of course, one of the biggest advantage is that you can save lots of money without having to deal with the complexity of reserved instances.
When to use Spot Instances ?
1. Batch Processing – Job Queues – Worker Process
2. High Performance Computing
3. Massive Scaling (Minimum number being on-demand)
4. Slaves (Kubernetes, Mesos) (Masters being on-demand)
5. DEV/QA Environment where small downtimes are acceptable
What we do:
1. Bring the instances to desired state, when they come up using Opsworks by registering to layer
2. Remove deceased instances from Opsworks Layer using Lambda
Things to note:
1. We are using Spot Fleet to maintain desired capacity and mix different instances
2. We use mix of instances, so if certain type of instances is not available, spot fleet can pick from different instance types
3. Spot price is normally 50% to 93% lower than the on-demand price. But if you are using popular instances , like m3.medium, chances are you are not going to save much because these types of instances are rarely available in Spot. So pick the not so common instances.
Here is the code repo along with readme:
Need help? Contact nClouds if you’re facing issues using Spot Instances with Opsworks.