Amazon EC2
Amazon Elastic Compute Cloud
Overview
Amazon EC2 lets you launch and terminate virtual servers (instances) in the cloud on demand. Instead of buying and installing physical servers, you get OS-ready compute resources in minutes, stop or terminate them when no longer needed, and pay only for what you run. Choose from a wide range of instance types varying in CPU, memory, storage, and network performance. Supports both vertical scaling (switching to a more powerful type) and horizontal scaling (adding instances), covering web/app servers, batch processing, and machine learning workloads.
Key Concepts
Instance Types and Families
Instances are grouped into families by workload: general purpose (M/T), compute optimized (C), memory optimized (R/X), storage optimized (I/D), and accelerated computing (GPU P/G). The trailing number is the generation. T-type instances use CPU credits for burst performance above a baseline — suited for variable, lightweight workloads.
Purchasing Options and Pricing
On-Demand charges by the second (minimum 1 minute) with no commitment — good for testing or short-term use. Savings Plans and Reserved Instances commit to 1–3 years for significant discounts. Spot Instances use surplus capacity at up to ~90% off but may be interrupted when AWS reclaims capacity — suitable for fault-tolerant, stateless workloads.
AMIs and User Data
An AMI (Amazon Machine Image) is a launch template including the OS and initial software, enabling reproducible instance creation. User data scripts run automatically at first boot to install packages and configure settings — the foundation for automated setup with Auto Scaling.
EBS vs Instance Store
EBS is network-attached block storage that persists independently of the instance — data survives stop/terminate and snapshots back up to S3. Instance store is physically attached to the host, fast, but ephemeral — data is lost on stop/terminate. Use EBS for persistence, instance store for scratch space.
Security Groups and Placement
Security groups are stateful virtual firewalls at the instance level — only allow rules, automatic return traffic. For high availability, spread instances across multiple AZs with ELB and Auto Scaling. Placement groups enable strategies like low-latency cluster or hardware-spread configurations.
Typical Use Cases
- Run web/app servers redundantly across multiple AZs behind a load balancer
- Use Spot Instances for large-scale batch processing or rendering at low cost
- Run GPU instances for machine learning training and inference workloads
- Lift-and-shift existing on-premises apps to virtual servers without code changes
- Build elastic infrastructure that auto-scales up and down with demand using Auto Scaling
Exam Relevance
EC2 is the foundational service tested from CLF through SAP. CLF tests pricing models (On-Demand/Reserved/Spot) and the shared responsibility model. SAA focuses on cost optimization ('use Spot for interruptible batch,' 'use Savings Plans for steady load') and high-availability design with multi-AZ. SOA covers EBS snapshot operations and instance troubleshooting. DVA tests user data scripts and IAM role-based credential delivery. Reading requirements to identify 'persistent or not,' 'interruption-tolerant or not,' 'steady or variable load' is the key scoring skill.
Related Services
References
Last updated: 2026-06-24
This page is created from AWS official documentation and reviewed/edited by the operator. See our editorial & quality policy for details.