Amazon Elastic Compute Cloud (EC2) is the most-used service on AWS. With hundreds of different instance types at various price points, it’s challenging to select the right compute resource for your needs and budget. This blog will review your options, summarize costs, and provide best practices for managing your EC2 usage. Show
What is AWS EC2?AWS EC2 provides compute capacity in the cloud. At the heart of this service is the EC2 instance: virtual machines that run an operating system on top of resources like a CPU, memory, hard disk, etc. With EC2, you can easily provision an instance that’s secure, runs the software required for operating the business, and is available in minutes. When you spin up an EC2 instance, you must choose the instance type (e.g., T3) and size (e.g., large). This determines the resource capacity of the machine and hourly pricing. You can do this manually from the AWS Management Console, or programmatically. You are only charged for the instances while they are running, so when you’re done with your instances, you can spin them down and stop paying for them. Amazon EC2 family typesEach EC2 instance family meets a target application profile in one of these categories:
Amazon describes an instance with the instance type first, then size. For example, c5.large means that the instance belongs to the C5 instance type (which is in the compute optimized family). You can infer it’s a fifth-generation type and its size is large. Let’s run through a brief overview of the various EC2 instances families. M and T families: General purposeThe M and T families are the workhorses of EC2. The M family has a good balance of CPU, RAM, and disk size/performance, making it the best choice for applications with consistent performance needs. Unless you know you will be running a highly RAM/CPU/IO-intensive workload, you can usually start with an M instance and monitor its performance for a while. Then if you find that the instance is performance-limited by one of the hardware characteristics, you can switch over to another more specialized family. The T family is a lower-cost option than the M family. It’s also aimed at general-purpose workloads but is burstable. These instances are intended to operate at a low baseline performance for substantial blocks of time and can then automatically burst performance as needed. You can think of this bursting as in-built elasticity. It’s best for applications that don’t require much performance most of the time but have periods where they’re active. You might use a T instance for lower-throughput applications such as administrative applications, low-traffic websites, or development and testing. C family: Compute optimizedCompute optimized instances are for applications that need a lot of compute power, with a higher ratio of vCPUs to memory and the lowest cost per vCPU. Examples of applications that are suited for the C family include front-end fleets for high-traffic websites, on-demand batch processing, distributed analytics, video encoding, and high-performance science and engineering applications. X, R, z1d, and High Memory families: Memory optimizedThe X1, X2, R4, R5, R6, and z1d instances are for memory-intensive applications. These families have the lowest cost per GB of RAM, making them a good choice if your application is memory-bound. The R families are ideal if you’re doing data mining, real-time processing of unstructured big data, or Hadoop/Spark clusters. X1 and X2 instances are for enterprise-sized in-memory applications, like SAP HANA. They have a much higher proportion of memory than the R family. z1d instances deliver high single-thread performance with a sustained all core frequency of up to 4.0 GHz — the fastest of any cloud instance. The result is instances of both high-compute performance and high memory. z1d is recommended for use cases like electronic design automation (EDA), gaming, or relational database workloads with high per-core licensing costs. Instances of the High Memory family offer the most memory of any EC2 instance and are primarily used for large in-memory databases. Ranging from three to 24 TiB in available memory, these instances were originally made available for SAP HANA deployments with fixed-term commitments. Since mid-2021 they’ve been made available with On-Demand pricing and are finding a wider set of use cases. H, D, and I families: Storage optimizedH, D, and I families are a good choice if your applications require high performance from its local storage. This is in comparison to most instance families, such as compute optimized and general purpose types, which don’t have local storage but rely on attached EBS volumes instead. The storage optimized families offer a wide range of storage sizes, either backed with HDDs or SSDs. H1 offers up to 16TB of hard drive storage space. It’s an excellent choice for workloads that use MapReduce or a streaming platform like Apache Kafka. D3 offers up to 48TB of hard drive storage space. Use this family for applications like massively parallel processing data warehousing, Hadoop, and distributed file systems. I3 instances include Non-Volatile Memory Express (NVMe) SSD-based instance storage. This family is optimized for low latency, very high random I/O performance, and high sequential read throughput. It’s a good fit for NoSQL databases, in-memory databases, data warehousing, Elasticsearch, and analytics workloads. P and G families: Accelerated computingIf your applications are graphics-processing intensive or run machine learning models, look at the P and G families for achieving high performance and cost efficiency. P instances are designed for most general-purpose GPU apps and are useful for video editing. G instances are optimized for GPU-heavy applications, including automated speech recognition or language translation. There’s also an F1 family that comes with customizable hardware acceleration. Summary of AWS EC2 instancesBelow is a table that lists the EC2 families and their associated categories, along with links to their specs on AWS’ site (where available).
Tips for picking your AWS EC2 InstanceHere are a few things to remember when you’re deciding which instance to use:
One last note about instance type notation: until recently, most instance types were comprised of two items, a letter to signify the category and number to signify the generation — for example, C4, C5, M4, M5, etc. These instance types were usually backed by Intel processors. Latest generation instance types now have a third item to mark the type of processor; for example, M6a, M6i, and M6g to identify the AMD, Intel, and Graviton versions of the M6 instance. Once you’ve decided on the EC2 instances that fit your use case, you’ll need to decide how to pay for them. AWS offers a variety of EC2 instance pricing options. AWS EC2 pricing: On-Demand pricingOn-Demand pricing means you pay for the compute capacity you need without any long-term commitments. You use the instance for as long as you need it, then shut it down. On-Demand pricing is continuously computed by the second (with a minimum charge of 60 seconds), even if the prices you see on the AWS site are per hour. Prices vary depending on the type and size of the instance, the region, and the OS. As an example, the On-Demand prices for an m6a.large instance in the US West (Oregon) region look like this:
The On-Demand prices for the same instance in the EU (Ireland) region look like this:
On-Demand offers convenience and is the default pricing option, but it’s also the most expensive option. The flexibility of On-Demand will be worth the higher costs if you are developing and testing unpredictable workloads or applications. AWS EC2 pricing: Savings Plans and Reserved InstancesA great way to reduce your EC2 costs is to lower the effective hourly rates paid via purchasing commitment-based discounts from AWS. For EC2 these instruments include Savings Plans (SP) and Reserved Instances (RI). In this post, we cover only SPs, which were launched in late 2019 and were designed to be far simpler to manage and typically result in higher total savings compared to RIs. Due to these inherent advantages, most organizations have now shifted to purchasing SPs. It is worth noting however that the overarching principle — committing to ongoing levels of usage to get a percentage discount — of each instrument remains consistent and many of the purchasing details remain the same. For example, the term length and payment options remain the same, and the savings rates are identical (Compute SPs match Convertible RIs, while EC2 Instance SPs match Standard RIs). Payment optionsWhen purchasing a SP there are three payment options:
The more you pay upfront, the higher the savings rate. Whatever you don’t pay upfront is paid monthly over the term of the commitment. Term lengthYou choose either a one-year or three-year term when you purchase a SP. The three-year option has significantly higher savings rates — typically at least a 50% higher savings rate compared to one-year depending on the instance type — but requires a higher level of certainty that workloads will still be running over the long term. Example discountFor example, say you’re using an m6i.xlarge in the US-West (Oregon) region. Paying on-demand for this instance runs at $0.192 an hour. A one-year EC2 Instance SP with partial upfront payment will cost $530 upfront and $44.15 per month for a total of $1,060. That’s an effective hourly rate of $0.121, which equates to a 37% discount compared to on-demand. If such an m6i.xlarge instance happened to run for every hour over the one-year term, then it being covered by this SP would save $622. It’s not difficult to see how this type of discounting can really add up if SPs cover a broad set of usage. It is worth noting that any unused SP hours (a common scenario as workloads come and go) throughout the term are not recoverable, so the effective savings rate can drop below the published figure. EC2 Instance Savings Plans vs. Compute Savings PlansThe most important decision when purchasing SPs is whether to maximize savings (EC2 Instance SP) or maximize coverage (Compute). Making this decision involves understanding the savings rates on offer and the specific usage you are committing to.
Savings Plans buying tips
AWS EC2 pricing: Spot InstancesAnother option for reducing your hourly EC2 rates are to use Spot Instances. Spot Instances offer the largest potential discount from On-Demand prices — up to 90% in the right conditions. With Spot Instances, you bid to provision your instances on AWS’s excess compute capacity. Prices change depending on supply and demand. When the EC2 instances you want are in high demand in a particular region, you’ll have to bid more to be competitive, but you can set your maximum price. If the Spot price of the instance is below your maximum bid and the capacity is available, then your request is fulfilled. But there’s a catch to the low price. AWS can interrupt your Spot Instance when the Spot price exceeds your maximum price, when the demand for Spot Instances rises, or when the supply of Spot Instances decreases. There are ways to mitigate the risk by using AWS’ Hibernate or Pause-Stop features, but any workload on a Spot Instance should be structured to minimize the impact of interruptions. AWS EC2 Dedicated HostsAn Amazon EC2 Dedicated Host is a physical server whose EC2 instance capacity is fully dedicated to your application. Dedicated Hosts can help you address compliance requirements and allow you to use your existing server-bound software licenses. Like other EC2 options, you can turn Dedicated Hosts on or off at will, and you can purchase reservations to lower costs. But there are a few key differences. When you set up a Dedicated Host, you choose a configuration that determines the kind and number of instances that you can run on it. You’re billed hourly for each active Dedicated Host, rather than being billed for each instance. The hourly price varies depending on the configuration of the Dedicated Host. Give your EC2 backbone the support it needsEC2 is the core of many cloud architectures. The better you manage your EC2 usage and costs, the stronger your cloud will be — and the more you’ll get from it. With the right strategy and management practices, you’ll be able to get all the resources you need for substantially less, freeing up valuable funds that can fuel innovation in your company. Download our eBook Choosing the Right Amazon EC2 Instances to Optimize Your Cloud for further reading. What billing timeframes are available for Amazon EC2 OnEC2 usage is billed in one-second increments, with a minimum of 60 seconds.
How are EC2 OnEach partial instance-hour consumed will be billed per-second for Linux, Windows, Windows with SQL Enterprise, Windows with SQL Standard, and Windows with SQL Web Instances, and as a full hour for all other instance types.
How are onEach On-Demand Instance is billed per instance hour from time it is launched until it is terminated or stopped. Partial instance hours are rounded up to the full hour upon billing. A free tier of usage is also available.
What are the three types of EC2 instances with regard to billing options?AWS provides four main options to purchase Amazon EC2 Instances. They are On-Demand Instances, Reserved Instances, Spot Instances, and Savings Plans.
|