spot-bill

Running your own Cloud Foundry will give you large hosting bills. Kubernetes, whilst having a substantially smaller initial footprint, will still run up a reasonable hosting bill each month.

If only there was a way to save 85% of your monthly bill!

Allow me to introduce you to the BOSH AWS CPI property spot_bid_price and to the magical ancient lost AWS region of Ohio.

ohio-tourism-logo

"O-hi-o". Get it? Ohio has the best tourism logo. And the best AWS region.

"AWS Spot Instances allow you to bid on spare Amazon EC2 computing capacity... at a discount compared to On-Demand pricing" This is an exciting sentence. But how much of a discount? And, how spare is this capacity? Is it spare enough that you could run long-running systems with reasonable uptime?

Downtime is what happens at the end of uptime. Spot instances allow you to provision EC2 instances and eventually AWS might want the capacity back to give to some higher paying customer. Your uptime will end and your downtime will begin. You will need some orchestration system to automatically begin re-provisioning new Spot instances, then reattaching persistent disks, restarting processes etc.

Fortunately, the DevOps communities have BOSH to provide this service. It will keep trying to resurrect your lost servers until they come back. So BOSH plus Spot instances seem like a match made in heaven.

But still, the two questions remain: how spare is this spare capacity?; and how much of a discount?

Allow me to introduce you to my new favorite state of America: Ohio. It's the home to a new cheap AWS region. Cheap like Virginia (us-east-1) and Oregon (us-west-2). Cheap and unused.

Unused capacity means low Spot prices, few spikes in price, and few occasions where you might have your uptime turned to downtime. The graph for m4.large instances over the last three months is delightfully flat. The price sits around $0.015 per hour (an 85% discount on the retail $0.10 per hour price) and spiked to $0.03 per hour once.

spot-history

How do I buy now?

I'm glad you asked. For you, my fellow BOSH user, I throw in some free configuration advice.

You can move some or all of your BOSH instances to become Spot instances by adding one line of configuration into your Cloud Config.

To save your current Cloud Config to a file:

bosh cloud-config > cloud-config.yml  

Now modify some/all of your vm_types to add the spot_bid_price property to your cloud_properties.

vm_types:  
- name: default
  cloud_properties:
    spot_bid_price: 0.05

Now update your Cloud Config:

bosh update-cloud-config cloud-config.yml  

Next time you bosh deploy your BOSH deployments that use vm_type: default those existing VMs will be deleted and re-provisioned as Spot instances. Any attached persistent disks will be reattached. Any running processes will be restarted. Life will continue at a discount of 85%.