How can you decide which EC2 instance is best for you?
Amazon EC2 (Elastic Compute Cloud) instances provide virtual computing capacity in the AWS cloud. The elasticity refers to the ability of users to scale their compute power up or down, on demand, to handle changes in requirements.
Type of instance depends on applications you are developing and running on AWS.
Step-1: Monitor following things in to your application workload:
- Optimum CPU
- Memory
- storage
- Networking
Example:
Requirement for one of application is as below:
- Optimum CPU - 8Vcpu
- Memory - 32Gib
- Storage - application is not using instance storage
- Networking - Moderate ( application is not network incentive)
Step-2: Select Instance Types:
Instances are categorized by the diverse capabilities that they provide for your workloads:
1. AWS General Purpose Instances:
General purpose instances provide a blend of compute, memory and networking resources.
Use-case: business critical applications, small and mid-sized databases, web servers and code repositories.
Instance types within this family are the following:
Example: Application is web application for business prospective Try above instances and Monitor Your cpu and memory. If Cpu Goes high above 60% Then go for type-2 instances. If memory goes high above 60% then go for type-3 instances.
2. AWS Compute Optimized Instances
Compute Optimized instances are designed for compute-intensive applications that require high performance processors.
3. AWS Memory Optimized Instances
Memory optimized instances are designed to deliver fast performance for workloads that process large data sets in memory.
4. AWS Storage Optimized Instances
Storage optimized instances are designed for workloads that require high, sequential read and write access to very large data sets on local storage.
5. AWS Accelerated Computing Instances
Accelerated computing instances use co-processors to perform functions, such as floating point number calculations, graphics processing, or data pattern matching, more efficiently than is possible in software running on CPUs.
Step-3: Compare instances price and Performance
Example: As our application is web based and requires 8Vcpu 32Gib Following General purpose instances are available.
Make the following type of table as per your requirement. Information is available on aws console for all instances in instance type.
Step-4: Change the type as per above table and monitor your application performance and select best for your application.
Following are my application work on different instances.
There is no major impact of performance for application on all above instance so we can choose according to price for above instance.
Top comments (2)
Agree on your post that the instance size depends on the kind of workload you are running. This applies especially when choosing instance families (t-family vs m-family, etc). But when choosing between t2 and t3, or m4 or m5, I think it's a matter of cost-effectiveness. If you choose m5, its list price is cheaper than m4, but the spot price might be cheaper for m4
Awesome Article for Choosing the Right Amazon EC2 Instance Type.