In this article, I am going to talk about the various EC2 instance types available in AWS. EC2, abbreviated as Elastic Compute Cloud is an IaaS offering from AWS using which customers can provision virtual machines on the cloud using different combinations of CPU, RAM, disk and networking. There are many predefined instance types already available in the AWS console, which makes it extremely easy to spin up a new EC2 instance very easily.
Figure 1 – EC2 Instance Types
As you can see in the figure above, when you log in to the AWS console, navigate to EC2 and then click on Instance Types. You can see all the different types of instances that are available within AWS that you can use depending on your requirements.
Choosing an EC2 instance
When an organization starts using AWS as a cloud platform, the use of a few services like EC2, S3, Lambda, RDS becomes inevitable. This is because a large number of applications actually rely on these services to get their job done. Amazon offers a lot of instance types for EC2 that are specialized for different purposes. Initially, using EC2 might be an easy task for anyone getting started with AWS, however, as time passes and the number of users and services increase, choosing the correct EC2 type is necessary.
There are a few factors that can help you determine which instance type of EC2 is going to be perfect for your workload. You can also visit the AWS console to learn and understand the various instance types available. In this article, I am going to summarize most of the details that you would need to know in order to choose the correct instance type for an EC2. The instance types can be broadly classified into five different categories as follows.
- General Purpose
- Compute-Optimized
- Memory-Optimized
- Storage-Optimized
- Accelerated Computing
General Purpose
Whenever you start your journey with AWS and you are not sure what type of instance is perfect for your workload, you can start using the general-purpose instance type. There are basically two types of instances under this category – t2 and m5. These are just the types of instances within the category. The “t” stands for tiny and the “m” stands for micro or medium. The t2 instances are burstable instance type, which means that you can use it to run your basic applications such as websites or also use it as a development environment. When this resource is not used or just idle, you can generate CPU credit which can be used later when the resource is used. Although it is a cheaper option within the AWS EC2 family, you cannot perform tasks that need higher compute or memory with the t2 instances.
If you need compute or memory that is not supported by the t2 instance type, then you can look forward to the m5 instance type. In addition to m5, there are also other instance types in the family like the m4 or the m6.
Figure 2 – AWS EC2 General Purpose Instances
The m5 instance is also similar to that of t2, but with higher capacity and resources. From my personal experience, I can say that most of the general-purpose instances on AWS are using the m5 or m5d instance types. The difference between m5 and m5d is that the former uses an HDD and the latter uses SSD as a disk drive.
Common use case scenarios:
- Web or application servers
- Development / QA Environments
- Gaming Servers
- Enterprise Applications
Compute-Optimized
These types of instances have a higher CPU to memory ratio. When you have applications that require a lot of compute power rather than memory, then you can use these instance family for EC2. These instances are mostly available within the c4, c5 and c6 family, with c5 being the mostly used. Here, “c” is abbreviated for compute. These types of instances are usually used to run high-performance analytics workloads, multiplayer gaming, media transcoding and rendering, building complex machine learning models and scientific modelling, etc.
Figure 3 – Compute Optimized EC2
Common use case scenarios:
- Batch data processing
- Distributed Analytics platform
- Video Encoding and Production
- Multiplayer gaming
Memory-Optimized
These instance types are optimized to execute memory-intensive operations like using in-memory databases or processing real-time data using Apache Spark or Presto. You can also use these instance family to run high performant relational databases like MySQL, PostgreSQL and NoSQL databases like MongoDB and Cassandra. Also, can be used to run OLAP and other similar analytical workloads like SQL Server Analysis Services or SAP HANA. You can choose these instances from the r4 or r5 family.
Figure 4 – Memory Optimized Instance Types
Common use case scenarios:
- In-memory caches
- Big data analytics
- High performant databases
Storage-Optimized
Storage optimized EC2 instances are used to support high I/O workloads such as parallel processing or MPP data warehouse. You can also use these instances to run MapReduce or Hadoop distributed workloads. There are multiple types within the storage optimized instances like d2, d3, h1, i3, etc. You can learn more about when to use a particular instance type from the official documentation. Usually, there are two primary types of storage devices being used in the instances – HDD and SSD. When you need to use database applications that need to support high read and write rates, then the preference should be to choose SSD as they can handle writes faster as compared to HDD.
Common use case scenarios:
- Running MPP warehouses
- Executing MapReduce jobs
Accelerated Computing
This is one of the latest additions to the family of AWS EC2 instances. It provides compute capacity for very high performant machine learning and scientific workloads that cannot be accommodated within the CPU alone. These workloads can be supported by external hardware like GPU (Graphics Processing Units). These instances also leverage hardware accelerators or co-processors to perform graphics processing, run deep learning algorithms in a much more efficient and faster way than CPU alone.
One of the most used instance types in this category is the GPU instance type. This provides the customers with access to NVIDIA GPUs with more than a thousand of compute cores. You can easily use these instances for your graphics processing, gaming live streaming, etc. There are few families in this category of compute instances as follows.
- G4ad instances – In this family of compute instances, the computers use either an AMD Radeon Pro V520 or 2nd gen AMD EPYC Processors. You can leverage these for running your graphics workstation. It comes with a high performant SSD based storage.
- G4dn instances – These instances use the NVIDIA Tesla GPUs which are cost-efficient for running scientific or machine learning workloads.
Additionally, there are several other instance types used for accelerated computing, however, the above two mentioned are the most popularly used. AWS also provides a separate family of instances known as AWS Inferentia. These instances are specifically designed to support machine learning computations with a high performance and low latency based interface. You can learn more about AWS Inferentia from the official documentation.
Conclusion
In this article, we have discussed the various EC2 Instances that are available to be used within AWS. EC2 is an infrastructure as a service offered by Amazon and available across multiple regions over the world. You can deploy your applications on EC2 and these applications can be served all over the world. Amazon EC2 is spanned across multiple regions across the globe which makes it one of the most reliable and high available services from Amazon.
- Getting started with PostgreSQL on Docker - August 12, 2022
- Getting started with Spatial Data in PostgreSQL - January 13, 2022
- An overview of Power BI Incremental Refresh - December 6, 2021