Book a Demo
Book a Demo
Variability in AWS EC2 Spot Instance Discounts

Variability in AWS EC2 Spot Instance Discounts

Cedric Druce 2023-10-101163

Variability in AWS EC2 Spot Instance Discounts

Executive Summary

AWS customers can reduce cloud costs by using Memory Machine Cloud to deploy their containerized applications on spot instances (EC2 instances offered at a discount to on-demand instances). WaveRadar is a useful (free) online tool for examining historical spot instance prices and discounts. For a given EC2 instance type, the discount depends on several parameters. The analysis reported here, using data from WaveRadar filtered for spot instances available in the US, shows that discounts vary strongly with region, instance family, and CPU vendor. Other factors, such as instance size and CPU generation, also impact discounts but the effects are less.

Generally, discounts are smallest in us-east-1 and us-west-2, and greatest in us-east-2 and us-west-1. However, not all EC2 types are available as spot instances in us-west-1. AMD-powered instances generally have smaller discounts than Intel-powered instances although the Intel discounts are more variable. If maximizing discount is the only selection criterion, then deploying Intel-based instances in us-east-2 is recommended. In practice, there are additional factors that affect cost and performance, such as networking and data transfer.

Discounts for memory-optimized instances are larger than discounts for compute-optimized instances with discounts for general-purpose instances in between.

The current inventory of spot instances, and their reclaim probabilities, are additional factors that may influence spot instance selection. Detailed data on inventory and reclaim probability is not available, so those aspects are not discussed here.

AWS Compute Instances

Elastic Compute Cloud (EC2) is the cloud service that provides virtual machines to AWS customers. EC2 instances are available in different types where each type is identified by a name (for example, c6i.4xlarge) and each type represents a configuration of physical CPU (for example, Intel Xeon 8375C), virtual CPUs (for example, 16 vCPUs), and memory (for example, 32 GiB).

EC2 instance types are grouped into families, including:

  1. General purpose
  2. Compute optimized
  3. Memory optimized


Most EC2 instances follow the same naming convention.

[family][generation][CPU-vendor].[size]large

where

  1. [family] is a letter to indicate general purpose, compute-optimized, or memory-optimized
  2. [generation] is an integer
  3. [CPU-vendor] is a letter to indicate Intel, AMD, or Graviton
  4. [size] is a string that identifies a combination of number of vCPUs and memory


For example, r6i.4xlarge is a memory-optimized, 6th generation, Intel-powered, instance with 16 vCPUs and 128 GiB of memory.

EC2 instances are distributed geographically among the regions where AWS locates its data centers. Within a region, EC2 instances are distributed among availability zones, which are logically separate networks that provide fault isolation. Currently, AWS operates 102 availability zones within 32 geographic regions around the world.

Price Lists

EC2 instances are billed in one-second increments, although the prices are displayed on the AWS website as hourly rates. There are three price lists that apply to EC2 instances.

  1. On-demand prices apply to instances that are configured without prior reservations, can run for any length of time, and carry no long term commitments.
  2. Reserve prices apply to instances that are associated with commitments to pay for a minimum number of EC2 instances for a fixed period (1 or 3 years) with constraints on the type and location of each instance.
  3. Spot prices apply to EC2 instances that are only available because AWS has excess capacity at that time. Spot prices vary as supply and demand change.


For a given EC2 instance type, the on-demand price is the highest and the spot price is the lowest (the reserve price is in between).

EC2 Price Data

AWS provides a Price List API to programmatically retrieve information on AWS products and pricing. By querying the AWS Price List API multiple times a day and inserting the results into a database, WaveRadar assembles a historical record of on-demand and spot instance prices for all EC2 instances in all regions.

On-demand prices change slowly — prices changes only occur at the start of each month and prices may remain unchanged for several months. Spot prices are volatile but in practice, changes are only visible when viewed in a three month window (you can view EC2 price history from your AWS management console).

EC2 instances are available with a choice of operating system: a generic, unsupported Linux version (labeled Linux/UNIX or AWS Linux), two supported Linux versions (SUSE and Red Hat), and Windows. Of the four operating systems, Linux/UNIX (AWS Linux) has the lowest price (Windows has the highest).

The Ideal Search

The search for the optimal EC2 instance to run a job is a complex task. A user might not know the peak resource requirements (CPU clock speed, number of vCPUs, and memory size) for a job or how to map resource requirements to an EC2 instance at the best price. In a simple case, a user may ask: for a given EC2 instance type, where can I get the lowest price for this type as a spot instance? A more complex query may search for optimal price performance, that is, the best price per vCPU, or per GiB, adjusted for processor generation.

AWS offers spot instances at a discount as a way to monetize excess EC2 capacity. That means that not every instance type is available as a spot instance at any given time, and any spot instance can be reclaimed with nominal warning. The ideal search would include the current inventory of every spot instance type to allow the user to estimate the probabilities of reclaim events. Inventory information is not available via the AWS API, so discounts must be used as an indirect indicator.

Simplifying Assumptions

The studies described in this report focus on finding the largest discounts on spot instances configured with Linux/UNIX (AWS Linux) in the regions that AWS operates in the continental United States.

Variability in Discounts

All functions in Memory Machine Cloud (MMCloud) are controlled by the Operations Center (OpCenter). One OpCenter can deploy many jobs in a region but one OpCenter cannot span regions. Although an MMCloud customer could deploy OpCenters in multiple regions, it is more common to deploy one OpCenter and run all jobs in a single region. An OpCenter is deployed in one availability zone but jobs are deployed in all availability zones in the region.

Containers deployed by the OpCenter run on EC2 instances supported by Intel or AMD processors. As Intel and AMD develop new generations of processors, AWS makes new generations of EC2 families available. For example, the C5 family of EC2 instances runs on 2nd generation Intel Xeon Scalable Processors (Cascade Lake) or 1st generation Intel Xeon Platinum 8000 series (Skylake) processors. The C6i family runs on 3rd generation Intel Xeon Scalable processors and the C7i family runs on 4th Generation Intel Xeon Scalable processors. Later generations of processor offer better price performance than earlier generations. A similar pattern applies to AMD-based families, for example, C5a and C6a, or R5a, R6a, and R7a.

With this background, we identify potential sources of variability in spot prices (and hence, a path towards finding the largest discounts), namely,

  1. Region (us-east-1, us-east-2, us-west-1, or us-west-2)
  2. EC2 instance family (M, C or R)
  3. EC2 instance family generation (5, 6 or 7)
  4. CPU vendor (AMD or Intel)


To preview the data, we survey the discounts for each EC2 instance family aggregated across all regions (see Figure 1). Figure 1 shows that the majority of the discounts fall between 20% and 75% (multiply by 100 to convert the discount to a percentage), with C instances towards the lower end, R instances towards the upper end, and M instances in the middle.

Figure 1. Discounts for M, C, and R instance families

Discount Variation by Region

To investigate how discount varies by region, we hold the instance family (M, C, or R), generation (5), and CPU vendor (a denotes AMD) constant while querying discounts in each region. The results for the M5a family, the C5a family, and R5a family are in shown in Figures 2 to 4, respectively. Multiply the discount by 100 to convert to a percentage.

Figure 2. Discounts for M5a family of instances by region

Figure 3. Discounts for C5a family of instances by region

Figure 4. Discounts for R5a family of instances by region

The results show that, although there are outliers, discounts in us-east-1 and us-west-2 are similar whereas discounts in us-east-2 and us-west-1 are similar. The same pattern is seen for Intel-powered instances.

For the remaining queries, we treat us-east-1 and us-west-2 as a single group, and us-east-2 and us-west-1 as a single group.

Discount Variation by EC2 size

To investigate how discount varies with instance size, we hold the instance family (M, C, or R), generation (5, 6, or 7), and CPU vendor (a denotes AMD and i denotes Intel) constant while querying discounts for each [size]. The results for the M5a family, the C5a family, and R5a family are in shown in Figures 5 to 7, respectively.

Figure 5. Discounts for M5a family of instances by size

Figure 6. Discounts for C5a family of instances by size

Figure 7. Discounts for R5a family of instances by size

The results show that, although there are outliers in the C5a family, discounts do not vary greatly from one instance size to another in the same family. Discounts do vary between families: the R5a family has the greatest discounts, the C5a family has the lowest discounts, and the M5a family is in the middle.

For the remaining queries, we treat large, xlarge, 2xlarge...48xlarge instances within a family as a single group.

Discount Variation by CPU vendor

For most of the EC2 families, there is an Intel-powered version and an AMD-powered version of every instance. To investigate whether discounts vary by CPU vendor, we repeat the queries behind Figures 5, 6, and 7 for the Intel-powered versions. Compared to the equivalent AMD-powered instances, we see that discounts for Intel-powered instances are larger and more variable. The detailed results are shown in the Appendix ( see Figures A1, A2, and A3).

If all the generation 5 family types are aggregated into separate Intel- and AMD-powered groups, the results show that on average Intel-powered instances are offered at higher discounts than AMD-powered instances (see Figure 8).

Figure 8. Discounts for generation "5" instances by CPU vendor

Discount Variation by Generation

To investigate how discounts change as newer processors become available, we compare CPU generations while keeping the group of families constant, for example, we group {M5a, C5a, R5a} into one group and compare that group's average discount with the {M6a, C6a, R6a} group's average discount and the {M7a, C7a, R7a} group's average discount. The results for AMD-powered instances are shown in Figure 9 and the results for Intel-powered instances are shown in Figure 10.

Figure 9. Discounts for groups of families by CPU generation (AMD)

Figure 10. Discounts for groups of families by CPU generation (Intel)

The results for the AMD-powered group show that the latest generation (7) has the largest discounts. As expected, the Intel results are more variable. Although the average discount for the latest generation (7) is lower, there are outliers that offer larger discounts than either generation 5 or 6.

Conclusion

AWS customers can reduce cloud costs by using Memory Machine Cloud to deploy their containerized applications on spot instances, which are offered at a discount to on-demand instances. For a given EC2 instance type, the discount depends on a number of parameters. The analysis reported here shows that discounts vary strongly with region, instance family, and CPU vendor. Other factors, such as instance size and CPU generation, also impact discounts but the effect is less.

Future analysis will investigate other factors (such as availability zone and day of week) and interactions between factors, for example, instance size and CPU generation.

WaveRadar can be used to explore the data further.

Appendix

To investigate how discount varies with Intel-powered instance size, we hold the instance family (M, C, or R) and generation (5, 6, or 7) constant while querying discounts for each [size]. The results for the M5 family, the C5 family, and R5 family are in shown in Figures A1 to A3, respectively.

Figure A1. Discounts for M5 (Intel) family of instances by size

Figure A2. Discounts for C5 (Intel) family of instances by size

Figure A3. Discounts for R5 (Intel) family of instances by size

Comments