How are Amazon EC2 Instances Priced?
Elastic Compute Cloud (EC2) instances are virtual servers used for running applications in Amazon Web Services (AWS). EC2 instances may be billed on a per-hour or per-second basis:
- Per-hour billing means you are billed for at least one hour each time a new instance is started.
- Per-second billing means you are billed for at least 60 seconds each time a new instance is started.
AWS provides several ways to reduce EC2 costs, including a free tier, reserved instances, spot instances, and saving plans.
Learn more in our detailed guide to aws reserved instances.
In this article, you will learn:
- Amazon EC2 Instance Types
- Amazon EC2 Instance Pricing Models
- What You Need to Know Before Selecting EC2 Instance Types
- AWS EC2 Instance Cost Optimization
- The Perfect Blend of EC2 Instance Pricing with Spot.io
Amazon EC2 Instance Types
EC2 instances are configurable, including controls for customizing storage, CPU, networking resources, and memory. Additionally, AWS offers 28 types of instances for a wide range of purposes and budgets. EC2 instances are typically classified into five categories:
- General purpose instances—are designed to optimize performance and ensure a balance between memory, traffic, and compute. Use general purpose instances for containerized workloads like Kubernetes deployments, microservices architecture, web servers, DevOps workflows, and data repositories.
- Memory-optimized instances—are designed to ensure fast processing for big data. Use memory-optimized instances for real-time data processing, which is typically required for high-performance data stores.
- Storage-optimized instances—are designed to provide fast read or write access to large data stores. Use storage-optimized instances for data warehouses, distributed file systems, and NoSQL repositories.
- Accelerated computing instances—use co-processors to achieve hardware acceleration. Use accelerated computing instances for media streaming, gaming servers, and machine learning operations.
- Compute-optimized instances—are designed to provide high-performance processing capabilities. Use compute-optimized instances for gaming servers, batch processing, data analysis, and high-performance computing.
Each instance type has its own pricing. Below we briefly list and explain the range of EC2 instance pricing.
Amazon EC2 Instance Pricing Models
AWS provides a wide range of models for EC2 instances pricing. Each model provides different ways to reduce costs and optimize billing according to certain needs and requirements.
Free Tier
The AWS Free Tier provides 750 hours of instances, monthly, for the duration of one year. Instances included are Windows t2.micro and Linux, or t3.micro if t2 is not available for the region. To ensure you remain within the free tier program, use EC2 micro instances only.
On-Demand
On-demand instances charge you for compute capacity usage per hour or per second, depending on the type of instance you choose. There is no need for any long-term commitment or upfront payments.
This program offers high scalability. You can decrease or increase compute capacity according to application demands and pay only for a specified hourly rate for instance in use. Here are typical use cases for on-demand instances:
- You need low cost and flexibility without up-front payment or commitment.
- Your apps and workloads are short-term or often experience unpredictable spikes and the apps must not be interrupted.
- You did not previously use EC2 for developing or testing apps.
Spot Instances
Amazon EC2 spot instances enable you to request spare Amazon EC2 computing capacity, and get it for up to 90% off the on-demand price.
Here are typical use cases for spot instances:
- Your apps start and end on flexible times.
- Your apps can be developed and maintained only at low compute prices.
- You need to supply large quantities of additional capacity to meet urgent computing needs.
Reserved Instances (RIs)
Reserved instances provide up to 72% savings — significantly lower than on-demand instances pricing. Reserved instances that are assigned to specific Availability Zones (AZ), can provide a capacity reservation.
Here are typical use cases for RIs:
- Your apps have steady state usage.
- Your apps might need a reserved capacity.
- You can commit to using EC2 for a duration of one to three years, to reduce total computing costs.
Savings Plans
Savings plans provide flexible pricing models. Each model offers various cost savings, including low prices for EC2 and Fargate usage. This is in exchange for a commitment to a consistent amount of usage, which is measured in $/hour, for a duration of one to three years.
EC2 Instance Savings Plans often provide very low prices, compared to other plans. This saving plan can reduce up to 72% of costs, but requires a commitment to use individual instance families within a region. For example, M5 usage in N. Virginia.
This plan automatically reduces costs on selected instance families in specific regions, regardless of size, AZ, tenancy, or OS. EC2 instance savings plans enable you to swap instances from a family located in the same region.
What You Need to Know Before Selecting EC2 Instance Types
CPU Bursting
T2 and T3 instance family types support CPU bursting. This means virtual machines (VMs) get assigned a virtual CPU (vCPU) that comes with a specific quota of CPU cycles per second. When machines do not utilize 100% of allocated CPU cycles, unused capacity of specific instances can be converted to CPU Burst Credits.
When an instance needs processing power that extends its quota of CPU cycles, the machine can leverage burst credits to gain extra CPU capacity. This enables machines to extend CPU cycles beyond the predefined quota, but only if there is sufficient burst credit available.
Storage Transfer Limitations
EC2 instances are usually created with an attached AWS Elastic Block Storage (EBS) volume. Before creating an instance, you should determine if the device and attached volume can support your application. Calculate the required number of input and output operations (IOPS) the app needs, to determine if you need a high number of disk reads and writes.
Some EC2 instance families are optimized for EBS, and can leverage optimized configuration stacks. The stacks support a higher level of IOPS between instances and attached EBS volumes.
Networking Limits
Operations with massive data transfers, like media files, or high traffic volumes might run into network limitations. Specifically, there are limitations to the size of the network connecting between instances and clients that need to communicate with instances.
For network-intensive applications and for massive data transfers, select instance types that support enhanced networking. For example:
- Up to 10 Gbps—choose R3, C3, D2, C4, and I2 families.
- Up to 20 Gbps—choose X1, P2, and R4 families using an Elastic Network Adapter
CPU vs GPU
Training machine learning models is a complex operation that often consumes both time and money. There is a wide range of cloud-based instance types that can be leveraged to reduce data processing and training time.
Graphics Processing Units (GPUs), for example, offer distinct advantages over regular CPUs. Specifically, deep learning GPUs can typically process big data much faster than CPUs. However, continuous monitoring is required to ensure GPUs are not under or over provisioned and instance billing remains optimal. In these cases, use GPU instances built for supporting compute-intensive and fast performance on EC2.
AWS EC2 Instance Cost Optimization
Identify Amazon EC2 Instances with Low Utilization
AWS rightsizing recommendations can provide you with a report of idle EC2 instances or instances with low utilization. To reduce costs, either stop or downsize these instances. However, these instances are for instance families only.
The AWS Compute Optimizer provides extended instance type recommendations. This service provides downsizing recommendations across, as well as within instance families. Additional insights include recommendations for EC2 instances that are parts of an Auto Scaling group and upsizing recommendations to remove performance bottlenecks.
Scheduled RIs
For workloads running periodically in the, on daily, weekly, monthly or part-time basis, you might be able to leverage scheduled RIs. This can help reduce overall EC2 billing.Use scheduled RIs to reserve capacity on a recurring basis according to the app’s schedule. After purchasing the RIs, they remain ready to launch during the pre-specified time.
Use Spot Instances
You can leverage spot instances to reduce the costs of fault-tolerant workloads, by up to 90%. This usually works for containerized workloads, big data operations, CI/CD pipelines, high-performance computing (HPC), web servers, and most testing and development workflows.
To meet a target capacity, use EC2 Auto Scaling to launch spot and on-demand instances as needed. You can set up this automated process to request spot instances and maintain target capabilities even when spot instances get interrupted.
The Perfect Blend of EC2 Instance Pricing with Spot.io
While the various EC2 instance pricing models offer cloud spend optimization, managing it all on your own is not so simple. Using reserved instances and savings plans creates financial lock-in which forces you into time-consuming, complex capacity planning to make sure you buy the right RIs. Even after that, projects might change unexpectedly leaving you with unused reservations and wasted money. When it comes to spot instances, they are seemingly unsuitable for production workloads, as they can be terminated with just a 2-minute warning.
To address these challenges, Spot by NetApp offers a full suite of cloud financial management tools. These tools can help with everything from spend reporting and cost allocation, to running production and mission-critical workloads on EC2 spot instances, to maximizing utilization and ROI on EC2 reserved instances and savings plans.
Check out how you can dramatically optimize your EC2 instance costs today!