Topic lessonTopic: EC2: launch and operation
How to choose an EC2 instance type: CPU, memory and workload requirements
An EC2 instance type combines compute, memory, storage and networking capabilities. Filter for what the application can use, then test representative load; a name or hourly price is not enough. Learn a selection process: compatibility → resource requirements → sustained behavior → complete cost.
Build a shortlist and evaluation plan that accounts for architecture, CPU credits and I/O constraints.
Know the roles of an EC2 instance, AMI and EBS. Example numbers are fictional requirements, not measured performance or a recommendation for a particular type.
Separate the requirements before choosing a name
- Compatibility → ResourcesStart from compatible configurations.
- Resources → Sustained loadInclude peaks and their duration, not just averages.
- Sustained load → Test and costEvaluate suitable candidates with the same workload.
- Compatibility
- Match OS, AMI, architecture and software.
- Resources
- Specify CPU, memory, storage and network needs.
- Sustained load
- Check peak duration, credits and I/O limits.
- Test and cost
- Compare runtime, failures and complete costs.
A family describes a resource profile; a size specifies a configuration within it. Equal vCPU counts do not imply identical processors, memory, networking or EBS limits. Do not treat a vCPU count as a measured application speed.
Use the name as a clue, then inspect the specifications
| Part | Meaning |
|---|---|
| m | General-purpose series; inspect its resource balance |
| 7 | Generation within the series |
| g | AWS Graviton processor option; check Arm compatibility |
| large | Size within this family; look up actual vCPU, GiB and other specifications |
| Series | Why investigate it | Do not overlook |
|---|---|---|
| M: general purpose | A starting point for balanced resource needs | General purpose does not mean optimal for every workload |
| C: compute optimized | CPU-intensive processing | Required memory and usable parallelism |
| R: memory optimized | Larger in-memory working sets | Bottlenecks other than memory |
| T: burstable | Lower baseline use with temporary CPU peaks | Credits and costs under sustained demand |
Record both average and peak requirements
| Dimension | What to establish | Pitfall |
|---|---|---|
| CPU | Runtime, usable parallelism and peak duration | Assuming twice the vCPUs means twice the speed |
| Memory | Peak working set, concurrency and headroom | Choosing from averages and exhausting memory at peaks |
| Storage I/O | IOPS, throughput, latency and retention | Assuming faster EBS alone fixes total performance |
| Networking | Transfer volume, destinations, latency and sustained bandwidth | Reading a maximum as a constant guarantee |
| Availability | Region/AZ, OS and offered types | Treating an offering as a guarantee of immediate launch capacity |
EBS performance is constrained by both the volumes and the instance. A faster volume cannot overcome an instance-side limit. IOPS counts I/O operations per second; throughput measures transferred data over time. Include I/O size when comparing them.
Choose an option to see the result and explanation.
For burstable types, review credits and sustained demand
CPU credits govern CPU use on burstable types. Credits accrue when use is below the baseline and are consumed above it. A short peak test is insufficient to establish sustained performance.
| Mode | Concept | Evaluation check |
|---|---|---|
| Standard | After accrued credits are exhausted, CPU use gradually returns to baseline | Runtime and credit balance after a sustained peak |
| Unlimited | Surplus credits can sustain use above baseline, with conditional additional charges | Sustained use, surplus credits and billing conditions |
Worked example: do not solve a memory requirement with CPU alone
| Candidate | Given facts | Decision in this exercise |
|---|---|---|
| A | x86_64, 4 GiB memory; the app requires at least 8 GiB | Reject: insufficient memory |
| B | Arm, 16 GiB; a required library supports x86_64 only | Reject under the current compatibility requirement |
| C | x86_64, 16 GiB; other performance is unmeasured | Keep for evaluation; optimality remains unproven |
Choose an option to see the result and explanation.
Compare the same workload and the complete configuration cost
- Define the workload, data volume, concurrency and completion-time criterion.
- Compare candidates with consistent AMI, app and storage conditions; record what changes.
- Inspect runtime, errors, peak memory, credits and I/O across representative duration.
- Include EBS, IPv4, transfer and necessary surrounding services, not just EC2.
- Record established criteria and unknowns, then clean up test resources.
A smaller type may have a lower hourly rate yet take longer to complete the same work. Compare Region, OS, purchasing option, added resources and CPU-credit conditions consistently. This lesson does not guarantee a price or price/performance ratio for any type.
Check, then explain in your own words
- Explain how compatibility and minimum resources exclude candidates.
- Identify average/peak duration and constraints beyond CPU.
- Compare completion criteria and complete configuration costs.
Check your understanding: Can an instance-type name prove the best configuration for your app?
No. The name helps find candidates; requirements, specifications and workload evaluation determine suitability.
Check compatibility and resources first, then sustained behavior, I/O and costs. Neither vCPU count nor hourly price is sufficient.
Sources and conditions checked
The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.
- Amazon EC2 instance typesChecked:
Scope and conditionsResource profiles, processors and AMI compatibility; equal vCPUs do not establish application throughput.
Used in this lessonSeparate the requirements before choosing a name Use the name as a clue, then inspect the specifications
Scope and conditionsSeries, generation, processor/options and size. m7g.large is a naming example, not a recommended or best-priced type.
Used in this lessonUse the name as a clue, then inspect the specifications
Scope and conditionsBaseline, accrual/consumption and Standard versus Unlimited. No invented credit balance or live performance measurement.
Used in this lessonUse the name as a clue, then inspect the specifications For burstable types, review credits and sustained demand
Scope and conditionsSurplus-credit charges under sustained utilization, with type/configuration-specific conditions; no blanket free CPU claim.
Used in this lessonFor burstable types, review credits and sustained demand Compare the same workload and the complete configuration cost
Scope and conditionsEBS I/O limited by both aggregate volumes and instance-side limits; IOPS and throughput depend on I/O size and configuration.
Used in this lessonRecord both average and peak requirements
- Find an Amazon EC2 instance typeChecked:
Scope and conditionsFilter by requirements and Region/AZ offerings, then benchmark the actual app; an offering is not an immediate capacity guarantee.
Used in this lessonLesson overview and review
Scope and conditionsParameter meanings including architecture compatibility, source-specific SSH rules, storage and launch count. Tutorial choices are limited to a disposable Linux exercise.
Used in this lessonUse the name as a clue, then inspect the specifications
- Amazon EC2 On-Demand pricingChecked:
Scope and conditionsCompute assumptions, OS-specific billing granularity, data transfer and additional resource charges; no unit rates embedded.
Used in this lessonCompare the same workload and the complete configuration cost
- Amazon EBS pricingChecked:
Scope and conditionsProvisioned capacity, additional performance and snapshots; no unit rate or price quote is embedded.
Used in this lessonCompare the same workload and the complete configuration cost
- Amazon VPC pricingChecked:
Scope and conditionsPublic IPv4 and NAT gateway pricing dimensions, including retained/idle addresses; no unit-rate quote.
Used in this lessonCompare the same workload and the complete configuration cost