AWS EC2 (Amazon Web Services Elastic Compute Cloud) provides scalable computing capacity in the cloud. Users can run applications on a virtual server known as an EC2 instance, customizing computing configurations based on their needs.
EC2 offers various instance types optimized for different tasks. Users benefit from a virtual environment that they can select depending on the amount and type of resources needed by their applications, such as CPU, memory, and storage.
EC2 costs are becoming a critical part of IT financial management. Organizations cannot ignore EC2 costs, which often represent a large proportion of an organization’s IT budget, and can rapidly escalate and get out of hand. EC2’s pay-as-you-go model can lead to significant costs if not properly monitored and managed: Uncontrolled spending can result from over-provisioning resources, running instances 24/7 without necessity, and insufficient understanding of pricing models and usage patterns.
Effective cost management ensures that resources are used efficiently, aligns spending with business needs, and maximizes the return on investment from cloud infrastructure. Additionally, disciplined cost management supports better forecasting and budgeting, which are crucial for maintaining financial health.
This is part of a series of articles about AWS pricing.
In this article:
- Understanding AWS EC2 Pricing
- EC2 Instance Families and Cost Examples
- Considerations for Estimating AWS EC2 Costs
- 5 Tips to Cut Your EC2 Costs
Understanding AWS EC2 Pricing
Here’s an overview of the pricing structure of EC2.
Purchase Models
There are several models for purchasing EC2 instances:
- On-demand instances: Users pay for compute capacity by the hour or second without long-term commitments. On-demand instances are suitable for applications with short-term, spiky, or unpredictable workloads that cannot be interrupted.
- Reserved instances: Users can commit to using specific instance types within an AWS Region or Availability Zone, committing in advance to 1 or 3 years of use. A 1-year commitment offers a discount of 40% compared to on-demand instances, while a 3-year commitment offers a discount of 60%.
- Savings plans: Offer a flexible pricing model that can reduce costs by up to 72% compared to on-demand prices, in exchange for a commitment to consistent usage over a 1- or 3-year term. AWS provides three types of savings plans: compute savings plans, EC2 instance savings plans, and Amazon SageMaker savings plans.
- Spot instances: Amazon provides access to unused EC2 capacity at discounts of up to 90% compared to on-demand prices, but can be interrupted at 2 minutes’ notice. These instances are suitable for fault-tolerant or stateless workloads or those with flexible start and end times.
Reserved or Dedicated Capacity
Amazon offers the following options for reserving capacity at a reduced price:
- On-demand capacity reservations: Users can reserve compute capacity for their EC2 instances within a specific Availability Zone for any duration. This ensures that users have guaranteed access to EC2 capacity, mitigating the risk of capacity constraints and providing assurance during critical business events.
- EC2 capacity blocks for ML: Support machine learning workloads by allowing users to reserve GPU instances for future use. This reservation model requires no long-term commitment, enabling users to pay only for the compute time they need. These blocks are useful for training and fine-tuning ML models, running experiments, and preparing for anticipated increases in demand for ML applications.
- Dedicated hosts: Provide a physical EC2 server exclusively for the user’s needs. This option helps reduce costs by allowing the use of existing server-bound software licenses, such as Windows Server and SQL Server. Dedicated hosts can be purchased on an hourly basis or through savings plans.
Per-Second Billing
Per-second billing for Amazon EC2 ensures that users only pay for the compute capacity they actually use. With per-second billing, EC2 usage is charged in one-second increments, starting with a minimum of 60 seconds.
Per-second billing is available for:
- Instances running on Amazon Linux, Windows, Red Hat Enterprise Linux, Ubuntu, and Ubuntu Pro.
- Instances running on all AWS Regions and Availability Zones.
- All EC2 purchase models.
- Provisioned storage for Amazon Elastic Block Store (Amazon EBS) volumes.
Related content: Read our guide to AWS pricing vs Azure
EC2 Instance Families and Cost Examples
AWS EC2 offers a range of instance families, with instance types classified based on their resource configurations and target workloads. Below are examples of EC2 instances and their cost as of the time of this writing.
Note: EC2 prices are subject to constant change, for up-to-date information consult the official pricing page.
General Purpose Instances
General purpose instances provide a balanced mix of compute, memory, and networking resources. They are suitable for a variety of applications, including web servers and code repositories.
Examples include:
t4g.nano:
- vCPU: 2
- Memory: 0.5 GiB
- On-demand hourly rate: $0.0042
- Storage: EBS Only
- Network performance: Up to 5 Gigabit
t3.micro:
- vCPU: 2
- Memory: 1 GiB
- On-demand hourly rate: $0.0104
- Storage: EBS Only
- Network performance: Up to 5 Gigabit
t3.large:
- vCPU: 2
- Memory: 8 GiB
- On-demand hourly rate: $0.0832
- Storage: EBS Only
- Network performance: Up to 5 Gigabit
Compute Optimized Instances
Compute optimized instances are suitable for applications requiring high performance processors. These instances are useful for tasks such as batch processing, media transcoding, high performance computing, and machine learning inference.
Examples include:
c7a.medium:
- vCPU: 1
- Memory: 2 GiB
- On-demand hourly rate: $0.05132
- Storage: EBS Only
- Network performance: Up to 12,500 Megabit
c7a.2xlarge:
- vCPU: 8
- Memory: 16 GiB
- On-demand hourly rate: $0.41056
- Storage: EBS Only
- Network performance: Up to 12,500 Megabit
c7g.16xlarge:
- vCPU: 64
- Memory: 128 GiB
- On-demand hourly rate: $2.3123
- Storage: EBS Only
- Network performance: 30 Gigabit
Memory Optimized Instances
Memory optimized instances are intended for workloads requiring high memory performance. These instances are suitable for applications involving large data sets and in-memory processing.
Examples include:
x2gd.medium:
- vCPU: 1
- Memory: 16 GiB
- On-demand hourly rate: $0.0835
- Storage: 1 x 59 SSD
- Network performance: Up to 10 Gigabit
x2gd.8xlarge:
- vCPU: 32
- Memory: 512 GiB
- On-demand hourly rate: $2.672
- Storage: 1 x 1900 SSD
- Network performance: 12 Gigabit
x2idn.24xlarge:
- vCPU: 96
- Memory: 1536 GiB
- On-demand hourly rate: $10.0035
- Storage: 2 x 1425 NVMe SSD
- Network performance: 75 Gigabit
Accelerated Computing Instances
Accelerated computing instances use hardware accelerators to perform tasks more efficiently than software running on CPUs. These instances are suitable for functions such as floating-point calculations, graphics processing, and data pattern matching.
Examples include:
p3.2xlarge:
- vCPU: 8
- Memory: 61 GiB
- On-demand hourly rate: $3.06
- Storage: EBS Only
- Network performance: Up to 10 Gigabit
p3.16xlarge:
- vCPU: 64
- Memory: 488 GiB
- On-demand hourly rate: $24.48
- Storage: EBS Only
- Network performance: 25 Gigabit
g5.4xlarge:
- vCPU: 16
- Memory: 64 GiB
- On-demand hourly rate: $1.624
- Storage: 1 x 600 GB NVMe SSD
- Network performance: Up to 25 Gigabit
Storage Optimized Instances
Storage optimized instances are intended for workloads requiring high, sequential read and write access to large datasets on local storage. These instances are optimized to deliver low-latency and high IOPS performance.
Examples include:
i4g.large:
- vCPU: 2
- Memory: 16 GiB
- On-demand hourly rate: $0.15444
- Storage: 1 x 468 SSD
- Network performance: Up to 10 Gigabit
i4i.4xlarge:
- vCPU: 16
- Memory: 128 GiB
- On-demand hourly rate: $1.373
- Storage: 1 x 3750 NVMe SSD
- Network performance: Up to 25 Gigabit
i4i.metal:
- vCPU: 128
- Memory: 1024 GiB
- On-demand hourly rate: $10.982
- Storage: 8 x 3750 NVMe SSD
- Network performance: 75,000 Megabit
Considerations for Estimating AWS EC2 Costs
When estimating AWS EC2 costs, several factors need to be considered to avoid unexpected expenses:
- Instance Type and Size
Choosing the right instance type and size based on the specific workload requirements ensures cost efficiency by avoiding over-provisioning or under-provisioning resources. For example, general purpose instances (e.g., T3, M5) provide a balance of compute, memory, and networking resources and are suitable for various applications such as web servers and small databases.
Compute optimized instances (e.g., C5, C6g) are suitable for compute-intensive tasks like batch processing and high-performance computing. Memory optimized instances (e.g., R5, X1) cater to memory-intensive applications such as large databases and in-memory analytics.
- Usage Duration
On-demand instances are billed per second, with a minimum of 60 seconds, making them suitable for short-term, spiky, or unpredictable workloads. However, for long-term, stable workloads, reserved instances or savings plans offer substantial discounts in exchange for a commitment to a 1- or 3-year term.
Reserved instances provide up to 75% savings compared to on-demand pricing, making them cost-effective for applications with predictable usage patterns. Additionally, the chosen billing model should align with usage patterns to optimize costs.
- Storage Options
Amazon Elastic Block Store (EBS) volumes are persistent storage options that can be attached to EC2 instances. EBS volumes are billed based on the provisioned storage size and the amount of data transferred. There are different types of EBS volumes, such as General Purpose SSD (gp3), Provisioned IOPS SSD (io2), and Magnetic (standard), each with its own cost structure.
Additionally, using instance store volumes, which are temporary storage directly attached to the instance, can be cost-effective for ephemeral data that does not need to persist after the instance is terminated. It's also important to consider costs associated with EBS snapshots, which provide a backup of the EBS volumes.
- Data Transfer
AWS charges for data transferred out of the AWS region, between regions, and between different availability zones. Intra-region data transfer between instances within the same availability zone is generally free, but cross-zone data transfers incur charges.
High outbound data transfer requirements, such as serving large files or streaming media to end users, can lead to substantial costs. To manage these expenses, consider strategies such as using Amazon CloudFront, a content delivery network (CDN), to cache and distribute content closer to end users, reducing the volume of data transferred directly from the EC2 instances.
- Networking Performance
Instances with higher networking capabilities, such as those supporting enhanced networking, might incur additional costs. Enhanced networking provides higher packet per second (PPS) performance, lower latency, and reduced jitter, making it suitable for applications requiring high network throughput.
For example, instances with Elastic Network Adapters (ENA) or Elastic Fabric Adapters (EFA) offer advanced networking features at a premium cost. Evaluating the networking performance requirements of the applications is important for selecting instances with the appropriate capabilities without overpaying for unnecessary features.
5 Tips to Cut Your EC2 Costs
Here are some of the steps that organizations can take to optimize costs on EC2.
1. Determine Compute Requirements
Assess the application's workload and identify the minimum resources needed for optimal performance. This includes evaluating CPU, memory, storage, and networking requirements.
Consider running performance tests and using AWS's Cost and Usage Reports to analyze the organization’s historical usage data. This analysis helps in selecting the most appropriate instance types and sizes, preventing over-provisioning and underutilization of resources.
2. Right-Size Your Workloads
Rightsizing involves continuously analyzing and adjusting instances to match the demands of the applications. Free tools like AWS Trusted Advisor and AWS Compute Optimizer can provide basic recommendations on optimal instance types based on established usage patterns. By resizing instances to better fit workload requirements, organizations can achieve significant cost savings.
Regularly review instances and adjust them as necessary. For example, if a particular instance is consistently underutilized, consider moving to a smaller instance type. If an instance is frequently running at full capacity, scaling up might be more cost-effective.
3. Schedule Instances to Stop When Not in Use
Automating the stopping and starting of instances can lead to substantial savings, especially for development and testing environments that do not need to run 24/7. AWS Instance Scheduler is a tool that can automatically stop instances during non-working hours and start them when needed. This approach ensures that you only pay for instances when they are actively being used.
Implementing start and stop schedules for non-production environments prevents unnecessary running costs. Additionally, instances used for batch processing or periodic workloads can also be scheduled to optimize usage and reduce idle time.
4. Use Cost Allocation Tags
A tagging strategy helps categorize and track AWS resources and their costs. Tags are key-value pairs that can be assigned to EC2 instances, EBS volumes, and other AWS resources. By tagging resources according to project, department, or environment (e.g., development, testing, production), organizations can gain detailed insights into their spending patterns.
Cost allocation tags are critical for financial accountability over AWS resources, and are necessary to charge back AWS costs to specific departments. Tools like AWS Cost Explorer and AWS Resource Groups can help analyze tagged resources, break down their costs, and identify areas of potential optimization.
5. Leverage Automated Tools to Reduce Costs
Utilizing automated tools can help manage and reduce AWS EC2 costs effectively. AWS offers several free cost management tools, such as AWS Cost Explorer, which provides basic cost and usage reports. AWS Budgets allows setting custom cost and usage budgets, and sends alerts when usage exceeds thresholds.
Third-party cloud cost management tools provide more advanced analytics and cost optimization features, as well as multi-cloud capabilities. These tools can identify cost-saving opportunities, enforce cost optimization policies, and automate actions to reduce unnecessary expenses. By leveraging automation, organizations can maintain cost control and continuously optimize their AWS spend.
AWS Cost Optimization Made Easy with Finout
Finout's FinOps solution is particularly adept at managing AWS costs, including those associated with Amazon Elastic Kubernetes Service (EKS), making it an excellent tool for organizations leveraging AWS's extensive cloud services. It facilitates real-time cost allocation and reassignment across the entire AWS infrastructure, which is pivotal for companies with intricate and dynamic cloud environments.
Furthermore, Finout natively integrates into the entire company infrastructure without adding code or an agent, giving a holistic view of the entire company's cloud spend, rather than allocating and governing spend in minutes, making adopting FinOps for enterprises easier than ever before.