You can launch Spot Instances by creating a Spot Instance request. A Spot Instance request specifies the desired maximum hourly rate, availability zones, and type and number of Instances. Amazon EC2 automatically accepts your request, as long as the maximum set price exceeds the price of the Spot Instance.
There are three ways to launch Spot Instances:
- Virtual Private Cloud (VPC)
- Availability Zone Group
- Launch Group
Launching Spot Instances in a Virtual Private Cloud
When launching Spot Instances in a VPC, you specify the specific subnet for your Spot Instances as you would for On-Demand Instances. You can choose a specific subnet if you don’t use the default VPC. For Default VPC, Amazon EC2 launches the Spot Instances in the specified Availability Zone’s default subnet. You must therefore specify the subnet when creating your Spot Instance request.
Launching Spot Instances in an Availability Zone Group
To launch Spot Instances for an Availability Zone Group, users select an Availability Zone Group where they want the Instances launched. Amazon then launches Spot Instances for that specific Availability Zone Group. In case the spot service interrupts one or more Instances, the rest of your Instances keep running.
Launching Spot Instances in a Launch Group
Spot Instances launch and terminate together as a group in launch groups, rather than as single Instances. To launch Spot Instances in a launch group, the user should specify a launch group when creating a request. Amazon EC2 will only launch them in a group when it can meet the request. During termination, Amazon EC2 can terminate all of the Instances and rather than a single Instance. The user, however, can terminate one or more Instances at will.
How to Tag Spot Instances
Tagging helps manage your Spot Instances easily by categorizing them depending on your needs. You can assign a tag to Spot Instances either when creating a request or after you have requested an Instance. To create a tag, you can use the Amazon EC2 console or CLI (Command Line Interface).
How to Stop a Spot Instance
Stopping Instances allows you to restart them later without losing data on your EBS (Elastic Block Store) volumes. You can restart Spot Instances from the stoppage point, provided there is Spot capacity and your maximum price exceeds the spot price. However, you can’t stop Instances launched in launch groups or Availability Zone Groups.
How are Spot Instances Terminated?
Spot Instances terminate automatically when there is no spot capacity or when the spot price exceeds your set maximum price. You can also terminate Spot Instances manually, but you must confirm and back up data in EBS Volumes to avoid losing it.
Use nOps to Manage Your Spot Instances
The nOps Spot Advisor allows users to view and take control over their Spot Instances seamlessly. With the nOps Spot Advisor, you can choose between On-Demand and Spot Instances to save on costs. nOps scans all your Amazon EC2 instances. Using machine learning based on Amazon EC2 instance utilization patterns, nOps can discern those Amazon EC2 instances that are appropriate to shift from On-Demand to Spot Instance pricing across all Regions and Availability Zones in an AWS account.