Amazon EBS
LearningTree ยท AWS ยท Storage

Amazon EBS โ€”
Elastic Block Store

Persistent block storage for EC2 instances. Like a virtual hard drive that persists independently of the instance lifecycle โ€” attach, detach, snapshot, and resize on demand.

โšก EBS in 30 Seconds

  • Block storage โ€” raw disk that an OS reads/writes as a filesystem (like a physical hard drive)
  • Attached to one EC2 instance at a time (with multi-attach exceptions for io1/io2)
  • AZ-locked โ€” an EBS volume exists in ONE Availability Zone (cannot cross AZs directly)
  • Persistent โ€” data survives instance stop/restart. Independent lifecycle from EC2.
  • Snapshot to S3 for backup, cross-region copy, or creating new volumes in different AZs
  • Volume types: gp3 (default), io2 (high IOPS), st1 (throughput), sc1 (cold archive)
01
Chapter One

What is EBS

What is Block Storage? Introductory

Storage in the cloud comes in three fundamental forms. Each serves different access patterns:

๐Ÿงฑ

Block Storage (EBS)

Data divided into fixed-size blocks. The OS treats it as a raw disk โ€” formats it with a filesystem (ext4, NTFS) and mounts it. Lowest latency, highest IOPS.

Use: databases, boot drives, apps needing disk I/O

๐Ÿ“ฆ

Object Storage (S3)

Stores files as objects with metadata + unique key. No filesystem hierarchy โ€” flat namespace. Access via HTTP API. Unlimited capacity, highly durable.

Use: backups, media, data lakes, static hosting

๐Ÿ“‚

File Storage (EFS)

Shared filesystem (NFS). Multiple instances can mount simultaneously. Elastic capacity โ€” grows/shrinks automatically. Multi-AZ.

Use: shared config, CMS, containers needing shared state

๐Ÿ‘‰ Key distinction: EBS = personal hard drive (one instance, one AZ, high performance). S3 = infinite filing cabinet (any service, any region, HTTP access). EFS = shared network drive (many instances, many AZs, NFS protocol).

Why EBS Exists Introductory

When you launch an EC2 instance, it needs a disk to boot from and store data. But EC2 instances are ephemeral โ€” their local storage (instance store) disappears when the instance stops. EBS solves this by providing a persistent, network-attached disk that survives instance stops, restarts, and even termination (if configured).

๐Ÿ’จ

Without EBS (Instance Store)

  • Storage is physically on the host machine
  • Data lost if instance stops or terminates
  • Cannot detach or reattach
  • Cannot snapshot
  • Size fixed at launch

Like a whiteboard โ€” data exists only while you're standing there.

๐Ÿ’พ

With EBS

  • Network-attached persistent storage
  • Data survives stop/restart/terminate (configurable)
  • Can detach from one instance and attach to another
  • Can snapshot to S3 for backup
  • Can resize without downtime

Like an external hard drive โ€” unplug it, plug it into another machine, data is still there.

Mental Model โ€” The External Hard Drive Introductory

Think of EBS like a USB external hard drive for your cloud server:

๐Ÿ”Œ

Attach/Detach

Plug it into one computer at a time. Unplug and move to another. The data stays on the drive.

๐Ÿ“ธ

Snapshot

Like cloning the entire drive to a backup. You can create a new drive from that backup anywhere.

๐Ÿข

AZ = Building

The drive exists in ONE building (AZ). To move it to another building, you must snapshot it first, then restore in the new location.

๐Ÿ‘‰ Critical rule: An EBS volume lives in exactly one AZ. An EC2 instance in us-east-1a cannot attach a volume in us-east-1b. To move data across AZs, you must snapshot โ†’ create new volume in target AZ. This is the #1 EBS architectural constraint.

๐Ÿณ Container note: EBS is not supported on Fargate (ECS Fargate has ephemeral storage + EFS only). For ECS on EC2, you can mount EBS volumes via task definition volume mappings. For Kubernetes (EKS), use the EBS CSI driver to dynamically provision EBS volumes as PersistentVolumes.

EBS vs S3 vs EFS โ€” Comparison Core
FeatureEBSS3EFS
Storage typeBlockObjectFile (NFS)
AccessOne EC2 (mostly)Any service, HTTP APIMany EC2 simultaneously
ScopeSingle AZRegional (cross-AZ)Regional (Multi-AZ)
PersistenceIndependent of EC2Always persistentAlways persistent
CapacityProvisioned (1GBโ€“64TB)UnlimitedElastic (auto-grows)
PerformanceHighest IOPS (up to 256K)High throughput, high latencyGood throughput, moderate IOPS
LatencySub-millisecondMilliseconds (HTTP)Low milliseconds (NFS)
Best forDatabases, boot volumes, appsBackups, media, data lakesShared files, CMS, containers
PricingPer GB provisioned + IOPSPer GB stored + requestsPer GB stored
Concept Diagram โ€” Storage Types Compared Introductory
Block vs Object vs File Storage โ€” Access Patterns
BLOCK (EBS) Block Block Block Block 1 instance ยท 1 AZ Sub-ms latency Databases ยท Boot /dev/xvda OBJECT (S3) img.jpg data.csv ... Any service ยท Regional HTTP API access Backups ยท Media ยท Lakes s3://bucket/key FILE (EFS) ๐Ÿ“ /shared/ โ”œโ”€โ”€ config.yml โ”œโ”€โ”€ uploads/ โ””โ”€โ”€ logs/ Many instances ยท Multi-AZ nfs://efs-id/ EBS = 1 instance, 1 AZ, lowest latency ยท S3 = unlimited, HTTP ยท EFS = shared, multi-AZ, NFS
AWS Diagram โ€” EBS Attached to EC2 Core
EBS Volume โ€” Attached to EC2 Instance (Same AZ)
๐Ÿข Availability Zone us-east-1a
EC2
EC2 Instance
i-0abc123
โŸต network โŸถ
EBS
EBS Volume
/dev/xvda ยท 100GB gp3
EBS
EBS Volume
unattached (same AZ)
โŒ
Different AZ
cannot attach cross-AZ

EBS volume MUST be in the same AZ as the EC2 instance. Network-attached via AWS internal fabric.

Architecture Diagram โ€” EBS in a Real Application Core
Web App with Database on EBS โ€” Multi-AZ Architecture
๐ŸŒ Users Application Load Balancer VPC AZ us-east-1a EC2 (Web) Node.js API EC2 (Database) PostgreSQL EBS io2 500GB ยท 10K IOPS AZ us-east-1b EC2 (Web) Node.js API EC2 (Standby DB) Replica EBS io2 500GB (from snapshot) snapshot โ†’ restore in AZ-b EBS volumes are AZ-locked. To replicate across AZs: snapshot from AZ-a โ†’ restore new volume in AZ-b.
๐ŸŽฏ Chapter 01 Summary

EBS = persistent block storage, attached to one EC2, locked to one AZ.

  • Block storage โ€” OS formats and mounts it as a filesystem. Lowest latency of all AWS storage types.
  • Persistent โ€” data survives instance stop/restart. Lifecycle independent of EC2 (configurable).
  • AZ-locked โ€” volume lives in ONE AZ. Cannot cross AZs directly. Use snapshots to move data.
  • Network-attached โ€” physically separate from EC2 hardware (unlike instance store). Small network hop.
  • Mental model: External hard drive. Plug into one computer. Snapshot = clone. Different building = must clone first.
  • vs S3: EBS = disk for one instance. S3 = infinite storage for any service. Different tools for different jobs.
02
Chapter Two

Core Concepts

What is an EBS Volume? Introductory

An EBS volume is a durable, block-level storage device that you attach to a single EC2 instance. Once attached, the OS sees it as a raw disk device (e.g., /dev/xvdf). You format it with a filesystem, mount it, and read/write to it like any local drive โ€” except the data persists even if the instance is stopped or terminated.

๐Ÿ“‹

Volume Properties

  • Size: 1 GiB โ€“ 64 TiB (depends on type)
  • Type: gp3, io2, st1, sc1 (determines performance)
  • AZ: Fixed at creation time (cannot move)
  • State: available (unattached) or in-use (attached)
  • Encryption: optional, uses KMS
  • Device name: /dev/xvda (root), /dev/xvdf+ (additional)
โšก

Key Behaviors

  • Can resize while attached (no downtime โ€” elastic resize)
  • Can change type while attached (gp2 โ†’ gp3, etc.)
  • Can increase IOPS/throughput without detaching
  • Can attach multiple volumes to one instance
  • Instance sees volumes as separate block devices
  • Billed even when unattached (you own the capacity)
Root Volume vs Additional Volumes Core

Every EC2 instance has at least one EBS volume โ€” the root volume. You can attach more as additional volumes. They behave differently:

FeatureRoot Volume (/dev/xvda)Additional Volumes (/dev/xvdf+)
ContainsOperating system (boot partition)Application data, databases, logs
CreatedAutomatically with instance launchManually created and attached
Delete on TerminationYES by default (โš ๏ธ data lost!)NO by default (data preserved)
Detachable?Only after stopping instanceYes, while instance is running
Typical size8โ€“30 GiB (OS only)10 GiB โ€“ 16 TiB (app-dependent)
EncryptionOptional (set at launch)Optional (set at creation)

๐Ÿšจ Critical Warning โ€” Delete on Termination: The root volume is deleted by default when you terminate an instance. If you stored important data on the root volume and terminate the instance โ€” that data is gone permanently (unless you have a snapshot). Always set DeleteOnTermination: false for root volumes with important data, or better โ€” store application data on separate additional volumes.

Attach, Detach, and Reattach Core
๐Ÿ”Œ

Attach

  • Volume must be in same AZ as instance
  • Volume must be in available state
  • Specify device name (/dev/xvdf)
  • One volume โ†’ one instance (usually)
  • After attach: format + mount in OS
๐Ÿ”“

Detach

  • Unmount first in the OS (avoid corruption)
  • Additional volumes: detach while running
  • Root volume: must stop instance first
  • After detach: volume returns to "available"
  • Data is preserved on the volume
๐Ÿ”„

Reattach

  • Attach to a different instance (same AZ)
  • Common for: maintenance, upgrading instances
  • Data is intact โ€” just mount again
  • Like unplugging USB and plugging elsewhere
  • โš ๏ธ Cannot attach to instance in different AZ
Volume Persistence & Lifecycle Core

EBS volumes have an independent lifecycle from EC2 instances. Understanding this prevents data loss:

Instance EventRoot Volume (default)Additional Volumes (default)
Instance Stopโœ… Data preservedโœ… Data preserved
Instance Restartโœ… Data preservedโœ… Data preserved
Instance Terminateโš ๏ธ DELETED (default!)โœ… Data preserved (stays available)
Instance Hibernateโœ… RAM dumped to root EBSโœ… Data preserved

๐Ÿ‘‰ Best practice: Never store important application data on the root volume. Use separate EBS volumes for databases, user uploads, and application state. This way, even if you terminate the instance accidentally, your data survives.

EBS Resize Rules Core
๐Ÿ“

What You CAN Do

  • Increase size while attached (no detach needed)
  • Change volume type (gp2 โ†’ gp3, gp3 โ†’ io2, etc.)
  • Increase IOPS/throughput (for gp3, io2)
  • Resize completes in background (may take hours for large volumes)
  • After resize: extend filesystem in OS (xfs_growfs, resize2fs)
๐Ÿšซ

What You CANNOT Do

  • Cannot decrease size โ€” ever (must create smaller volume from snapshot)
  • Cannot resize more than once per 6 hours (cooldown period)
  • Must wait for "optimizing" state to complete before next modification
  • Filesystem extension is not automatic โ€” you must run OS commands
EBS Deletion Protection Core

Beyond the "Delete on Termination" flag, you can protect volumes from accidental deletion using IAM policies and tagging strategies:

๐Ÿ‘‰ Protection strategies: โ‘  Set DeleteOnTermination: false for all critical volumes. โ‘ก Use IAM policies with ec2:DeleteVolume conditions to restrict deletion to specific roles. โ‘ข Tag critical volumes (Protected=true) and use tag-based IAM conditions. โ‘ฃ Enable AWS Backup Vault Lock for immutable backups that cannot be deleted even by root.

Multi-Attach (io1/io2 Only) Deep

Normally: 1 volume = 1 instance. But io1/io2 volumes support Multi-Attach โ€” up to 16 instances can read/write the same volume simultaneously. This is used for clustered applications that need shared block-level storage.

โœ…

Multi-Attach Requirements

  • Only io1 and io2 volume types
  • All instances must be in same AZ
  • Maximum 16 instances simultaneously
  • Must use cluster-aware filesystem (not ext4!)
  • Application must manage concurrent access
โš ๏ธ

Multi-Attach Limitations

  • NOT available for gp3, st1, sc1
  • Does NOT work across AZs
  • Requires application-level concurrency control
  • Cannot use standard filesystems (ext4, XFS)
  • Windows: requires WSFC (Failover Cluster) โ€” NTFS cannot handle concurrent writes
  • Complex โ€” most apps should use EFS instead
Concept Diagram โ€” Volume Lifecycle States Introductory
EBS Volume โ€” State Machine
Creating Available unattached attach In-Use attached to EC2 detach delete Deleted snapshot (while in-use โœ“) Creating โ†’ Available (unattached, billable) โ†’ In-Use (attached to EC2) โ†’ Available (detach) โ†’ Deleted Snapshots can be taken while volume is in-use (no need to detach)
AWS Diagram โ€” EC2 with Multiple EBS Volumes Core
Single EC2 Instance โ€” Root + Additional Volumes
๐Ÿข Availability Zone us-east-1a
EC2
EC2 Instance
t3.large ยท Linux
EBS Root
Root Volume
/dev/xvda ยท 20GB gp3
โš ๏ธ Delete on Term: YES
EBS App
App Data
/dev/xvdf ยท 200GB gp3
โœ“ Delete on Term: NO
EBS DB
Database
/dev/xvdg ยท 500GB io2
โœ“ Delete on Term: NO

Best practice: separate root (OS) from data. Root can be deleted on terminate โ€” data volumes persist independently.

Architecture Diagram โ€” Detach & Reattach Pattern Core
Maintenance Pattern โ€” Detach Volume, Attach to New Instance
OLD EC2 (terminate) t3.small EBS 200GB data โ‘  detach EBS Volume State: available Data intact โœ“ โ‘ก attach NEW EC2 (upgraded) t3.xlarge EBS (same) 200GB data โœ“ Common pattern: Terminate old instance โ†’ EBS volume becomes "available" โ†’ Attach to new instance โ†’ Mount โ†’ Data is there โš ๏ธ Both instances must be in the SAME Availability Zone
๐ŸŽฏ Chapter 02 Summary

EBS volumes have independent lifecycles โ€” create, attach, detach, reattach, snapshot, delete.

  • Root volume = OS disk. Deleted on terminate by default (โš ๏ธ). Always separate data to additional volumes.
  • Additional volumes = data disks. Preserved on terminate by default. Can be detached/reattached freely.
  • Lifecycle: Creating โ†’ Available (unattached) โ†’ In-Use (attached) โ†’ Available (detach) โ†’ Deleted
  • Resize: You can increase size, change type, and adjust IOPS/throughput while the volume is attached (no downtime).
  • Multi-Attach: io1/io2 only. Up to 16 instances can share one volume. Requires cluster-aware filesystem.
  • Billing: You pay for provisioned capacity even when unattached. Delete unused volumes to save costs.
03
Chapter Three

Volume Types

EBS Volume Type Categories Introductory

EBS offers four volume types in two categories. The choice depends on your workload's I/O pattern โ€” whether it needs fast random reads (IOPS) or fast sequential reads (throughput):

โšก

SSD-Backed (Random I/O)

Optimized for small, random reads/writes (IOPS). Think database queries, boot volumes, app servers.

  • gp3 / gp2 โ€” General purpose (default)
  • io2 / io1 โ€” Provisioned IOPS (highest performance)
๐Ÿ“Š

HDD-Backed (Sequential I/O)

Optimized for large, sequential reads/writes (throughput). Think log processing, big data, streaming.

  • st1 โ€” Throughput Optimized (frequent access)
  • sc1 โ€” Cold HDD (infrequent access, cheapest)

๐Ÿ‘‰ Rule of thumb: SSD types can be boot volumes. HDD types cannot be boot volumes. If the question asks about a boot volume โ€” the answer is always gp3/gp2 or io2/io1, never st1/sc1.

Volume Types โ€” Full Comparison Core
Featuregp3io2 Block Expressst1sc1
CategoryGeneral Purpose SSDProvisioned IOPS SSDThroughput HDDCold HDD
Max Size16 TiB64 TiB16 TiB16 TiB
Max IOPS16,000256,000500250
Max Throughput1,000 MB/s4,000 MB/s500 MB/s250 MB/s
Baseline IOPS3,000 (included free)You provision (100โ€“256K)N/A (throughput-based)N/A (throughput-based)
Boot volume?โœ… Yesโœ… YesโŒ NoโŒ No
Multi-Attach?โŒ Noโœ… Yes (up to 16)โŒ NoโŒ No
Pricing$0.08/GB-month$0.125/GB + $0.065/IOPS$0.045/GB-month$0.015/GB-month
Best forMost workloads (default)Databases needing guaranteed I/OBig data, log processingArchive, infrequent access
gp3 โ€” The Default Choice Core

gp3 is the recommended default for most workloads. It replaced gp2 as the go-to volume type because it offers better baseline performance at 20% lower cost, and lets you independently tune IOPS and throughput.

โœ…

gp3 Advantages

  • 3,000 IOPS baseline โ€” included free regardless of size
  • 125 MB/s throughput โ€” included free baseline
  • Independent IOPS scaling: up to 16,000 (pay extra)
  • Independent throughput: up to 1,000 MB/s (pay extra)
  • 20% cheaper per GB than gp2
  • No burst credits โ€” consistent performance
๐Ÿ“Š

gp3 vs gp2

  • gp2: IOPS scales with size (3 IOPS/GB)
  • gp3: IOPS independent of size (3K baseline free)
  • gp2: uses burst credits (unpredictable)
  • gp3: no burst model (consistent)
  • gp2: $0.10/GB ยท gp3: $0.08/GB
  • Verdict: Always use gp3 for new volumes

gp2 burst credits: gp2 earns credits when idle, can burst to 3K IOPS temporarily. Baseline = size ร— 3 (e.g., 100GB = 300 IOPS). Credits exhaust โ†’ throttled. gp3 eliminates this entirely โ€” 3K IOPS always, no credits.

io2 / io2 Block Express โ€” Maximum Performance Deep

When your workload needs guaranteed, consistent IOPS (databases like Oracle, SAP, or Cassandra that are IOPS-sensitive), io2 is the answer. You explicitly provision the IOPS you need โ€” and AWS guarantees delivery.

๐ŸŽ๏ธ

io2 Key Features

  • Up to 256,000 IOPS (Block Express on Nitro)
  • Up to 4,000 MB/s throughput
  • 99.999% durability (5 nines โ€” vs 99.8-99.9% for others)
  • Multi-Attach supported (clustered databases)
  • Provisioned IOPS โ†’ you know exactly what you get
  • IOPS:GB ratio up to 1000:1 (500:1 for io1)
๐Ÿ’ฐ

Cost Warning

  • Most expensive EBS type
  • $0.125/GB + $0.065 per provisioned IOPS
  • Example: 500GB + 10K IOPS = $62.50 + $650 = $712.50/month
  • Only use if gp3's 16K IOPS isn't enough
  • For most databases: gp3 with 16K IOPS is sufficient

io2 vs io2 Block Express: Regular io2 is limited to 64K IOPS and 16 TiB. Block Express unlocks the full 256K IOPS / 64 TiB / 4 GB/s โ€” but requires specific Nitro instance types.

Featureio2 (standard)io2 Block Express
Max size16 TiB64 TiB
Max IOPS64,000256,000
Max throughput1,000 MB/s4,000 MB/s
Sub-ms latencySingle-digit msSub-millisecond
Instance supportAll Nitror5b, r6i, c6in, i4i, etc.
Multi-AttachUp to 16Up to 16

๐Ÿ‘‰ Exam tip: If the question says "256K IOPS" or "sub-millisecond latency" โ†’ io2 Block Express. If it says "64K IOPS max" โ†’ regular io2. Block Express is for the highest-end workloads (SAP HANA, Oracle RAC, large SQL Server).

st1 / sc1 โ€” HDD Volumes (Throughput Workloads) Core
๐Ÿ“Š

st1 โ€” Throughput Optimized

  • 500 MB/s max throughput
  • Baseline: 40 MB/s per TB
  • Use for: Hadoop, Kafka, log processing, data warehouses
  • $0.045/GB โ€” cheap for large volumes
  • Sequential access patterns (not random)
  • โŒ Cannot be boot volume
๐ŸงŠ

sc1 โ€” Cold HDD

  • 250 MB/s max throughput
  • Baseline: 12 MB/s per TB
  • Use for: infrequent access, archive, backups
  • $0.015/GB โ€” cheapest EBS type
  • Lowest cost for rarely accessed data
  • โŒ Cannot be boot volume
Volume Type Decision Guide Core
If your workload needsโ€ฆChooseWhy
General app, boot volume, dev/testgp3Best price/performance, 3K IOPS free
Database (MySQL, PostgreSQL) up to 16K IOPSgp3 (with extra IOPS)Cheaper than io2 for most databases
High-performance database (>16K IOPS)io2Up to 256K IOPS, guaranteed performance
Clustered database (shared block storage)io2 (Multi-Attach)Only type supporting multi-attach
Big data, streaming, log processingst1High sequential throughput, cheap per GB
Infrequent access, archive, backupssc1Cheapest EBS โ€” $0.015/GB
Concept Diagram โ€” Volume Selection Flowchart Introductory
Which EBS Volume Type Should I Use?
Need boot volume? Yes Need >16K IOPS? Yes io2 No gp3 No (data) Access pattern? Random gp3 / io2 Seq. Frequent access? Yes st1 No sc1
AWS Diagram โ€” Volume Types with Use Cases Core
EBS Volume Types โ€” Mapped to Real Workloads
gp3
gp3
3K IOPS ยท 125 MB/s
Boot ยท APIs ยท Dev/Test
io2
io2
256K IOPS ยท 4 GB/s
Databases ยท SAP ยท Oracle
st1
st1
500 MB/s throughput
Hadoop ยท Kafka ยท Logs
sc1
sc1
250 MB/s ยท $0.015/GB
Archive ยท Infrequent

SSD types (gp3, io2) = random I/O, can boot ยท HDD types (st1, sc1) = sequential I/O, cannot boot

Architecture Diagram โ€” Mixed Volume Strategy Deep
Production Database Server โ€” Multiple Volume Types
EC2 โ€” r6i.2xlarge PostgreSQL Database Server gp3 โ€” Root 20 GB OS only $1.60/mo io2 โ€” Data 500 GB ยท 10K IOPS DB data files $712/mo gp3 โ€” WAL/Logs 100 GB ยท 6K IOPS Write-ahead log $27.50/mo st1 โ€” Backups 2 TB Local backup staging $90/mo Mix volume types per workload: cheap gp3 for OS, io2 for IOPS-critical data, gp3 for logs, st1 for cheap bulk storage.
๐ŸŽฏ Chapter 03 Summary

Four volume types, two categories โ€” pick based on IOPS vs throughput needs.

  • gp3 โ€” Default for 90% of workloads. 3K IOPS + 125 MB/s free. Boot volume. $0.08/GB. Always start here.
  • io2 โ€” When gp3 isn't enough. Up to 256K IOPS. Guaranteed performance. Multi-Attach. 99.999% durable. Expensive.
  • st1 โ€” Sequential throughput workloads. 500 MB/s. Hadoop, Kafka, logs. Cannot boot. $0.045/GB.
  • sc1 โ€” Cheapest EBS. Cold data, infrequent access. 250 MB/s. Archive. Cannot boot. $0.015/GB.
  • SSD vs HDD: SSD = random I/O (IOPS), can boot. HDD = sequential I/O (throughput), cannot boot.
  • Exam tip: "Boot volume" โ†’ SSD only. "Lowest cost, infrequent" โ†’ sc1. ">16K IOPS guaranteed" โ†’ io2. "Big data throughput" โ†’ st1.
04
Chapter Four

Snapshots & Backups

What is an EBS Snapshot? Introductory

An EBS snapshot is a point-in-time backup of your volume, stored in S3 (managed by AWS โ€” you don't see the S3 bucket). Snapshots are the primary mechanism for backup, disaster recovery, cross-AZ migration, and cross-region replication of EBS data.

๐Ÿ“ธ

What it Does

  • Copies all data from volume to S3
  • Creates a restorable backup
  • Can create new volumes from snapshot
  • Can copy to other regions
  • Can share with other AWS accounts
๐Ÿ“

Incremental

  • First snapshot = full copy
  • Subsequent = only changed blocks
  • Saves storage cost significantly
  • Each snapshot is still independently restorable
  • Delete old snapshots safely โ€” data deduped
โšก

Key Behaviors

  • Can snapshot while volume is in-use
  • Snapshot is async (no downtime)
  • Stored in S3 (11 nines durability)
  • Regional resource (not AZ-locked)
  • You pay for stored data, not provisioned size

๐Ÿ‘‰ Critical insight: Snapshots are regional โ€” not locked to an AZ. This is how you move EBS data across AZs: snapshot in AZ-a โ†’ create new volume from snapshot in AZ-b. Snapshots are your escape hatch from AZ-lock.

Snapshot Lifecycle โ€” Create, Copy, Restore Core
1๏ธโƒฃ

Create

  • aws ec2 create-snapshot
  • From running volume (no detach needed)
  • Best practice: flush writes first
  • First snap: full copy (slow)
  • Subsequent: incremental (fast)
2๏ธโƒฃ

Copy (Cross-Region)

  • Copy snapshot to another region
  • Enables cross-region DR
  • Snapshot is re-encrypted with target region KMS key
  • Async โ€” large volumes take time
  • aws ec2 copy-snapshot --region us-west-2
3๏ธโƒฃ

Restore

  • Create new volume from snapshot
  • Choose any AZ in the region
  • Can change volume type (gp2 โ†’ gp3)
  • Can change size (increase only)
  • First-read penalty: lazy loading from S3

โš ๏ธ Lazy Loading Warning: When you restore a volume from a snapshot, blocks are loaded from S3 on first access. This means the first read of each block is significantly slower. For production databases, use EBS Fast Snapshot Restore (FSR) or pre-warm the volume by reading all blocks with dd or fio before going live.

Snapshot Pricing Core
ComponentCostNotes
Snapshot storage$0.05/GB-monthOnly changed blocks stored (incremental)
Fast Snapshot Restore~$0.75/hr per AZPre-initializes volume โ€” eliminates lazy load
Cross-region copyData transfer + snapshot storageFirst copy is full; subsequent is incremental
Snapshot Archive$0.0125/GB-month (75% cheaper)Minimum 90-day retention. Restore takes 24-72h.
โšก

Fast Snapshot Restore (FSR)

  • Pre-initializes volume blocks โ€” eliminates lazy loading entirely
  • Cost: ~$0.75/hr per AZ per snapshot (expensive!)
  • Example: 1 snapshot ร— 3 AZs ร— 720 hrs = ~$1,620/month
  • Use for: production databases where first-read latency is unacceptable
  • NOT for: dev/test or workloads that can tolerate initial warm-up
๐ŸงŠ

Snapshot Archive Tier

  • 75% cheaper than standard ($0.0125 vs $0.05/GB-month)
  • Minimum retention: 90 days (charged for full 90 days even if restored earlier)
  • Restore time: 24โ€“72 hours (not instant!)
  • Use for: compliance archives, long-term backups, rarely needed data
  • NOT for: DR, frequent restores, or any time-sensitive recovery
Automated Backups โ€” AWS Backup & DLM Core
๐Ÿ”„

Data Lifecycle Manager (DLM)

  • Automate snapshot creation on schedule
  • Tag-based: "backup all volumes tagged env=prod"
  • Retention policies: keep last N snapshots
  • Cross-region copy policies
  • Free service (pay only for snapshot storage)
๐Ÿข

AWS Backup

  • Centralized backup across all AWS services
  • EBS, RDS, DynamoDB, EFS, S3 in one place
  • Backup plans with schedules + retention
  • Cross-region and cross-account backup
  • Compliance: audit trail + vault lock
Concept Diagram โ€” How Incremental Snapshots Work Introductory
Incremental Snapshots โ€” Only Changed Blocks Stored
Volume (Day 1) A B C D Snap 1 (Full) A B C D Stores ALL blocks Volume (Day 2) A B' C D Snap 2 (Incr.) B' Only changed block Volume (Day 3) A B' C' D' Snap 3 (Incr.) C' D' Only 2 changed blocks Cost: 4 blocks Cost: 1 block Cost: 2 blocks Each snapshot is independently restorable, but only stores changed blocks โ†’ huge cost savings over time = Changed block (stored in this snapshot) = Unchanged (references previous snapshot)
AWS Diagram โ€” Snapshot Create, Copy, Restore Core
EBS Snapshot โ€” Cross-AZ & Cross-Region Workflow
AZ us-east-1a
EBS
EBS Volume
500GB io2
โ†’ snapshot
S3 Snapshot
Snapshot
Regional ยท S3-backed
โ†’ restore
AZ us-east-1b
EBS
New Volume
from snapshot
โ†’ copy
S3 Remote
us-west-2
Cross-region copy

Volume (AZ-locked) โ†’ Snapshot (regional, S3-stored) โ†’ Restore in any AZ, or copy to another region for DR

Architecture Diagram โ€” Production Backup Strategy Deep
Automated EBS Backup โ€” DLM + Cross-Region DR
us-east-1 (Primary) EC2 Production DB EBS io2 500GB data DLM Snapshots (S3) Daily 1 Daily 2 Daily 3 Weekly Monthly Retention: 7d daily, 4w weekly us-west-2 (DR Region) copy DR Snapshots Copy 1 Copy 2 DR EC2 Restore from DR snapshot DLM auto-snapshots daily โ†’ Cross-region copy to DR โ†’ Restore in DR region if primary fails
๐ŸŽฏ Chapter 04 Summary

Snapshots = your escape from AZ-lock. Backup, copy, restore anywhere.

  • Snapshot = point-in-time backup to S3. Regional resource (not AZ-locked). Independently restorable.
  • Incremental โ€” only changed blocks stored after first full backup. Each snapshot still fully restorable.
  • Cross-AZ: Snapshot in AZ-a โ†’ Restore as new volume in AZ-b. The only way to move EBS data across AZs.
  • Cross-region: Copy snapshot to another region for disaster recovery.
  • Lazy loading: Restored volumes load blocks from S3 on first access. Use FSR for production databases.
  • Automation: Use DLM or AWS Backup for scheduled snapshots with retention policies.
  • Snapshot Archive: 75% cheaper storage for snapshots you rarely restore (minimum 90 days).
05
Chapter Five

Performance & Optimization

IOPS vs Throughput โ€” The Two Dimensions Introductory

EBS performance is measured in two independent dimensions. Understanding the difference is critical for right-sizing your volumes:

โšก

IOPS (Input/Output Operations Per Second)

  • Number of read/write operations per second
  • Each operation = one block (up to 256 KiB for SSD)
  • Measures random access speed
  • Critical for: databases, transaction processing
  • Analogy: how many times per second you can open a filing cabinet drawer
๐Ÿ“Š

Throughput (MB/s)

  • Amount of data transferred per second
  • Measures sequential read/write speed
  • Critical for: streaming, big data, log processing
  • Can be limited by IOPS ร— block size
  • Analogy: how many pages per second you can read from a book

๐Ÿ‘‰ Key formula: Throughput = IOPS ร— I/O size. For gp3: 3,000 IOPS ร— 256 KiB = 750 MB/s theoretical. But gp3 is capped at 1,000 MB/s throughput and 16,000 IOPS โ€” whichever limit you hit first becomes the bottleneck.

gp3 Performance โ€” Independent Tuning Core
ParameterBaseline (Free)Max (Extra Cost)Cost to Add
IOPS3,00016,000$0.005 per provisioned IOPS above 3K
Throughput125 MB/s1,000 MB/s$0.040 per provisioned MB/s above 125
Size1 GiB16 TiB$0.08 per GB-month

The game-changer with gp3: IOPS, throughput, and size are all independent. You can have a tiny 20GB volume with 16,000 IOPS โ€” impossible with gp2 (which ties IOPS to size). This lets you right-size for cost.

EC2 Instance โ€” The Hidden Bottleneck Deep

Even if your EBS volume supports 256K IOPS, your EC2 instance might not. Each instance type has maximum EBS bandwidth. If the instance can only push 4,750 Mbps to EBS, you'll never see 256K IOPS regardless of volume config.

Instance TypeMax EBS BandwidthMax EBS IOPSEBS Optimized
t3.micro2,085 Mbps11,800Yes (burst)
m5.large4,750 Mbps18,750Yes
m5.xlarge4,750 Mbps18,750Yes
r6i.2xlarge10,000 Mbps40,000Yes
r6i.8xlarge40,000 Mbps160,000Yes
r6i.metal80,000 Mbps260,000Yes

โš ๏ธ Common mistake: Provisioning io2 with 100K IOPS on a t3.large instance. The instance can only do ~18K IOPS โ€” you'll pay for 100K but get 18K. Always check instance EBS limits before provisioning high-IOPS volumes.

EBS-Optimized Instances Core

EBS-Optimized means the instance has dedicated bandwidth between EC2 and EBS, separate from network traffic. Without it, EBS and network compete for the same pipe.

โœ…

Modern Instances (Default)

  • t3, m5, r5, c5, r6i โ€” EBS-optimized by default
  • Dedicated EBS bandwidth (5โ€“80 Gbps depending on size)
  • No additional cost โ€” included in instance price
  • All Nitro-based instances are EBS-optimized
โš ๏ธ

Older Instances

  • t2, m4, c4 โ€” must enable EBS optimization manually
  • Additional hourly fee when enabled
  • Without it: EBS + network share bandwidth โ†’ unpredictable I/O
  • Recommendation: Use modern Nitro instances to avoid this
RAID with EBS (High Level) Deep
๐Ÿ”—

RAID 0 (Striping)

  • Combine multiple volumes for more IOPS + throughput
  • 4 ร— gp3 volumes = up to 64K IOPS combined
  • No redundancy โ€” if one volume fails, data is lost
  • Use when: need more performance than single volume max
  • Exception case โ€” usually gp3/io2 is enough alone
๐Ÿšซ

RAID 1, 5, 6 โ€” Not Recommended

  • RAID 1 (mirror): wasteful โ€” EBS already replicates within AZ
  • RAID 5/6: parity writes consume IOPS โ€” terrible performance
  • AWS explicitly advises against RAID 5/6 on EBS
  • For redundancy: use snapshots, not RAID
Concept Diagram โ€” IOPS vs Throughput Introductory
Two Dimensions of EBS Performance
IOPS THROUGHPUT (MB/s) gp3 16K IOPS 1 GB/s io2 256K IOPS 4 GB/s $$$ st1 500 MB/s ยท low IOPS sc1 Databases (random I/O) Big Data (sequential)
AWS Diagram โ€” Performance Bottleneck Chain Core
EBS Performance โ€” Three Potential Bottlenecks
๐Ÿ“ฑ
Application
I/O pattern
โ†’
EC2
EC2 Instance
EBS bandwidth limit
โ†’
EBS
EBS Volume
IOPS + throughput limit

Performance = min(app capability, EC2 EBS bandwidth, volume IOPS/throughput). All three must be sized correctly.

Architecture Diagram โ€” Optimized Database Storage Deep
High-Performance PostgreSQL โ€” Optimized EBS Layout
r6i.4xlarge โ€” EBS Optimized Max 20,000 Mbps ยท 80K IOPS gp3 โ€” OS 20 GB 3K IOPS (free) 125 MB/s (free) $1.60/mo io2 โ€” Data 1 TB 40K IOPS 1,000 MB/s $2,725/mo gp3 โ€” WAL 100 GB 10K IOPS (+$35) 400 MB/s (+$11) $54/mo gp3 โ€” Temp 200 GB 3K IOPS (free) Sort/temp space $16/mo Total: ~$2,797/mo โ€” io2 only where needed, gp3 everywhere else
๐ŸŽฏ Chapter 05 Summary

Two dimensions: IOPS (random speed) ร— Throughput (sequential speed). Right-size all three: app, instance, volume.

  • IOPS = operations per second (databases). Throughput = MB/s (big data, streaming).
  • gp3 tuning: 3K IOPS + 125 MB/s free. Scale independently up to 16K IOPS / 1 GB/s.
  • Instance limits: EC2 type caps EBS bandwidth. Don't provision 100K IOPS on a t3.large.
  • Three bottlenecks: app I/O pattern โ†’ EC2 EBS bandwidth โ†’ volume IOPS/throughput. All must align.
  • RAID 0 only: Stripe volumes for more IOPS. Never RAID 5/6 on EBS (AWS advises against it).
  • Cost optimization: Use io2 only for IOPS-critical data. Use gp3 for everything else. Mix volume types per workload.
06
Chapter Six

Security & Encryption

EBS Encryption โ€” How It Works Introductory

EBS encryption provides at-rest encryption for your volumes, snapshots, and data in transit between EC2 and EBS โ€” all using AWS KMS keys. When you enable encryption, everything is handled transparently: the OS doesn't know the disk is encrypted, and there's minimal performance impact.

๐Ÿ”

What Gets Encrypted

  • Data at rest on the volume (all blocks)
  • Data in transit between EC2 and EBS
  • All snapshots created from the volume
  • All volumes restored from encrypted snapshots
  • Encryption is end-to-end โ€” never leaves AWS in plaintext
โš™๏ธ

How It Works Internally

  • Uses AES-256 encryption algorithm
  • AWS generates a Data Encryption Key (DEK) per volume
  • DEK is encrypted by your KMS Customer Master Key (CMK)
  • Encryption/decryption happens on the EC2 host (Nitro hardware)
  • Minimal latency impact โ€” hardware-accelerated on Nitro instances

๐Ÿ‘‰ Key insight: EBS encryption is free โ€” no additional charge for encrypting volumes. You only pay for KMS key usage (a few cents per 10,000 API calls). There is no reason NOT to encrypt. AWS recommends encryption for all production volumes.

KMS Key Options Core
Key TypeNameWho ManagesCostUse Case
AWS managedaws/ebsAWS (auto-created)FreeDefault โ€” simplest option
Customer managedYour CMKYou (create in KMS)$1/month + API callsCross-account sharing, custom rotation
Custom key storeCloudHSM-backedYou (own HSM cluster)$$$Regulatory / compliance (FIPS 140-2 L3)
๐Ÿ”‘

When to Use Customer Managed Keys

  • Cross-account snapshot sharing โ€” AWS managed keys can't be shared
  • Key rotation control โ€” set your own rotation schedule
  • Key policies โ€” fine-grained access control (who can use/manage the key)
  • Audit trail โ€” CloudTrail logs every key usage
  • Disable/delete key โ€” render all encrypted data unreadable
โš ๏ธ

Encryption Gotchas

  • Cannot un-encrypt an encrypted volume in-place
  • To remove encryption: snapshot โ†’ copy (unencrypted) โ†’ create new volume
  • Cannot change KMS key on existing volume โ€” must snapshot + re-create
  • Encrypted volumes can only be attached to supported instance types (all Nitro)
  • Cross-region snapshot copy requires re-encryption with target region's key
Account-Level Default Encryption Core

AWS lets you enable encryption by default at the account level per region. When enabled, every new EBS volume is automatically encrypted โ€” no one can forget.

๐Ÿ‘‰ Best practice: Enable "EBS encryption by default" in every region you use. This ensures 100% of new volumes are encrypted. Settings โ†’ EBS encryption โ†’ Enable. You can choose the default KMS key (aws/ebs or your CMK). This is a one-time setting per account per region.

Encrypting an Existing Unencrypted Volume Deep

You cannot encrypt an existing unencrypted volume in-place. The process requires creating a new encrypted copy:

๐Ÿ“‹

Step-by-Step Process

  • 1. Create snapshot of unencrypted volume
  • 2. Copy snapshot โ†’ enable encryption (select KMS key)
  • 3. Create new volume from encrypted snapshot
  • 4. Detach old volume, attach new encrypted volume
  • 5. Delete old unencrypted volume + snapshot
๐Ÿ’ก

Why This Approach?

  • EBS can't re-encrypt existing blocks in-place
  • Each block must be read, encrypted, written to new location
  • Snapshot copy handles this transparently
  • Brief downtime required (detach โ†’ attach swap)
  • Snapshot remains unencrypted โ€” delete after migration
Concept Diagram โ€” EBS Encryption Architecture Introductory
EBS Encryption โ€” KMS Key Hierarchy
KMS Customer Master Key aws/ebs or your CMK encrypts Data Encryption Key (DEK) unique per volume ยท AES-256 encrypts EBS Volume โ€” Data Blocks at rest ยท in transit ยท snapshots EC2 Host (Nitro) Encrypt/decrypt here Hardware accelerated Snapshot (S3) Also encrypted Same DEK
AWS Diagram โ€” Encryption in the EBS Stack Core
EBS Encryption โ€” AWS Services Involved
KMS
AWS KMS
Master Key (CMK)
โ†’
EC2
EC2 (Nitro)
Encrypt/decrypt
โŸต encrypted โŸถ
EBS
EBS Volume
Encrypted at rest
โ†’
S3
Snapshot
Encrypted in S3

KMS provides the key โ†’ EC2 Nitro handles encryption/decryption on the host โ†’ Data encrypted at rest on EBS and in snapshots (S3)

Architecture Diagram โ€” Encrypting an Existing Volume Deep
Migration: Unencrypted Volume โ†’ Encrypted Volume
EBS Volume ๐Ÿ”“ Unencrypted 200 GB โ‘  Snapshot ๐Ÿ”“ Unencrypted โ‘ก copy Snapshot ๐Ÿ”’ Encrypted โ‘ข EBS Volume ๐Ÿ”’ Encrypted 200 GB โ‘ฃ EC2 Instance ๐Ÿ”’ Encrypted EBS attached โœ“ โ‘  snapshot โ‘ก copy w/ encrypt โ‘ข create volume โ‘ฃ swap Unencrypted vol โ†’ Snapshot โ†’ Copy (enable encrypt) โ†’ New encrypted vol โ†’ Attach to EC2 โ†’ Delete old
๐ŸŽฏ Chapter 06 Summary

EBS encryption is free, transparent, and should be on for every volume.

  • AES-256 encryption โ€” at rest, in transit, and snapshots. Hardware-accelerated on Nitro (minimal perf impact).
  • KMS keys: AWS managed (free, simplest) or Customer managed ($1/mo, cross-account sharing, custom policies).
  • Enable by default: Account โ†’ EBS settings โ†’ Encryption by default. Every new volume auto-encrypted.
  • Cannot un-encrypt in-place. Must: snapshot โ†’ copy (encrypted) โ†’ create new volume โ†’ swap.
  • Cross-region: Snapshot copy re-encrypts with target region's KMS key.
  • Exam tip: "Encrypt at rest with minimal effort" โ†’ EBS encryption + KMS. "Cross-account encrypted snapshot" โ†’ Customer managed CMK.
07
Chapter Seven

Architecture Patterns

Pattern 1 โ€” Simple EC2 + EBS Web Application Introductory
๐ŸŒ

Architecture

  • Single EC2 instance
  • gp3 root volume (OS + app code)
  • gp3 data volume (user uploads, SQLite/file-based DB)
  • Daily DLM snapshots
โœ…

When to Use

  • Small apps, personal projects
  • Low traffic (no scaling needed)
  • Simple backup with snapshots
  • Budget-conscious deployments
Pattern 2 โ€” Self-Managed Database on EC2 Core
๐Ÿ—„๏ธ

Architecture

  • EC2 (r-class, EBS-optimized)
  • gp3 for OS (20 GB, 3K IOPS)
  • io2 for data files (high IOPS, Multi-Attach for clustering)
  • gp3 for WAL/redo logs (tuned IOPS)
  • st1 for backups/staging (cheap throughput)
  • Automated snapshots with cross-region copy
โš ๏ธ

When NOT to Use

  • If RDS supports your DB engine โ€” use RDS instead
  • Self-managed = you handle HA, backups, patching
  • Only for: engines not in RDS, need OS-level access, custom clustering
  • Default recommendation: always try RDS first
Pattern 3 โ€” Multi-AZ High Availability Core

EBS is AZ-locked, so HA requires replication across AZs via snapshots or application-level replication:

๐Ÿ—๏ธ

Snapshot-Based HA

  • Primary EC2 + EBS in AZ-a
  • Frequent snapshots (every 15-60 min)
  • On failure: restore snapshot in AZ-b โ†’ launch new EC2
  • RPO: last snapshot (15-60 min data loss)
  • RTO: 10-30 min (restore + launch + warm)
  • Cheapest HA option
โšก

Replication-Based HA

  • Primary + standby EC2 in different AZs
  • App-level sync (PostgreSQL streaming replication, DRBD)
  • Each instance has its own EBS volumes
  • RPO: near-zero (synchronous replication)
  • RTO: seconds to minutes (failover)
  • Double the cost (2ร— EC2 + 2ร— EBS)
Pattern 4 โ€” Cross-AZ / Cross-Region Migration Core
ScenarioMethodSteps
Move volume to different AZSnapshot + restoreSnapshot โ†’ Create volume in new AZ โ†’ Attach
Copy data to another regionSnapshot + copy + restoreSnapshot โ†’ Copy to target region โ†’ Create volume
Upgrade instance typeDetach + reattachStop instance โ†’ Detach EBS โ†’ Launch new instance โ†’ Attach
Encrypt existing volumeSnapshot + encrypted copySnapshot โ†’ Copy (enable encrypt) โ†’ Create encrypted volume
Change volume typeModify volume (in-place)aws ec2 modify-volume โ†’ no detach needed
Concept Diagram โ€” EBS Architecture Decision Guide Introductory
When to Use EBS vs Other Storage
What kind of storage do you need? Block (disk) Shared across instances? No EBS Yes EFS Objects (files) S3 Temp / ephemeral Instance Store Databases Boot volumes Shared files Containers Backups ยท Media Data lakes ยท Static Cache ยท scratch Highest IOPS (local)
AWS Diagram โ€” Production EBS Stack Core
Production Web App โ€” Complete EBS Architecture
EC2
EC2
App Server
+
EBS
EBS gp3
Root + App Data
โ†’
S3
Snapshots
DLM automated
โ†’
S3 DR
DR Region
Cross-region copy
KMS
KMS
Encryption keys
CloudWatch
CloudWatch
Volume metrics
Backup
AWS Backup
Centralized policy

EC2 + encrypted EBS โ†’ DLM snapshots โ†’ Cross-region DR copy ยท KMS for keys ยท CloudWatch for monitoring ยท AWS Backup for compliance

Architecture Diagram โ€” Multi-AZ HA with EBS Deep
High Availability โ€” Primary + Standby with EBS Snapshots
VPC ยท us-east-1 AZ us-east-1a (Primary) EC2 Primary PostgreSQL EBS io2 1TB ยท 40K IOPS Snapshots every 15 min streaming replication AZ us-east-1b (Standby) EC2 Standby Hot standby EBS io2 1TB (replica) On Failure: Promote standby RTO: ~30 seconds us-west-2 DR (cross-region copy) Primary in AZ-a + hot standby in AZ-b (streaming replication) + snapshots every 15min + cross-region DR
EBS Quick Reference Core
If the exam saysโ€ฆAnswer
"Persistent block storage for EC2"EBS
"Boot volume"gp3 or io2 (SSD only โ€” not st1/sc1)
"Highest IOPS, guaranteed"io2 Block Express (up to 256K)
"Default volume for most workloads"gp3
"Cheapest storage, infrequent access"sc1 ($0.015/GB)
"Big data throughput, sequential"st1
"Move volume to different AZ"Snapshot โ†’ create in new AZ
"Encrypt existing unencrypted volume"Snapshot โ†’ copy (encrypt) โ†’ new volume
"Share data between multiple EC2"EFS (not EBS โ€” unless io2 Multi-Attach)
"Temporary high-IOPS local storage"Instance Store (not EBS)
"Cross-region DR for EBS"Snapshot โ†’ cross-region copy
"Delete on Termination risk"Root volume: YES by default (โš ๏ธ)
๐ŸŽฏ Chapter 07 Summary

EBS patterns range from simple single-volume apps to multi-AZ HA database clusters.

  • Simple app: EC2 + gp3 root + gp3 data + daily snapshots. Cheapest pattern.
  • Database: Mix volume types โ€” io2 for data, gp3 for WAL/OS, st1 for backups. Use RDS if possible.
  • Multi-AZ HA: Snapshot-based (cheapest, 15-60 min RPO) or replication-based (near-zero RPO, 2ร— cost).
  • Migration: Snapshot is the universal tool โ€” cross-AZ, cross-region, encrypt, resize, change type.
  • Decision guide: Block storage = EBS. Shared files = EFS. Objects = S3. Temp/scratch = Instance Store.
  • Production stack: Encrypted EBS + DLM snapshots + cross-region DR + CloudWatch monitoring + AWS Backup compliance.