DEV Community

Cover image for Comparing EC2 Purchasing Options
Duy Hưng
Duy Hưng

Posted on

Comparing EC2 Purchasing Options

  1. On-Demand Instances With On-Demand Instances, you pay for compute capacity by the hour or by the second depending on which instances you run. No longer-term commitments or upfront payments are needed. You can increase or decrease your compute capacity depending on the demands of your application and only pay the specified rates for the instance you use.

On-Demand Instances are recommended for the following:

  • Users who prefer the low cost and flexibility of Amazon EC2 without any upfront payment or long-term commitment
  • Applications with short-term, irregular, or unpredictable workloads that cannot be interrupted
  • Applications being developed or tested on Amazon EC2 for the first time

Sample use cases for On-Demand Instances include developing and testing applications and running applications that have unpredictable usage patterns. On-Demand Instances are not recommended for workloads that last a year or longer because these workloads can experience greater cost savings using Reserved Instances.

  1. Savings Plans are a flexible pricing model offering lower prices compared to On-Demand pricing, in exchange for a s*pecific usage commitment* (measured in $/hour) for a 1- or 3-year period. Savings Plans offer the flexibility to evolve your usage and continue to save money. For example, if you have a Compute Savings Plan, lower prices will apply automatically when you take advantage of new instance types.

AWS offers three types of Savings Plans:

  • Compute Savings Plans apply to usage across Amazon EC2, AWS Lambda, and AWS Fargate.
  • EC2 Instance Savings Plans apply to EC2 usage.
  • Amazon SageMaker Savings Plans apply to Amazon SageMaker usage.

With Amazon EC2 Savings Plans, you can reduce your compute costs by committing to a consistent amount of compute usage for a 1- or 3-year term. This term commitment results in savings of up to 66 percent over On-Demand costs.

Any usage up to the commitment is charged at the discounted plan rate (for example, $10 an hour). Any usage beyond the commitment is charged at regular On-Demand rates.

  1. Reserved Instances (RIs) are a billing discount applied to the use of On-Demand Instances in your account. You can purchase Standard RIs and Convertible RIs for a 1- or 3-year term. You realize greater cost savings with the 3-year option.

There are two types of RIs to choose from:

-** Standard RIs**: These provide the most significant discount (up to 72 percent off On-Demand) and are best suited for steady-state usage.

  • Convertible RIs: These provide a discount (up to 54 percent off On-Demand) and the capability to change instance families, OS types, and tenancies while benefitting from RI pricing. Like Standard RIs, Convertible RIs are best suited for steady-state usage.

RIs are recommended for the following:

  • Steady-state loads and long-running systems
  • Core components with minimal high peaks and valleys of usage

At the end of an RI term, you can continue using the Amazon EC2 instance without interruption. However, you are charged On-Demand rates until you do one of the following:

  • Terminate the instance.
  • Purchase a new RI that matches the instance attributes (instance type, Region, tenancy, and platform).
  1. Spot Instances With Amazon EC2 Spot Instances, you can request spare Amazon EC2 computing capacity for up to 90 percent off the On-Demand price.

Spot Instances are recommended for the following:

  • Applications that have flexible start and end times and can tolerate interruptions
  • Applications that you want to run or test only when the compute prices are in your price range
  • Applications that are a lower priority in your environment
  • Users with urgent computing needs for large amounts of additional capacity at a price they determine

Suppose that you have a background processing job that can start and stop as needed (such as the data processing job for a customer survey). You want to start and stop the processing job without affecting the overall operations of your business. If you make a Spot request and Amazon EC2 capacity is available, your Spot Instance launches. However, if you make a Spot request and Amazon EC2 capacity is unavailable, the request is not successful until capacity becomes available. The unavailable capacity might delay the launch of your background processing job.

After you have launched a Spot Instance, if capacity is no longer available or demand for Spot Instances increases, your instance may be interrupted. This might not pose any issues for your background processing job.

  1. A Dedicated Host is a physical EC2 server dedicated for your use. Dedicated Hosts can help you reduce costs by letting you use your existing server-bound software licenses, including Windows Server, SQL Server, and SUSE Linux Enterprise Server (subject to your license terms). They can also help you meet compliance requirements.

Features of Dedicated Hosts

  • Can be purchased On-Demand (hourly)
  • Can be purchased as a Reservation for up to 70 percent off the On-Demand price

Dedicated Hosts are recommended for the following:

  • Workloads that require server-bound software licenses
  • Security and regulatory compliance where your workload cannot share hardware with other tenants
  1. Dedicated Instances

You can use Dedicated Hosts and Dedicated Instances to launch Amazon EC2 instances on physical servers that are dedicated for your use. With Dedicated Instances, all of your instances reside on one single host that is allocated to your AWS account so that no other AWS accounts can place instances on this host.

An important difference between a Dedicated Host and a Dedicated instance is that a Dedicated Host gives you additional visibility and control over how instances are placed on a physical server and you can consistently deploy your instances to the same physical server over time. As a result, with Dedicated Hosts, you can use your existing server-bound software licenses and address corporate compliance and regulatory requirements.

Clarify what a Spot Instance is

Image description

Use Case Examples

Spot Instances are recommended for stateless, fault-tolerant, flexible applications. For example, Spot Instances work well for big data, containerized workloads, continuous integration and continuous delivery (CI/CD), stateless web servers, high performance computing (HPC), and rendering workloads.

While running, Spot Instances are exactly the same as On-Demand Instances. However, Spot does not guarantee that you can keep your running instances long enough to finish your workloads. Spot also does not guarantee that you can get immediate availability of the instances that you are looking for, or that you can always get the aggregate capacity that you requested. Moreover, Spot Instance interruptions and capacity can change over time because Spot Instance availability varies based on supply and demand, and past performance isn’t a guarantee of future results.

  • Spot Instances are not suitable for workloads that are inflexible, stateful, fault intolerant, or tightly coupled between instance nodes.
  • They're also not recommended for workloads that are intolerant of occasional periods when the target capacity is not completely available.
  • We strongly warn against using Spot Instances for these workloads or attempting to fail over to On-Demand Instances to handle interruptions.

Ways to request Spot Instances

To use Spot Instances, you create a Spot Instance request that includes the desired number of instances, the instance type, the Availability Zone, and the maximum price that you are willing to pay per instance hour. If your maximum price exceeds the current Spot price, Amazon EC2 fulfills your request immediately if capacity is available. Otherwise, Amazon EC2 waits until your request can be fulfilled or until you cancel the request. There are two request types: one-time and persistent.

A one-time Spot Instance request remains active until Amazon EC2 launches the Spot Instance, the request expires, or you cancel the request. If the Spot price exceeds your maximum price or capacity is not available, your Spot Instance is terminated and the Spot Instance request is closed.

A persistent Spot Instance request remains active until it expires or you cancel it, even if the request is fulfilled. If the Spot price exceeds your maximum price or capacity is not available, your Spot Instance is interrupted. After your instance is interrupted, when your maximum price exceeds the Spot price or capacity becomes available again, the Spot Instance is started if stopped or resumed if hibernated. You can stop a Spot Instance and start it again if capacity is available and your maximum price exceeds the current Spot price. If the Spot Instance is terminated, the Spot Instance request is opened again and Amazon EC2 launches a new Spot Instance.

Image description

The previous illustration shows how Spot Instance requests work. Notice that the request type (one-time or persistent) determines whether the request is opened again when the instance is interrupted or if you stop a Spot Instance. If the request is persistent, the request is opened again after your Spot Instance is interrupted. If the request is persistent and you stop your Spot Instance, the request only opens after you start your Spot Instance.

Key takeaways

  • On-Demand Instances – You pay full price by the second when you launch.
  • Savings Plans – You commit to a certain amount of usage over a 1–3-year period.
  • Reserved Instances – You agree to a specific instance configuration for a period of 1–3 years.
  • Spot Instances – This refers to unused instance resources that you can bid on. Your price is determined by market availability.
  • Dedicated Hosts – You get a full physical server.
  • Dedicated Instances - Instances are placed on a single host with no access to the underlying host.

Top comments (0)