EBS & EFS

Block storage attached to one instance (EBS) versus a networked, POSIX-compliant file system many instances can mount at once (EFS). Two different problems, two different answers.

Block storage gắn cho 1 instance (EBS) so với file system mạng POSIX cho nhiều instance mount cùng lúc (EFS). Hai bài toán khác nhau, hai câu trả lời khác nhau.

EBS volume typesLoại volume EBS

Type Media Best forTốt cho Boot?Boot?
gp2 / gp3SSDGeneral purpose, balanced $/perfPhổ thông, cân bằng $/perf✅
io1 / io2 Block ExpressSSDLatency-critical DBs, high IOPSDB nhạy latency, IOPS cao✅
st1HDDThroughput, streaming logsThroughput, stream log❌
sc1HDDColdest, infrequent accessLạnh nhất, ít truy cập❌
Sizing knobsCác núm chỉnh EBS is priced along three axes: Size · Throughput · IOPS. Volumes only grow — no shrink. Use an EBS-optimised instance type or you throttle the network. EBS tính giá theo 3 trục: Size · Throughput · IOPS. Volume chỉ tăng — không thu nhỏ được. Chọn instance EBS-optimised nếu không muốn nghẽn network.
Numbers to recallSố cần nhớ gp3: baseline 3,000 IOPS · 125 MiB/s free, provision up to 80,000 IOPS · 2,000 MiB/s · 64 TiB — no burst credits, perf independent of size (gp2 caps at 16,000 IOPS · 250 MiB/s · 16 TiB with burst credits). io2 Block Express: 256,000 IOPS · 4,000 MiB/s · 64 TiB, 99.999% durability (other types ~99.8–99.9%). gp3: baseline 3,000 IOPS · 125 MiB/s miễn phí, provision tới 80,000 IOPS · 2,000 MiB/s · 64 TiB — không burst credit, perf độc lập với size (gp2 trần 16,000 IOPS · 250 MiB/s · 16 TiB kèm burst credit). io2 Block Express: 256,000 IOPS · 4,000 MiB/s · 64 TiB, durability 99.999% (loại khác ~99.8–99.9%).

Multi-Attach (io1/io2)Multi-Attach (io1/io2)

  • Attach the same volume to up to 16 EC2 instances in the same AZ. Each has full R/W.Gắn cùng 1 volume cho tối đa 16 EC2 trong cùng AZ. Mỗi máy R/W đầy đủ.
  • App must handle concurrent writes; FS must be cluster-aware (e.g. GFS2, Oracle Cluster FS).App phải xử lý concurrent write; FS phải cluster-aware (vd GFS2, Oracle Cluster FS).
  • Use case: HA clustered Linux apps like Teradata.Use case: cluster Linux HA như Teradata.

Snapshots & Data Lifecycle ManagerSnapshot & Data Lifecycle Manager

  • Snapshots are incremental — only changed blocks. Stored in S3, opaque to you.Snapshot tăng dần — chỉ block đã đổi. Lưu trong S3, không nhìn thấy trực tiếp.
  • Snapshotting uses IO — avoid during peak traffic. Detaching is recommended but not required.Snapshot tốn IO — tránh giờ cao điểm. Detach được khuyến nghị nhưng không bắt buộc.
  • Restored volumes need pre-warming (Fast Snapshot Restore or dd/fio) — first-touch reads are slow otherwise.Volume mới restore cần pre-warm (Fast Snapshot Restore hoặc dd/fio) — nếu không, lần đọc đầu chậm.
  • Data Lifecycle Manager = automate snapshot/AMI create/retain/delete via tags. Won't manage snapshots created outside DLM.Data Lifecycle Manager = tự tạo/giữ/xoá snapshot & AMI theo tag. Không quản snapshot tạo ngoài DLM.
  • Snapshot Archive = ~75% cheaper tier, 90-day minimum, restore takes 24–72 h. Recycle Bin = retention rules that catch accidental snapshot/AMI deletion.Snapshot Archive = tier rẻ hơn ~75%, tối thiểu 90 ngày, restore mất 24–72 giờ. Recycle Bin = rule giữ lại snapshot/AMI lỡ tay xoá.
DLM vs AWS Backup DLM = single service scope (EBS + AMI). AWS Backup = one plane for many services (EBS, RDS, DynamoDB, EFS, FSx…). Pick DLM when you only care about EBS, Backup when compliance wants one pane of glass. DLM = phạm vi 1 service (EBS + AMI). AWS Backup = 1 mặt phẳng cho nhiều service (EBS, RDS, DynamoDB, EFS, FSx…). Chọn DLM nếu chỉ quan tâm EBS, chọn Backup khi compliance muốn 1 chỗ xem hết.

EFS — networked NFSEFS — NFS mạng

POSIX-compliant NFSv4.1 file system, mounted by 1000s of clients, multi-AZ, encrypted at rest with KMS. Costs ~3× gp2 per GB. File system NFSv4.1 POSIX, cho hàng ngàn client mount, multi-AZ, mã hoá bằng KMS. Giá ~3× gp2 mỗi GB.

Performance modeChế độ perf General Purpose · Max I/O
Throughput modeChế độ throughput Elastic (default) · Provisioned · BurstingElastic (mặc định) · Provisioned · Bursting
Storage tiersStorage tier Standard · IA · Archive
AvailabilityAvailability Multi-AZ · One Zone (dev)
OS supportHỗ trợ OS EFS is Linux-only. Need SMB / Windows shares → use FSx for Windows File Server. EFS chỉ Linux. Cần SMB / share Windows → dùng FSx for Windows File Server.

EFS extrasEFS bonus

  • Access Points = enforce a POSIX user/group + optional sub-directory as root. IAM policy can restrict which client uses which access point.Access Points = ép user/group POSIX + tuỳ chọn sub-dir làm root. IAM policy có thể giới hạn client nào dùng access point nào.
  • File system policies = resource-based policy on the FS (like an S3 bucket policy). Default = full access.File system policies = resource-based policy trên FS (như bucket policy S3). Mặc định = full access.
  • Cross-region replication — RPO/RTO in minutes, no impact on provisioned throughput.Cross-region replication — RPO/RTO tính bằng phút, không ảnh hưởng throughput provisioned.
  • Mode gotchas: Max I/O not supported with Elastic throughput or One Zone. Archive tier needs Regional + Elastic. IA/Archive lifecycle bills a 128 KB minimum per file.Bẫy mode: Max I/O không dùng được với Elastic throughput hoặc One Zone. Tier Archive cần Regional + Elastic. Lifecycle IA/Archive tính tối thiểu 128 KB mỗi file.

EBS vs EFS vs Instance Store — pick oneEBS vs EFS vs Instance Store — chọn cái nào

EBS EFS Instance Store
Mental modelMô hình Network block driveỔ block qua mạng NFS shareNFS share Physical disk on hostĐĩa vật lý trên host
Attaches toGắn vào 1 EC2 (or many w/ io2 Multi-Attach)1 EC2 (hoặc nhiều với io2 Multi-Attach) 1000s of clientsHàng ngàn client The host it belongs toChỉ host của nó
Persists after stop?Tồn tại sau stop? ✅ ✅ ❌
AZ / regionAZ / region Single AZ1 AZ Multi-AZMulti-AZ Physical hostHost vật lý
Best whenTốt khi Boot volumes, DBs, one-writerBoot volume, DB, 1 writer Shared content, CMS, container volumesContent share, CMS, volume container Scratch space, ephemeral cacheKhông gian tạm, cache ephemeral