What are your Spot Instance options on AWS, Azure, and Google?
The usage of Spot Instances can play a key role in reducing your cloud costs. AWS, Google, and Azure all provide the option to use Spot Instances. For example, Spot Instances are very useful in both batch processing and high-performance clusters, as well as web server fleets with variable workloads.
Most cloud vendors categorize their pricing model into three different categories:
On-Demand Instances let you pay for compute capacity by the hour with no long-term commitments or upfront payments. It allows you to increase or decrease your compute capacity depending on the demands of your application and only pay the specified hourly rate for the Instances you use.
Reserved Instances provide you with the ability to invest in a larger upfront payment to receive a greater discount. RIs can minimize risks, more predictably manage budgets, and comply with policies that require longer-term commitments. Your Reserved Instance will always be available for the operating system and Availability Zone in which you purchased it.
Spot Instances: With Spot Instances, you can bid for unused capacity in a cloud vendors data center. You can save up to 90% of the cost when compared to On-Demand Instances. However, if some else bids higher than you, your Instance will be taken away.
Spot Instances in AWS
AWS has had Spot Instance options available for many years.
- With Spot Instances, you need to specify the price you are willing to pay per hour. If the spot price is below your bid price, you can use that Instance until the spot price is above your bid price.
- When you are submitting a Spot Instance request, you need to specify the Instance type and the Availability Zone.
- In AWS Spot Instances, you need to prepare for interruptions. When the Spot Instance price is above your bid price, your Instance will be taken away and terminated.
- AWS recently announced that you can stop Spot Instances. Until recently, you could not stop an AWS Spot Instance even though it is an EBS backed Instance, your only option was to reboot.
- AWS Spot Instances are integrated with Autoscaling
- You can use a combination of on-demand and Spot Instances
- Spot Instances have a feature called EC2 Spot Fleet. With Spot Fleet, you can bid and launch a bunch of EC2 servers with single API request. You need to specify a maximum price, target capacity, Instance type and availability zone. Even though Spot Instance prices change, Spot Fleet tries to maintain the desired Instance capacity.
- You can use Spot Instances with the dedicated or multi-tenant Instance. Dedicated Instances run dedicated hardware and only for a single customer.
Spot Instances in Azure
Azure recently launched the concept of Spot Instance, still in public preview, called Low-Priority VM.
- Low-Priority VM is allocated from the excess capacity of the Azure datacenter pool.
- Low-Priority VM can only be purchased through Azure Batch Service. It is a service where you can run batch jobs on Azure computing.
- Low-Priority VM helps to reduce the cost of running Azure Batch Jobs
- You can not use Low-Priority VM with any of the other Azure services
- A batch pool can contain both Low-Priority VM and on-demand/dedicated Instances.
- You can completely run batch jobs with Low-Priority VM and when capacity drops below the minimum threshold it will launch dedicated Instances.
- If batch jobs are interrupted, batch will detect and re-queue the jobs
You can use low Low-Priority VM for media processing, transcoding, and rendering.
Spot Instances in Google Cloud
Google Cloud’s option for Spot Instances is similar to AWS — called “Preemptible VM Instances”.
- Preemptible VM Instances are 80% cheaper than a regular VM.
- For Preemptible VM Instances, there is no variable pay. The price is fixed with no need to bid.
- Preemptible VM Instances are terminated after 24 hours.
- Preemptible VM Instances are still shown in the Google console but they will be shown in the terminated state. You can still recover the data from the attached storage but the attached storage is still billable.
- You get a 30-second time slot before terminating Preemptible VM Instances.
- You can use a Google shutdown script to perform cleanup tasks, export logs, and gracefully terminate a running process.
- You can use Preemptible VM with managed Instance groups. Managed Instance groups are similar to Autoscaling in AWS.
- If the Preemptible Instance gets terminated, compute engine tries to launch a replacement Instance.
- You can launch Preemptible Instances either from single command or from the console.