Instance Types#
EC2 Instances have a "type". The type defines a lot of things. We'll explore them in some detail now and get an understanding of the important concepts.
What does a type look like? Here's an example: c5n.xlarge
. Everything in that little string has meaning, so let's decompile the string:
Field | Meaning | More examples |
---|---|---|
c | Instance family | t , m |
5 | Instance generation | 3 , 4 |
n | Attribute (or "additional capabilities") | a , z |
xlarge | Instance size | small , 4xlarge |
So that breaks down c5n.xlarge
to <family><generation><attribute>.<size>
.
The n
or "Attribute" is broken down into a few options (I can't claim this is a complete list):
a
: AMD processorsg
: AWS Graviton processorsi
: Intel processorsd
: Instance store volumesn
: Network optimizationb
: Block storage optimizatione
: Extra storage or memoryz
: High frequency
The amount of options for each field is quite large, and for me to document them here would be quite pointless as the list would very likely go out of date within a month or two. Instead, review the following page from the AWS documentation about "General purpose instances". You'll see it identifies a lot of different instance types based on requirements:
- General purpose
- Compute optimised
- Memory optimised
- Storage optimised
- Accelerated computing
But how do you decide which one is right? Looking at the above linked documentation, you can see that AWS give recommendations for the different instance types. For exmaple, AWS state that an M5zn
instance type is suited for "Gaming, high performance computing, and simulation modeling." That's because the z
in the "Attributes" field means the CPU offers a high clock frequency, and the n
offers a high network throughput (speed), so the instance type is ideal for applicatons that need those features, and a gaming server is very sensitive to network connectivity and they tend to be a single threaded process.
Another instance type is the Mac1
, which is an EC2 Instance running on a Apple Mac Mini. They're designed to offer developers the opportunity build theyr Apple centric software remotely.
The most instance type I see, personally, is the T
family of instances. These are known as burstable instances, because they're not designed to run at 100% CPU utilisation constantly, but instead "burst" up and down as demand spikes. The AWS documentation covers "Burstable performance instances" very well and they're by far the most common instance type you'll see.
Getting the right instance type can be important. If you get it wrong, then your application might not have the resources it needs to operate correctly. This can cause software to crash or even worse, the OS. The inverse of this is, of course, an instance that's too big for a piece of software which would mean it's heavily underutilised, wasting your money for no reason at all.
We call this process right sizing, and AWS has a tool called the "Compute Optimizer". It looks at your resources and reviews their configuration, then makes recommendations on how you could optimise your spending patterns. Read more about that here.
Finally, if you find you select the wrong instance type/size, you can change it later on. Generally speaking, this is simply a case of changing the type and letting AWS do the rest, but there are some edge cases were a bit of extra work is required. You can read more about that process here.