At my startup, we have dockerized all of our services (Yes, it means that all of our client websites are now Docker Images). We use Rancher as our docker orchestration platform, where servers from Amazon Web Services, Microsoft Azure, and some self-hosted bare metal servers formed a cluster of docker worker nodes.
To reduce the cost of using Amazon Elastic Cloud, our docker fleet relies on Spot instances instead of On-Demand and Reserved instances. Spot instances allow us to bid on spare Amazon EC2 computing capacity at a discount, compared to On-Demand and Reserved instances pricing. For example, the price of m3.medium is $0.0097/hr for Spot instance and $0.067/hr for On-Demand instance. Using Spot instances can cut our operational cost by almost 80%. However, there is a catch.
One of the major issues of using spot instances is that they are not 100% available, they always face an uncertain probability of being terminated of AWS as Spot instance availability is determined by bid prices. Sometimes an m3.medium Spot instance price can exceed $0.7/hr (that’s 10 times of On-Demand price!) if your bid price is less than $0.7/hr (which is most of the cases), your Spot instances will be terminated by AWS.
Fortunately, with Spotinst and Rancher, we are able to leverage Spot instances by deploying servers from multiple capacity pools over multiple availability zones across multiple data centres. Spotinst uses its algorithms and a workload management strategy to ensure maximum up-time. It also allows us to easily configure a fleet of Spot and On-Demand instances to integrate with our docker orchestration platform.
The result is a highly scalable docker fleet running on Spot instances. It offers the best of AWS + Docker while significantly reducing our cost.