How to View and Cancel Spot Instance Requests

How to View and Cancel Spot Instance Requests

A spot instance helps to reduce the cost of the instance.  To use spot instances, the user bids for a spot instance request specifying the maximum price that the user is willing to pay per hour per instance. If the maximum price of the bid is greater than the current spot price, the user’s request is fulfilled and the user’s instances run until terminated or the spot price increases above the maximum bid price. When the spot instance request is canceled, the spot instances that were launched previously through the canceled request do not automatically get terminated. The only time that the spot instance service terminates a running instance is when the spot price exceeds the max bid price. Note that though spot instances can use Amazon EBS-backed AMIs, the user cannot stop and start spot instances launched from an AMI with an Amazon EBS root device.

The present guide demonstrates how to view running spot instances and cancel the request.

1. Go to your AWS Console and select the EC2 Service.  It launches the EC2 dashboard. The dashboard shows the current running instances. Click on “Spot Instance”.

2. The spot instance console displays all the existing spot instances. The instance displays the spot instance request ID, and the max bid price. Select any of the listed instances.

[Newvem analytics provides comprehensive visibility to your EC2 footprint with drill downs from a consolidated view to a detailed resource status report. Newvem continuously analyzes EC2 instance utilization patterns and provides a down-to-the-hour picture of your AWS EC2 consumption and usage. Learn More]

3. The instance details lists information, such as the spot instance request ID, max bid price, whether the request is one time or persistent, current status of the request, launch group, instance ID, AMI details and other instance related information.

4. To cancel the request, select the instance and right click on the instance. Select the “Cancel” option or click on the “Cancel” button.

5. AWS will confirm before canceling the spot instance request. Click on “Yes, Confirm”.

6. The spot instance request will now be canceled.  The spot instance request is generally canceled either because the bid request went beyond its expiration date or the max bid price or the user manually canceled it. The spot instances that were launched previously through the now-canceled request do not automatically get terminated. The only time that the spot instance service terminates a running instance is when the spot price equals or exceeds the max bid price.  As shown below, the instance is still running though the spot request has been canceled. Go to the AWS instance through the left navigation menu.

7. The instance console displays the running instance. It will be charged as per the on-demand instance price as the spot request has been canceled.

8. For the spot instance price bidding, it is recommended to view the spot price history before specifying the max bid price. The user can view the spot price history over a period from one to 90 days based on the instance type, the operating system that the user wants the instance to run on, the time period, and the availability zone in which the spot instance will be launched.

9. To view the price history of the spot instance for a particular region, first go to spot instance console, as mentioned in step#2. Click on the “Pricing History” button. It launches the price history for that region. Change the instance type, date range or zone as per the requirement to get the pricing history of that selection.

10. To view or cancel a spot instance with the command line option, first setup the AWS EC2 CLI.

11. Run the command:

ec2-describe-spot-instance-requests --region <region name>

It lists the successful spot instance requests or currently canceled / terminated spot instances.

To cancel the spot instance request, run the command:

ec2-cancel-spot-instance-request --region <region name> <spot request ID>

The actual output is shown below:

12. To view the pricing history of a particular zone, run the command:

ec2-run-instances to launch an instance.
ec2-describe-spot-price-history –H –instance-type <instance type> --region <region name>

[Newvem analytics tracks your AWS cloud utilization:

  • Hourly Utilization Pattern Analysis 
  • Reserved Instances Decision Tool 
  • Resource Resizing Opportunities

Get Started For Free or Learn More]

Keywords: Amazon AWS elastic cloud services, Amazon EC2, Cloud Utilization, Amazon Web Services, AWS EC2, Amazon Machine Image, Spot Instance, EC2 Dashboard, EC2 Spot Instances, EBS, Cloud Automation, Cost Efficiency, AWS CLI,

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations