Have you ever wondered how to find the current market spot price for an EC2 instance? When people first hear that spot instances can save you up 50%-90%, they tend to react in disbelief. This is natural and understandable, it just sounds too good to be true. Fortunately, there are many ways to confirm that the 50%-90% spot price savings is real. This article tries to lists the many ways in one place.

Spot Pricing Page

Let’s start off with the public pages. The first one is the Amazon EC2 Spot Instances Pricing. Here we can select the region, and we get a simple list of instances and spot prices. The listing shows hourly prices and does not include the percentage savings.

Spot Instance Advisor Page

From the same Amazon EC2 Spot Instances Pricing page there’s a link to the Spot Instance Advisor page. You can also google for “Spot Instance Advisor” to find it. This page is also public. The advisor page provides a simple calculated list. You input how many CPUs and Memory you would like, and it instantly updates with a list with instance types that meet your requirements. It’s nice that it shows how much you’ll save in percentage vs. on-demand. It also shows an interesting “Frequency of Interruption” percentage. Most instances are interrupted less than 5% of the time.

EC2 Console Pricing History

The next way to check on spot instance pricing requires logging into your AWS account. There is a Pricing History Chart link that brings a chart which shows prices over time. This is a neat way and one of my favorite ways to see the spot price of an instance.

Here’s a summary of how to get to there:

  1. Go to the EC2 console
  2. Click on Spot Requests on the left-hand side menu
  3. Click on Pricing History in the upper menu.

Here’s where the Pricing History button is:

After you have selected instances and clicked on the Pricing History button, you’ll be able to choose an instance type. It is interesting to change the date range to 3 months to see how much spot prices have changed.

Also, if you go a little deeper and click on Request Spot Instances, choose some Instance Types, click Select, and then click the Pricing History button, you can select multiple instances and compare them all in one chart. Similar steps to get to these charts are also provided in the AWS EC2 Guide Docs.

EC2 Console Launch Instance Wizard Spot Option

We can also see spot pricing when launching an instance with the EC2 Launch Wizard. This is available in Step 3 Configure Instance of the wizard with the Request Spot Instances option.

AWS CLI

Next, I’ll show you how to find the current spot price with the aws cli describe-spot-price-history command. I like this method because it is quick and handy when you already have the aws cli installed. The command lists the spot prices for all AZs in a region for a specific instance type. Here’s the command:

$ aws ec2 describe-spot-price-history --start-time=$(date +%s) --product-descriptions="Linux/UNIX" --query 'SpotPriceHistory[*].{az:AvailabilityZone, price:SpotPrice}' --instance-types c5.large
[
    {
        "az": "us-west-2b",
        "price": "0.034200"
    },
    {
        "az": "us-west-2d",
        "price": "0.032200"
    },
    {
        "az": "us-west-2c",
        "price": "0.034000"
    },
    {
        "az": "us-west-2a",
        "price": "0.033200"
    }
]
$

You can also get the current spot price with the aws-sdk of your choice. I was pleasantly surprised to it’s possible to get the spot price with the cli and aws-sdk.

Here’s a one-liner that will do a little math and tell you what the monthly price for the spot instance is.

$ I=t3.small ; printf "\$%.2f/mo\n" $(echo "$(aws ec2 describe-spot-price-history --instance-types $I --start-time=$(date +%s) --product-descriptions="Linux/UNIX" | jq -r '.SpotPriceHistory[0].SpotPrice') * 24 * 30" | bc)
$4.68/mo

And here’s a loop that does a similar thing with a list of instances:

for I in t3.small t3.medium m5.large; do
  printf "$I: \$%.2f/mo\n" $(echo "$(aws ec2 describe-spot-price-history --instance-types $I --start-time=$(date +%s) --product-descriptions="Linux/UNIX" | jq -r '.SpotPriceHistory[0].SpotPrice') * 24 * 30" | bc)
done

You should see something like this:

t3.small: $4.68/mo
t3.medium: $9.14/mo
m5.large: $28.58/mo

Normal EC2 Pricing

Here’s also how to check standard on-demand EC2 pricing. For that, I find it convenient to use this site: ec2instances.info. The site scrapes several pages to produce a list that is quite user-friendly. It’s handy to change the cost to a monthly basis, select the instances you’re interested in and click Compare Selected.

Summary

Okay, we went over several ways showing how to find current EC2 instance spot market prices. If you’re interested learning more about Spot Compute, check out: BoltOps Learn videos on Spot.