EC2 Instance Purchasing Options
Learn about EC2 instance purchasing options and how we can reduce costs.
AWS EC2 provides multiple EC2 purchasing options that can be used for different use cases. It’s important that we choose the right EC2 option for our use case to avoid overpaying. Let’s look at these options from AWS with examples.
On-Demand Instances
On-Demand Instances can be provisioned and terminated by us as needed, and we simply pay by the second for the instances we launch. This option is good for use cases where we don’t know the required number of EC2 instances for our applications in advance. We can use On-Demand Instances to scale our instances anytime.
Savings Plans
Savings Plans are a flexible pricing model offered by AWS with lower prices compared to on-demand in exchange for a commitment of a set usage per hour for a one–three year term. If our use case requires a basic account of hours spent for a long term (one–three years), we can use a savings plan to get a discount on the on-demand pricing of the instances. There are three types of savings plans:
- Compute Savings Plan: This includes the basic costs across AWS Lambda, Fargate, and EC2.
- EC2 Savings Plan: This plan only includes the basic cost of the AWS EC2 service.
- Sagemaker Savings Plan: This plan includes the basic cost of the AWS SageMaker service.
Reserved Instances
Reserved Instances allow us to use EC2 instances at a discounted price compared to on-demand by committing to a consistent instance configuration, including instance type and region, for a term of one to three years. So if we have an application that consistently requires a minimum of five EC2 instances for the long term, we can use five Reserved Instances at a discounted price and use On-Demand Instances for scaling purposes as required. This is an important example of using Reserved and On-Demand Instances together in the same application.
Capacity Reservation
Capacity Reservation allows us to reserve capacity for our EC2 instances in a specific AZ without having to make any long-term commitments.
Capacity Reservation might seem similar to Reserved Instances, but they’re completely different.
-
Reserved Instances don’t reserve a capacity for us. They offer a billing discount for our EC2 instances. They’re reserved for a region, and AWS doesn’t guarantee instance capacity.
-
Capacity Reservation doesn’t offer any billing discounts. We use Capacity Reservations for reserving the EC2 capacity in an AZ. Unlike the Reserved Instances, Capacity Reservations don’t require a long-term commitment.
Dedicated Instance
A Dedicated Instance is an instance in our AWS account that doesn’t share the underlying hardware with other AWS customers. For example, if we have a compliance requirement to not share EC2 hardware with other customers on AWS, we can provision an EC2 instance as a Dedicated Instance. This instance might share the hardware with other instances in our AWS account but not with other AWS accounts.
Dedicated Host
We can use a Dedicated Host to allocate a physical server for our use case. Unlike with Dedicated Instances, we now have full control over how instances are placed on this physical server. Dedicated Hosts also allow us to use our existing per socket, per core, or per virtual machine (VM) licenses for software like Windows Server, Microsoft SQL Server, Linux Enterprise Server, and more. This is the only feature in AWS that allows us to use preexisting software licenses with EC2 instances.
Spot Instances
AWS has a lot of instance capacity in its data centers. A lot of this capacity goes unused by the above purchasing options. Spot Instances allow us to use this unused EC2 capacity to provision EC2 instances in our AWS accounts for a heavily discounted price.
Get hands-on with 1200+ tech skills courses.