Different instance types are built for your different purposes. Instance types are categorised into families, called general purpose, compute optimised, memory optimised, accelerated computing, and storage optimised.
EC2 instances have different pricing models:
There is On-Demand, which is the most flexible and has no contract.
Spot pricing, which allows you to use unused capacity at a discounted rate.
Savings Plans or Reserved Instances, which allow you to enter into a contract with AWS to get a discounted rate when you commit to a certain level of usage
Dedicated Hosts, which is the most expensive option that dedicates a server for your needs.
Amazon EC2 instance families
Amazon EC2 offers a bunch of virtual computer options (called instance types) for different tasks. For example, some instances provide more capacity than others. These instance types are grouped into families.
Think of these instance families as different kinds of employees at a coffee shop. You have cashiers, baristas, and even someone skilled in latte art – each has their own role.
At the coffee shop: these are the superhero staff that can handle a bit of everything, from serving customers to managing the kitchen.
In AWS: General Purpose instances offer a balanced mix of compute power, memory, and network resources. They are all-rounders and can handle a wide range of workloads, such as web servers, small to medium databases, and development/testing environments.
At the coffee shop: these are like your super-speedy baristas. They're great for serving lots of customers fast.
In AWS: Compute-optimised instances are designed for tasks that require substantial processing power. They are excellent for applications with high computational needs, like video game servers, complex scientific simulations (i.e. virtual experiments), and batch processing (where you're handling lots of data).
At the coffee shop: the memory masters – they remember every customer's order even during the morning rush.
In AWS: Memory-optimised instances are tailored for workloads that need large amounts of memory for quick data processing. They are suitable for memory-intensive applications, like databases and real-time analysis (i.e. instantly analysing information to make decisions).
At the coffee shop: our skilled latte artists – they make those beautiful designs on your coffee, turning it into art.
In AWS: Accelerated computing instances use fancy graphics and heavy calculations, making them useful in gaming, machine learning and complex science calculations. They are built for even more intense tasks that compute optimised instances might struggle to handle.
At the coffee shop: our stockroom experts – they make sure we never run out of ingredients and keep everything organised.
In AWS: Storage-optimised instances are optimised for workloads that require fast and high-capacity storage. They're perfect for tasks like big data processing and database work.
Think of pricing models in AWS as how you pay at the coffee shop.
Whether you prefer à la carte ordering, daily specials, loyalty programs, prepaid gift cards, or even a private party, AWS has a pricing model that fits your preferences.
Note that some of the pricing models below can apply to other AWS services too, like Amazon Redshift, AWS Lambda, DocumentDB and more! But, people tend to be more particular about pricing models with EC2. EC2 instances make up a huge portion of the overall AWS cost for many users, so choosing the right one can result in big savings.
At the coffee shop: à la carte ordering – you pay for exactly what you want to eat or drink without any subscriptions.
In AWS: With On-Demand, you pay for compute capacity by the hour or second, with no upfront costs. It's ideal for short-term, unpredictable workloads that cannot be interrupted. On-Demand Instances are also a quick and easy option if you're just testing something for the first time, and don't want to commit to any plans.
At the coffee shop: our daily specials – you get a discount on something from the cabinet that's a day or two old.
In AWS: Spot Instances allow you to take advantage of unused EC2 capacity at a significantly lower cost, up to 90% off On-Demand prices. The Spot price changes depending on how much spare capacity is available, so you can also set the maximum price you are willing to pay.
AWS can potentially reclaim the capacity allocated to your Spot Instances if it's needed for other purposes. When this happens, your Spot Instances might be interrupted or terminated with short notice. This means Spot Instances are suitable for applications that can tolerate interruptions, and are only a reasonable investment at low compute prices.
At the coffee shop: the loyalty program – you commit to buying the exact same coffee, and get discounts in return.
In AWS: You commit to a one- or three-year term, and in return, you get a lower hourly rate. It's best for applications with steady, predictable workloads. The three year term gives you even greater savings.
With Reserved Instances, you can choose the type that best fits your applications needs.
Standard Reserved Instances: These provide the biggest discount (up to 72% off On-Demand pricing). This option is a good fit if you already know the EC2 instance type and size you want to use, and the Region you plan to run them.
Convertible Reserved Instances: These provide a discount (up to 54% off On-Demand pricing) and the flexibility to change families (e.g. whether it's general purpose or compute-optimised), operating system (e.g. Microsoft Windows Server), and tenancies*.
*In AWS, tenancy = how your EC2 instances are physically placed in the underlying physical servers in AWS' data centres.
Default tenancy means your instances share the same physical hardware with other AWS customers, which is a cost-effective option.
Dedicated tenancy means your instances run on hardware dedicated to your AWS account, providing enhanced privacy and control, but it can be more expensive.
Scheduled Reserved Instances: These are available to launch within a time window you book in advance.
You can choose between three payment options: All Upfront, Partial Upfront, or No Upfront.
You can also choose to specify an Availability Zone to get EC2 Capacity Reservations, which is another service to guarantee that a certain amount of EC2 computing power will be available at a time you specify.
You are charged the normal On-Demand rates at the end of the term, unless you terminate the instance or purchase a new Reserved Instance with the exact same attributes (i.e. instance family and size, Region, tenancy).
At the coffee shop: the more flexible loyalty program, where you don't have to buy the exact some coffee (but still commit to coming back).
In AWS: Savings Plans provide a flexible pricing model that commit to a specific amount of usage (measured in $/hour) for a one or three-year term. It offers cost savings up to 72% from On-Demand and is suitable for consistent workloads. Any usage beyond the committed amount if charged at the standard On-Demand rates.
You might notice that Savings Plans are similar to Standard Reserved Instances, so let's clarify the difference.
Unlike Reserved Instances, Savings Plans don't ask you to specify upfront what EC2 instance type and size (for example, m5.xlarge), OS, and tenancy.
You also don't need to commit to a number of instances over a 1-year or 3-year term, or have the ability to do any capacity reservation.
You still need to choose the Region, but there is no need to specify an Availability Zone.
Savings Plans apply to EC2 and two other compute services you'll learn very soon - AWS Lambda and AWS Fargate.
At the coffee shop: your private party – you have the entire place to yourself!
In AWS: Dedicated Hosts are physical servers dedicated for your needs. Companies use Dedicated Hosts to meet compliance requirements or use existing server-bound software licences. For example, some software simply have to run in a physical Microsoft Server or Microsoft SQL Server, and you won't know if your software is running on the right hardware with usual EC2 services.
Dedicated Hosts can be purchased on demand (hourly).
They are generally more expensive than other options, but can be purchased as a Reservation for up to 70 percent off the On-Demand price.
An extra note for the curious
Instance types have some pretty funky names, for example c5n.xlarge, or t2.micro.
These names are made of a prefix identifying the type of workloads they’re optimised for, followed by a size. For instance (pun intended), the instance type c5n.xlarge can be broken down like this:
First character – indicates the instance family. c = compute optimised family.
Second character – indicates the generation of the instance. 5 = this instance type is the fifth version created, kind of like how an iPhone 7 is the 7th version of the iPhone created.
Any other characters before the period – There can be multiple characters (not just one), or even no characters (such as t2.micro). In this case, n = the instance comes with specific enhancements or capabilities that make it different from other instances in the "c5" family with the "xlarge" size. The exact nature of these enhancements are not explicit.
After the period – instance size. In this example, it's xlarge (extra large).