Amazon EC2

Amazon Elastic Compute Cloud — scalable virtual server infrastructure for running applications in the AWS cloud.
Compute. Last reviewed September 2026.
In this entry

5gotchas
5tips
7sections
Definition
Amazon Elastic Compute Cloud (EC2) is AWS’s foundational virtual server service. You launch instances — VMs with configurable CPU, memory, networking, and storage — inside a VPC, attach EBS volumes or instance store, and pay by the second for On-Demand or commit for Savings Plans and Reserved Instances. EC2 remains the default when you need full OS control, long-running processes, licensed software, or hardware profiles (GPU, local NVMe, bare metal) that serverless and container services cannot expose cleanly.
Instance choice drives both performance and bill. As of mid-2026, Graviton4 families (M8g, C8g, R8g) and Graviton5 (M9g GA June 10; C9g/C9gd GA June 30) deliver strong price-performance on ARM64 Linux; m7g/c7g/r7g remain common in existing fleets. Match family to workload: general purpose (M/T), compute (C), memory (R/X), storage (I/D), and accelerated (P/G/Trn) for ML and graphics.
| Family | Optimized for | Examples (2026) |
|---|---|---|
| General purpose (M, T) | Balanced CPU/memory | m9g.xlarge, m8g.xlarge, m7g.large, t4g.micro |
| Compute optimized (C) | CPU-bound workloads | c9g.4xlarge, c8g.4xlarge, c7g.2xlarge |
| Memory optimized (R, X) | In-memory DBs, caches | r7g.4xlarge, r8g.8xlarge |
| Storage optimized (I, D) | High IOPS, local NVMe | i4i.xlarge, i8g.2xlarge |
| Accelerated (P, G, Trn) | ML training/inference, GPU | p5.48xlarge, g6.xlarge, trn2.48xlarge |
When to use it
- You need a persistent VM with SSH/RDP access, custom kernel modules, or vendor software tied to sockets/cores.
- Workloads run 24/7 with predictable baseline CPU — Savings Plans or RIs on M/R families usually beat Lambda or Fargate on unit economics.
- You require specialized hardware: GPU inference, Trn for training, high local NVMe for databases, or Dedicated Hosts for license compliance.
- Auto Scaling groups behind an ALB/NLB for stateless web tiers, batch queues on Spot, or CI runners that tolerate interruption.
When not to use it
- Event-driven, spiky, or sub-15-minute jobs — Lambda or Fargate remove patching and capacity planning. Async jobs up to 90 minutes can stay on Lambda Managed Instances as of 9 Sep 2026.
- You only need containers and accept Kubernetes ops — EKS with Karpenter or Auto Mode may be simpler than hand-managing ASGs.
- Minimal traffic dev/test boxes left running overnight — idle On-Demand instances are the most common FinOps leak on new AWS accounts.
Tips
- Benchmark Graviton (m9g/c9g, or m8g/c8g where RI-locked) before defaulting to x86; most Java, Python, Node.js, Go, and .NET on Linux builds run ARM64 with 20–40% better $/perf on equivalent sizes. Use M9g for balanced fleets and C9g for CPU-bound work in GA Regions.
- Use Compute Optimizer plus two weeks of CloudWatch
CPUUtilization,NetworkIn/Out, and EBSVolumeRead/WriteOpsbefore right-sizing; one size down on memory often saves more than CPU tweaks. - Split baseline vs burst: cover steady On-Demand hours with Compute Savings Plans; put fault-tolerant batch/CI on Spot with diversified instance pools and
capacity-optimizedallocation. - Enable IMDSv2 required on launch templates and use instance profiles — never bake long-lived access keys into AMIs.
- Pair production ASGs with ELB health checks and a minimum healthy percentage during deployments; replace in-place SSH deploys with golden AMIs or container pulls.
Gotchas
- Serious: A single oversized On-Demand instance in the wrong AZ without Multi-AZ failover becomes a silent single point of failure — combine ASG across ≥2 AZs and test failover before calling the tier “HA.”
- Serious: T-class CPU credits exhaust under sustained load; production on
db.t*analogs ort3/t4gwithout unlimited mode throttles hard with no obvious CloudWatch alarm unless you watchCPUCreditBalance. - Regular: EBS gp3 defaults to 3,000 IOPS — heavy databases on gp3 without provisioned IOPS look “slow” while CPU graphs stay green.
- Regular: Elastic IP attached to a stopped instance still bills — release or reassign idle EIPs during cost reviews.
- Regular: Changing instance type often requires stop/start (not reboot) to pick up new network or ENA limits; schedule maintenance windows accordingly.
Official references
- EC2 Auto Scaling — target tracking and predictive scaling patterns.
- Graviton best practices — porting and benchmark checklist for ARM64.
Related FactualMinds content
- Cloud Cost Optimization Services
- FinOps Consulting
- AWS Well-Architected Review Checklist
- AWS Serverless Services — when EC2 is not the right fit
Ask
Our AWS-certified team implements, audits and tunes Amazon EC2 in production. Tell us what you are building.
Pictures:James Murray in the Scriptorium (public domain); Card Division of the Library of Congress, 1900–1920 (public domain); Salle des catalogues, Bibliothèque Mazarine, Paris, Marie-Lan Nguyen (CC BY 2.0); Copyright card catalog drawer, Michael Holley Swtpc6800 (public domain); Type in sort case, Edinburgh City of Print (CC BY 2.0); Widener Library reading room, 1920 (public domain). Via Wikimedia Commons.

