AMI (Amazon Machine Image)
| Property | Detail |
|---|---|
| Contains | Root volume template (OS + software), launch permissions, block device mappings |
| Sources | Quick Start (AWS) / My AMIs (self-created) / AWS Marketplace (3rd-party) / Community AMIs (use at own risk) |
| Selection criteria | Region, OS, root device type, architecture, virtualization type (HVM recommended) |
| Creation flow | Existing AMI → launch instance → connect & modify → capture as new AMI → (optional) copy to other Regions |
| EC2 Image Builder | Automates golden-image creation/maintenance/versioning via pipeline |
| AMI Deployment Model | Description |
|---|---|
| Basic | OS-only, fully configurable, slower boot |
| Silver | Half-baked, some manual/user-data config |
| Golden | Fully baked/immutable, fast boot, shorter lifespan |
EBS-backed vs Instance Store-backed
| Characteristic | EBS-backed | Instance Store-backed |
|---|---|---|
| Boot time | Faster | Slower |
| Max root size | 16 TiB | 10 GiB |
| Can stop | Yes | No (running/terminated only) |
| Change instance type | Yes (stop first) | No |
| Use case | Persistent storage | Temporary storage |
Instance Types — naming = Family + Generation + (processor/extra features) + Size, e.g. t3.large, c7gn.xlarge.
| Category | Use Case | Families |
|---|---|---|
| General purpose | Web/app servers, dev/test, balanced workloads | a1, m4/m5/m6/m7, t2/t3/t4g, Mac |
| Compute optimized | HPC, batch, distributed analytics | c4, c5, c6, c7 |
| Memory optimized | In-memory DBs, big data caches | r4/r5/r6/r7, x1/x2, z1 |
| Storage optimized | Distributed file systems, high-perf/transactional DBs | d2/d3, h1, i3/i4/im4/is4 |
| Accelerated computing | ML/AI, GPU, HPC | f1, g3/g4/g5, p2/p3/p4/p5, dl1, trn1, inf1/inf2, vt1 |
| HPC optimized | Deep learning, compute-intensive HPC | hpc6, hpc7 |
t3 family sizing example: nano(2vCPU/0.5GB) → micro(2/1) → small(2/2) → medium(2/4) → large(2/8) → xlarge(4/16) → 2xlarge(8/32) — all EBS-only storage.
Instance selection tools: EC2 console Instance Types page filters (new workloads); AWS Compute Optimizer (existing — flags Under-provisioned/Over-provisioned/Optimized).
EC2 lifecycle:
AMI → pending → running ⇄ rebooting
running → stopping → stopped → (start) → pending
running/stopped → shutting-down → terminated
Note: only EBS-backed instances can stop/restart.
Other EC2 details
| Feature | Detail |
|---|---|
| Instance Hibernation | Saves RAM to EBS root volume; needs supported Linux AMI, encrypted root volume, ≤150 GB RAM, enabled at launch |
| Elastic IP | Static public IPv4, persists across stop/start, remappable, billed if unattached |
| Instance metadata | http://169.254.169.254/latest/meta-data/ (and /latest/user-data/) — instance ID, IPs, hostname, security groups, Region/AZ |
| User data script | Runs on first boot; customizes runtime; reduces need for many custom AMIs |
| Updating user data on a running instance | Stop instance → edit script → remove config_scripts_user file → restart/re-run |
| Placement groups | Cluster / Partition / Spread strategies; one group per instance; increases network performance or reduces correlated-failure risk |
| EBS-optimized instances | Dedicated network path to EBS; default on most current types |
CloudWatch monitoring for EC2