Skip to content

EBS vs S3 vs EFS

AWS offers three main storage types: block (EBS), object (S3), and file (EFS). Each is designed for different use cases.

Analogy: Block storage (EBS) is like an internal hard drive — directly attached to your computer. Object storage (S3) is like a cloud drive where files have unique URLs. File storage (EFS) is like a network shared drive that multiple computers can access simultaneously.


flowchart TB
Q["What kind of storage do you need?"] --> Attached{"Attached to<br/>a single server?"}
Attached -->|"Yes, like a hard drive"| Block["Block Storage<br/>EBS — EC2's virtual hard disk"]
Attached -->|"No, network shared"| File{"Accessed by<br/>many servers?"}
File -->|"Yes, shared file system"| EFS["File Storage<br/>EFS — NFS shared across EC2"]
File -->|"No, via URL/API"| Object["Object Storage<br/>S3 — Files over HTTP"]
style Q fill:#f59e0b,color:#fff
style Block fill:#3b82f6,color:#fff
style EFS fill:#7c3aed,color:#fff
style Object fill:#059669,color:#fff

FeatureEBS (Block)S3 (Object)EFS (File)
Think of it asA virtual hard driveA cloud filing cabinetA network shared folder
Access methodAttached to one EC2 instanceHTTP/HTTPS (REST API)NFS (mounted on EC2)
Can multiple EC2 access?No (single attachment)Yes (via API)Yes (thousands)
Max size per unit16 TB per volume5 TB per object (unlimited total)Unlimited (petascale)
PersistenceSame AZ onlyAcross AZs/regionsAcross AZs in same region
Use caseOS disk, databasesBackups, static files, data lakesShared config, home dirs
PerformanceSSD/HDD optionsScales automaticallyUp to 10 GB/s throughput

Use CaseBest StorageWhy
EC2 boot volumeEBSNeeds to be attached as a block device
Database (MySQL on EC2)EBSLow latency, persistent block storage
Backup filesS3Durable, cheap, versioned
Static websiteS3Host directly, no server needed
Big data analyticsS3Data lake, works with Athena/EMR
Shared file systemEFSMultiple EC2 instances need same files
Container shared storageEFSECS/EKS containers share data
Archival / complianceS3 GlacierCheapest long-term storage

  • Like a virtual SSD/HDD for EC2 instances
  • One EBS volume = one EC2 instance (most cases)
  • Data persists even when the EC2 instance is stopped
  • Snapshots to S3 for backup
  • Types: gp3 (general purpose), io2 (high performance), st1 (throughput)
Terminal window
# Create and attach a volume
aws ec2 create-volume --size 100 --availability-zone us-east-1a
aws ec2 attach-volume --volume-id vol-123 --instance-id i-456 --device /dev/sdf

  • Like a NAS drive — NFS shared file system
  • Multiple EC2 instances can mount the same EFS simultaneously
  • Automatically scales storage (pay for what you use)
  • Accessible across AZs in the same region
Terminal window
# Mount EFS on EC2 (install amazon-efs-utils first)
sudo mount -t efs fs-123456:/ /mnt/efs

  • EBS = block storage → virtual hard drive attached to one EC2
  • S3 = object storage → files accessed via URL/API, unlimited scaling
  • EFS = file storage → network shared drive for multiple EC2 instances
  • Use EBS for databases and OS disks; S3 for backups, static files, and data lakes; EFS for shared file systems
  • EBS is per volume, S3 is per object, EFS is per file