EC2 Pricing: The Abridged Guide

Image Source: Pixabay

EC2 Pricing Overview

Amazon Elastic Compute Cloud (AWS EC2) is a service that lets you rent cloud-hosted virtual servers, also known as instances. AWS EC2 offers a wide variety of instance types and instance families, all of which can be deployed across many geographical regions. 

Amazon EC2 offers flexible pricing models, including a free tier, on-demand pricing, Saving Plans, Dedicated Hosts, Reserved Instances (RIs), and Spot Instances. Each pricing model offers different rates and terms. 

In addition to the available pricing models, the rates of EC2 instances vary according to several factors. For example, pricing varies depending on the chosen region, instance family, operating system (OS), off-peak use, and tenancy. 

When you estimate the cost of running workloads on EC2, you should also take into account any additional component you integrate with EC2. This includes data transfer fees, autoscaling services, Elastic IP addresses, Amazon Elastic Block Store (EBS) storage, and AWS CloudWatch. Determine these aspects in advance to ensure you do not miss any hidden costs. 

Amazon EC2 Pricing Models

Free Tier

AWS provides a free tier that enables you to try out many services before committing to long term use. AWS offers 750 hours of EC2 resources for a duration of 12 months. The 12 months period starts on the day you set up the account. The 750 hours include Windows, Linux, SLES, RHEL, t2.micro, and t3.micro instances. The total amount depends on the chosen region.  

On-Demand

The on-demand pricing model lets you pay-as-you-go. There is no need for any upfront payment or long-term commitment. You pay per use according to the market price, by the second or the hour. 

On-demand instances let you quickly increase or decrease capacity as needed, providing a high level of flexibility. However, on-demand pricing is the highest of all pricing models. To avoid incurring expensive bills, use on-demand for short-running applications and unpredictable workloads.

Spot Instances

Spot Instances provide savings of up to 90%% off the on-demand pricing. A spot instance is essentially available capacity that AWS has no use for at that moment. To gain access to a spot instance, you need to set a bid. If there is an instance available at the price range you set, you can get the instance at a discounted price. 

Note that once AWS needs the instance it will be terminated within a 2-minutes notice. To prevent issues, use Spot Instances for stateless applications or workloads with a definite start and end time.

Reserved Instances

Reserved Instances (RIs) provide savings of up to 72% off the on-demand pricing. AWS offers three types of reserved instances—standard RIs, Convertible RIs, and Scheduled RIs. The standard RIs are relatively less expensive than convertible RIs, but convertible RIs offer more flexibility. You can learn more about the different RIs here

RIs offer a reduced price in return for a long term commitment. You need to commit to using EC2 for 1-3 years, and you can not get back your investment. It is not possible to scale down—only up. Use RIs for predictable applications running for a longer period of time.

Dedicated Hosts

The Dedicated Hosts service lets you rent an entire EC2 server. AWS offers on-demand Dedicated Hosts, as well as reserved hosts. By reserving Dedicated Hosts you can get up to 70% off the on-demand pricing. You can use Dedicated Hosts to reduce related expenses, such as licensing fees. However, this option is the most expensive and recommended mainly for enterprises. 

Per Second Billing

The per-second billing model lets you pay according to actual use, and unused minutes and seconds are taken off the bill. The bill is calculated according to one second increments, but the minimum is sixty seconds. You can apply per second billing to several types of resources, including on-demand, RIs, and Spot Instances. 

Tips to Reduce EC2 Costs

Alert on Under-Utilized Instances

Leverage AWS monitoring tools to ensure all EC2 instances are really needed and properly utilized. Set up long term alerts to track CPU and memory usage. Depending on your workloads, set up metrics that indicate whether CPU utilization and memory usage are being underutilized. You can then drop these instances and save on overall costs. You can set this up with AWS CloudWatch or any other monitoring service that can integrate with EC2.

Shift Between Reserved, Spot, and On-Demand

On-demand prices are expensive, but it doesn’t always make sense to use RIs or spot instances. You can actually gain big savings by shifting between several types of capacity. For example, you can purchase a certain amount of RIs to serve as your baseline. On top of this baseline, you can set up spot instances with autoscaling rules. When capacity and demand changes or you need an immediate amount of instances, you can use on-demand.

Enforce Tag Rules

To truly optimize your costs, you need data about your workloads. You can set this up with AWS config rules, which help you set up tags to describe your EC2 instances. Be sure to set up cost allocation tags which are relevant to your infrastructure. You should also set up processes that centralize and analyze the information. Use this data to gain an accurate view of your spendings and utilization and adapt your costs accordingly.

Conclusion

In this article I explained how Amazon prices its popular Elastic Compute Cloud (EC2) service. I discussed the five main pricing models—on-demand, spot instances, reserved instances (RI), and dedicated hosts, and provided three tips for reducing your costs on EC2:

  • Monitor EC2 instances that are under-utilized in terms of memory or CPU and make better use of the capacity
  • Optimize your use of pricing models, shifting resources flexibly between on-demand, spot instances and reserved instances
  • Use tags to gain data about workloads running on EC2, plan and optimize your costs

I hope this will be helpful as your organization makes better, more cost-effective use of Amazon EC2.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.