Block and File Storage
EBS, EFS, and EC2 Instance Store
1. Storage Types at a Glance
AWS offers multiple storage options that serve different needs. This lesson focuses on three services that attach directly to compute: Amazon EBS (block storage), Amazon EFS (file storage), and EC2 Instance Store (ephemeral block storage).
| Service | Type | Persistent? | Attachable To |
|---|---|---|---|
| Amazon EBS | Block storage | Yes | One EC2 instance at a time (same AZ) |
| Amazon EFS | File storage (NFS) | Yes | Thousands of EC2 instances (multi-AZ) |
| EC2 Instance Store | Block storage | No (ephemeral) | Single EC2 instance (physically attached) |
2. Amazon EBS
Amazon Elastic Block Store (Amazon EBS) provides persistent block storage volumes for use with EC2 instances. Each volume is automatically replicated within its Availability Zone to protect against component failure.
EBS Volume Types
| Type | Best For | Notes |
|---|---|---|
| General Purpose SSD (gp3) | Most workloads: boot volumes, dev/test, low-latency interactive apps, virtual desktops. | Balances price and performance. Can be used as a boot volume. |
| Provisioned IOPS SSD (io2) | Critical business apps, large databases needing sustained IOPS performance. | Highest performance. For workloads needing more than 16,000 IOPS. |
| Throughput Optimized HDD (st1) | Streaming workloads, big data, log processing requiring consistent fast throughput. | Cannot be a boot volume. Lower cost per GB than SSD. |
| Cold HDD (sc1) | Throughput-oriented storage for large volumes of infrequently accessed data. | Lowest storage cost. Cannot be a boot volume. |
EBS Snapshots and Encryption
- Snapshots: Point-in-time backups stored in Amazon S3. The first snapshot is a baseline; subsequent snapshots capture only differences. You can recreate a volume from a snapshot at any time, share snapshots, or copy them to other Regions for disaster recovery.
- Encryption: EBS volumes can be encrypted at no additional cost. Data is encrypted in transit between EC2 and EBS.
- Elasticity: You can increase capacity or change volume types dynamically without stopping the instance.
3. Amazon EFS
Amazon Elastic File System (Amazon EFS) provides simple, scalable, elastic file storage for use with AWS services and on-premises resources. It uses the Network File System (NFS) protocol.
EFS Key Characteristics
- Shared access: Multiple EC2 instances can mount the same file system simultaneously.
- Elastic capacity: Automatically scales from gigabytes to petabytes as files are added or removed. No provisioning required.
- Multi-AZ: EC2 instances in multiple AZs within the same Region can access the file system through mount targets.
- Linux compatible: Supports NFSv4 and works with all Linux-based AMIs.
- Use cases: Big data and analytics, media processing, content management, web serving, and home directories.
Mount Targets
To access EFS, you create mount targets in your VPC subnets. Each AZ should have one mount target. EC2 instances connect to the mount target in their own AZ for optimal performance.
4. EC2 Instance Store
EC2 Instance Store provides ephemeral, temporary block-level storage for your EC2 instance. The storage is located on disks that are physically attached to the host computer.
When to Use Instance Store
- Temporary data that changes frequently: buffers, caches, scratch data.
- Data replicated across a fleet of instances (e.g., a load-balanced pool of web servers).
- High-performance temporary storage where durability is not required.
5. Choosing the Right Storage
Storage Decision Framework
Do multiple EC2 instances need to access the same data concurrently? Yes → Amazon EFS.
Does the data need to survive if the EC2 instance stops? Yes → Amazon EBS. No → Consider Instance Store for highest performance temporary data.
Is the data accessed as objects over HTTP/HTTPS from anywhere? Yes → Amazon S3 (covered in the previous lesson).
| Scenario | Best Storage | Why |
|---|---|---|
| Database boot volume requiring fast, persistent storage | EBS (gp3 or io2) | Persistent, low-latency block storage. Can be used as a boot volume. |
| Shared home directories for hundreds of Linux users | EFS | Shared NFS access across many instances and AZs. |
| Temporary rendering files for a video processing pipeline | Instance Store | Highest performance, physically attached. Data can be recreated if lost. |
| Long-term backups that must survive AZ failure | EBS snapshots in S3 | Snapshots are stored in S3 with 11 9s durability and can be copied across Regions. |
6. Quick Quiz
Test Your Understanding
Select one answer per question. You will receive immediate feedback.