How to Choose Amazon EC2 Instances - Optimizing Instance Families and Purchase Options

Understand the characteristics of instance families and the performance advantages of Graviton processors, along with guidelines for choosing between On-Demand, Reserved, and Spot purchase options.

Overview of EC2

EC2 is a compute service that provides virtual servers in the cloud. Choose from hundreds of instance types based on your use case and launch servers in minutes. While Lambda is an event-driven serverless compute service, EC2 is suited for workloads that require OS-level control. Graviton processor-powered instances deliver up to 40% better cost-performance.

Instance Families and Purchase Options

The M family (general purpose) is suited for web servers and application servers, the C family (compute optimized) for batch processing and scientific computing, and the R family (memory optimized) for in-memory caches and databases. Graviton processors are AWS-designed Arm-based CPUs that deliver up to 40% better cost-performance compared to equivalent x86 instances. Spot Instances use EC2 spare capacity at up to 90% discount, with a 2-minute interruption notice to safely execute shutdown procedures.

Graviton Instances and Latest Generation Selection

AWS Graviton processor-powered instances (C7g, M7g, R7g) deliver up to 40% better cost-performance compared to equivalent x86 instances. Major runtimes including Java, Python, and Node.js support Arm64, making migration possible for many workloads. For container workloads, building multi-architecture images enables execution on both x86 and Graviton. Latest generation instances (7th generation) offer improved network bandwidth and EBS throughput over previous generations, and in some cases can meet the same performance requirements with a smaller instance size. Select compute optimized (C family), memory optimized (R family), or general purpose (M family) based on your workload characteristics. For detailed guidance on instance selection, related books on Amazon are also a useful reference.

Purchase Options and Cost Optimization

EC2 offers four purchase options: On-Demand, Reserved Instances (RI), Savings Plans, and Spot Instances. Compute Savings Plans apply across EC2, Fargate, and Lambda, and flexibly accommodate changes in instance family or region. A 1-year or 3-year commitment provides discounts of up to 66%. Spot Instances offer up to 90% discount but require designs that handle the 2-minute interruption notice. RIs are locked to a specific instance family and region, making them suitable for long-term stable workloads. Use Cost Explorer recommendations to identify the optimal combination of purchase options based on your current usage patterns.

Summary

EC2 builds optimal computing environments through combinations of instance families, sizes, and purchase options. Improve cost-performance with Graviton instances, and optimize costs while meeting performance requirements by combining Savings Plans with Spot Instances.