DEV Community

loading...

The unconventional guide to AWS EC2 instance types.

Animesh Bhadra 🎯
I am a software developer who write about coding, AWS, Docker & Kubernetes. Learning Micro service & going server-less with Python. Building product using all the above is my passion.
Originally published at archerimagine.com on ・14 min read

AWS Made Easy | AWS EC2 Instance Type

Introduction

AWS EC2 instance is the heart of AWS. They are the real server.

An AWS EC2 instance, has to support workload all across the boards, right from a web server, to FPGA and even HPC.

AWS EC2 instance supports all forms of computing needs. The hardware choice is diverse for such needs.

You have 350 types of different AWS EC2 instance, in the year 2021. Selecting the right AWS EC2 instance from these big piles will be difficult.

In this article you will learn how can you choose the correct AWS EC2 instance without breaking the bank. You will also learn about the various types of the AWS EC2 instance.

If you are studying for AWS Certification. You will also learn about the AWS EC2 instance naming convention. What does the AWS decides on the instance sizing. It will also help you with understanding the various instance type, and make its home in your memory. This is by far the best technique to remember the various names of the AWS EC2 instance.

Let's jump right in.

AWS EC2 Naming Convention.

The first thing you should learn is

How is the AWS EC2 instance, getting their name?

What does a name like M5d.xlarge means?

The below image may help you understand that.

AWS Made Easy | AWS EC2 | Instance Naming Convention

If you look, these four component form the Instance Type.

  • Instance Size
  • Instance Family
  • Instance Generation
  • Additional Capability

AWS EC2 Instance Size

First, you should know the easy stuff, what does the xlarge means in the AWS EC2 naming convention?

The xlarge denotes the T-shirt size representation of the AWS EC2 instance. It defines the amount of

  • CPU
  • Memory
  • Storage
  • Network Performance.

An AWS EC2 instance possesses.

Now lets explore the M5d.

AWS EC2 Instance Family

The M means that AWS EC2 instance belongs to General purpose computing instance type. This is the Main Computing AWS EC2 instance.

You have five main categories of instance types.

  • General Purpose
  • Compute Optimized
  • Memory Optimized
  • Storage Optimized
  • Accelerated Computing

You also have sub classification with-in the five classifications.

AWS EC2 Instance Generation

The 5 in M5d represents the generation of the AWS EC2 instance. 5 is the current generation. The latest (current) generation of AWS EC2 instance is always better than a previous generation.

If you use the EC2 pricing calculator, you will find the pricing between an m4.large and m5.large is as below.

EC2 Instance Savings Plans rate for m5.large in the US East (Ohio) for 1 Year term and No Upfront is 0.06 USD

EC2 Instance Savings Plans rate for m4.large in the US East (Ohio) for 1 Year term and No Upfront is 0.062 USD

If you take the percentage, you have to pay 3.33% more for using an older generation AWS EC2. With this in mind, always choose the latest generation of hardware.

If the need is for a specific hardware, then choose the previous generation hardware.

AWS EC2 Additional capability

The d in M5d represents an additional capability.

Here is a table of additional capabilities.

Property Representation
AMD a
Graviton2 g
Local NVMe SSD d
High networking(100Gbps) n
Extra capacity e

Now you are aware of the different component of the AWS EC2 name.

Every Instance size(xLarge) will have twice the number or CPU and Memory and storage resource from the previous size(large). How does this happen, jump forward to find it out.

Instance Sizing

The below image, helps you understand this concept. Each instance size (xlarge) will have twice the number of CPU and memory than previous size (large).

AWS Made Easy | AWS EC2 | Instance Type Sizing

You should not believe the above image, lets talk data, use the AWS EC2 pricing calculator. It helped in creating the below table.

Instance Size vCPUs Memory (GiB) Network Performance 1yr Std reserved hourly cost Price increase
.large 2 8 upto 10 Gbps 0.06
.xlarge 4 16 upto 10 Gbps 0.121 101.67 %
.2xlarge 8 32 upto 10 Gbps 0.242 100.00%
.4xlarge 16 64 upto 10 Gbps 0.484 100.00%
.8xlarge 32 128 10 Gbps 0.968 100.00%

The table and the image representation completely match. xlarge has twice the number of vCPU and the memory compared to large. The pricing for 1 yr reserved hourly cost, is twice.

This poses an important question, while choosing the size. Will one go for 1 8xlarge instance or 8 xlarge instance.

Multiplying 0.121 * 8 = 0.968 tells that there is no difference between the two. You can pick any of the combinations.

The load on the service is not linear, it is a curve. This is not considered in the above multiplication.

If you remember the Bresenham's line drawing algorithm.It tells us, how to draw a line using square pixels.

The line can only be smooth if you have many dense pixels. The AWS EC2 instance, can match the uneven load if you have much granular AWS EC2 instance size.

It is always better to use a lower instance size. Use a Higher instance size if you have a specific need for it.

There are far to many instance classifications of AWS EC2, lets learn about them.

Instance Classification

The below image represent the relations of different AWS Instance Type. It has an alphabet written on a Green background. It will tell you the value of Instance Familyin AWS EC2 Naming Convention.

AWS Made Easy | AWS EC2 | Instance Classification

You will only focus on the naming of the classification and sub classification. The details of these classifications will come later.

There are five main categories of the AWS EC2 instance.

  • General Purpose
    • General Purpose - T3/T4g Instance
    • Development environment for application can use the T3/T4g instance.
    • Transient or Temporary are a nice way to remember this sub classification.
    • The short burst of CPU power which it will need is available.
    • General Purpose - M5 Instance
    • This is the main general purpose compute choice in AWS EC2.
    • It is better to use this instance in place of the Brustable instance.
    • These instances have predictable performance.
  • Compute Optimized - Optimized CPU
    • The C Instance
    • These instances are good for high compute power.
    • These instances can serve high traffic web servers.
  • Memory Optimized - Optimized RAM
    • Memory Optimized - R Instance
    • They have higher capacity RAM, Like in case of r5.large, the base memory is 16 GiB, but in c4.large it is only 4 GiB.
    • Memory Optimized - X Instance
    • These are X tream RAM instance, the base x1.16xlarge is an instance with 976 GiB RAM.
    • Memory Optimized - Z Instance
    • The best CPU, with more memory.
    • The z1d.large has a 4.0 GHz processor, with a memory starting at 16 GiB and going till 384 GiB.
    • It even has a NVMe SSD attached, that is the reason of the d in the name.
    • This is a complete instance for high performance
  • Storage Optimized - Optimized HDD/SSD
    • Storage Optimized - D Instance
    • The application with use high I/O performance.
    • Storage Optimized - I Instance
    • The instance has NVMe SSD with low latency.
    • Storage Optimized - H Instance
    • These are HDD based local storage, so higher throughput for operation.
    • These are good for Big data operation.
  • Accelerated Computing - These are GPU and FPGA related
    • Accelerated Computing - P Instance
    • Parallel processing using the GPUs.
    • Accelerated Computing - G Instance
    • Graphics Rendering using the GPUs
    • Accelerated Computing - F Instance
    • The instance for programmable gate arrays.
    • Accelerated Computing - Inf1 Instance
    • The instance for AI/ML work load.

The instance body of work provides the root of above classification. Web Server can use the General Purpose instance. These instance are good for day to day computing.

General Purpose Instance

The most basic and all rounder AWS EC2 instances are the General Purpose Instances. They provide a perfect balance of computing, memory and networking resource. The below image shows the important points of both the sub class of the General Purpose Instance.

AWS Made Easy | AWS EC2 | General Purpose Instance Property

The four sub classification of the General Purpose Instance are.

  • General purpose - T3/T4g Instance
  • General purpose - M5 Instance
  • General Purpose - Mac
  • General purpose - Arm Instance

General Purpose - T3/T4g Instance

The T3/T4g have a baseline CPU performance of 2.5 GHz. These instance can burst to higher performance for shorter duration. The T3/T4g are burstable instance for this reason.

This burst is paid with CPU credits. When the instance is idle it leads to accumulation of CPU Credits.

EC2 Instance Savings Plans rate for t3.large in the US East (Ohio) for 1 Year term and No Upfront is 0.0522 USD

The T4g is the AWS Graviton2 Processor.

EC2 Instance Savings Plans rate for t4g.large in the US East (Ohio) for 1 Year term and No Upfront is 0.0421 USD

The ideal use case for these instances are micro-service, low-latency application, development environment.

You should be safe to not rely on the burstable CPU performance.

General Purpose - M5 Instance

These are, the more stable instance, in comparison to the T2/T4a Instance. They use a 3.1 GHz Intel Processor. These should be the first choice for anyone starting out on AWS. These instances provide a better baseline performance.

EC2 Instance Savings Plans rate for m5.large in the US East (Ohio) for 1 Year term and No Upfront is 0.06 USD

The best use case for M5 Instance are small and midsize databases, data processing tasks.

General Purpose - Mac Instance

AWS EC2 now provides macOS as an option for development. These are based on the Apple Mac Mini computer. It uses the Intel core I7 processor with 3.2 GHz (4.6 GHz Turbo) performance. There is only the mac1.metal option.

macOS products can use these instance for development, testing.

General Purpose - Arm Instance (A1)

The ARM based processor for AWS EC2 instance. It fully supports the ARM based development environment.

EC2 Instance Savings Plans rate for a1.large in the US East (Ohio) for 1 Year term and No Upfront is 0.0321 USD

Web server, micro-services, are some of the workload example for these instance.

If you have to pick one instance, then pick the M5 instance in this general category.

Use a T3/T4g only if you want to use the free tier service.

The other ARM and Mac instance, are very specific. You should use them till you do not have a specific need for these instance.

Lets move on the some very specific AWS EC2 computes instance.

Compute Optimized Instance

The server you need to use for higher compute power. They support 3.6 GHz to 3.9 GHz compute power.

AWS Made Easy | AWS EC2 | Compute Optimized Instance Property

EC2 Instance Savings Plans rate for c5.large in the US East (Ohio) for 1 Year term and No Upfront is 0.054 USD

The cost of a C5.large is cheaper than then General Purpose M instance. You need little higher compute power than use the C5 instance.

The general use case for Compute Optimized Instance are

  • high performance web servers
  • scientific modeling
  • gaming server.

Memory Optimized Instance

RAM has a direct impact on any compute operation. If you need higher RAM, then these are the instance you should use. They support 4.0 GHz compute frequency. The baseline instance, has 16 GiB RAM in them. This is more than the Compute Optimized and General Purpose Instance.

AWS Made Easy | AWS EC2 | Memory Optimized Instance Property

There are 3 types of sub classification in these memory optimized instances.

  • Memory Optimized - R instance
  • Memory Optimized - X instance
  • Memory Optimized - Z instance

Memory Optimized - R Instance

These are the generic higher RAM instance. They give more RAM per vCPU. 768 GiB being the highest RAM available.

EC2 Instance Savings Plans rate for r5.large in the US East (Ohio) for 1 Year term and No Upfront is 0.079 USD

Memory intensive applications can use the R instance to perfection.

Memory Optimized - X Instance

These instances support the large scale, enterprise class, in-memory application.

EC2 Instance Savings Plans rate for x1.16xlarge in the US East (Ohio) for 1 Year term and No Upfront is 4.11 USD

SAP HANA application can use the X Instance to perfection.

Memory Optimized - Z Instance

These are the instance which supports high compute capacity and high memory. The compute power is 4.0 GHz. They also support the NVMe SSD for low latency IO and higher RAM starting from 16 GiB to 384 GiB

EC2 Instance Savings Plans rate for z1d.large in the US East (Ohio) for 1 Year term and No Upfront is 0.117 USD

Relational databases can use the Z instance to perfection.

Storage Optimized Instance

These instance provides the variety in the Hard Disk or local storage option.

AWS Made Easy | AWS EC2 | Storage Optimized Instance Property

There are 3 sub classification of these instances.

  • Storage Optimized - D Instance
  • Storage Optimized - I Instance
  • Storage Optimized - H Instance

Storage Optimized - D Instance

These are the D or Dense instance. They provide 48 TB HDD instance storage.

EC2 Instance Savings Plans rate for d3.xlarge in the US East (Ohio) for 1 Year term and No Upfront is 0.315 USD

These instances are good for D istributed file systems like HDFS.

Storage Optimized - I Instance

High IO need the power of NVMe SSD. Since these instances are supporting NVMe SSD. You can get very low latency performance.

EC2 Instance Savings Plans rate for i3.large in the US East (Ohio) for 1 Year term and No Upfront is 0.107 USD

These instances are ideal for NoSQL databases like Cassandra, MongoDB, Redis.

Storage Optimized - H Instance

These instance support 16 TB of HDD based local storage. Since the storage is local, the latency is very low in these.

EC2 Instance Savings Plans rate for h1.2xlarge in the US East (Ohio) for 1 Year term and No Upfront is 0.318 USD

These instances are ideal for MapReduce work loads.

Accelerated Computing Instance

Till now all the instance type was using similar hardware. There was no special hardware used to improve performance. The Accelerated Computing instance changes that. It uses specific hardware for specific tasks. Like a GPU for both GPU intensive work or parallel processing.

It even uses hardware accelerators for FPGA and AWS Inferentia for AWS AI/ML work load.

AWS Made Easy | AWS EC2 | Accelerated Computing Instance Property

There is four sub classification of the Accelerated Computing Instance.

  • Accelerated Computing - P Instance
  • Accelerated Computing - G Instance
  • Accelerated Computing - F Instance
  • Accelerated Computing - Inf1 Instance

Lets dig deeper into these.

Accelerated Computing - P Instance

The P instances are also referred to as Parallel Instance. These instances are best for Machine Learning and HPC. These instances have many network cards.

EC2 Instance Savings Plans rate for p4d.24xlarge in the US East (Ohio) for 1 Year term and No Upfront is 20.1754983 USD

The use case of these P Instances are Machine Learning, HPC, Computational Finance etc.

Accelerated Computing - G Instance

These instances are best used for Graphics Intensive workloads.

EC2 Instance Savings Plans rate for g3s.xlarge in the US East (Ohio) for 1 Year term and No Upfront is 0.551 USD

The use case of these instances are 3D Visualization, graphics-intensive remote workstation.

Accelerated Computing - F Instance

These instances are the equipped with field programmable gate arrays (FPGAs).

These instances are best for genomics research, financial analysis.

Accelerated Computing - Inf1 Instance

The Inf1 instance are best used for Machine learning inference application.

EC2 Instance Savings Plans rate for inf1.xlarge in the US East (Ohio) for 1 Year term and No Upfront is 0.232 USD

These instances are useful for Recommendation engine, forecasting etc.

How to choose an instance type

AWS provides a very good tool called AWS Instance Type Explorer. It helps to choose your required instance type.

You can select one of these four options.

  • Instance category
  • Hardware configuration
  • Accelerators
  • Additional Capabilities
AWS Made Easy - AWS EC2 - Instance Category Selection AWS Made Easy - AWS EC2 - Hardware configuration AWS Made Easy - AWS EC2 - Accelerators AWS Made Easy - AWS EC2 - Additional Capabilities .

When you provide the requirement through these four options. This tool will suggest you some of the instance type which you can use. Like for the above combination the suggestion came as.

AWS Made Easy | AWS EC2 | Instance Explorer Results

As you can see, it suggests M5d and M5dn but it did not suggest a size. If you get the category of the instance type like you have now. It is always better to start with the lowest size. Perform some testing with the on-demand instance and then decide on the size.

To reduce cost always go with the lower sized instance.

Conclusion

AWS EC2 has a great naming convention. Though this is not well document. The above naming convention comes from a few of the re-invent video and common sense. The more you look at the naming, the more confusing it looks at first. If you can separate the noise then you can observe the hidden pattern in the name of an AWS EC2 instance.

Once you have the grasp of the name.

The most important thing is to understand the four main classifications. Like, the various use of a server are.

  • Do memory heavy work
  • Do Compute heavy work
  • Do high IO work
  • Do GPU related work
  • Do generic work

The above five reasons, are the classification of the instance type. Be it Memory Optimized or Compute Optimized. Like I said you have to remove the noise to find the pattern.

Once you have the understanding of the main classification. The sub classification can come naturally. Like in Memory optimized instance, you may need

  • higher ram
  • higher optimized memory
  • finally a better CPU and memory work synchronization.

The AWS instance classification and sub classification are for a reason. Try your own understanding in finding the pattern. This will help you in remembering the details.

Finally, once you have decided on the instance. You should always choose the lower size instance to run experimentation. Based on the experimentation, decide on the actual instance size. As a rule of thumb always chose a lower instance size, it saves money.

Hope you are clear with the concept of AMI. If you want to launch an EC2 instance. Checkout, the free tier EC2 instance launch article. see Step by Step guide to create an EC2 instance.

Reference

Discussion (0)