So sánh các dịch vụ AWS Storage: EBS vs EFS vs FSx vs S3 vs Storage Gateway - Chọn giải pháp lưu trữ phù hợp
AWS cung cấp nhiều dịch vụ lưu trữ (storage) khác nhau, mỗi dịch vụ được tối ưu hóa cho các use case cụ thể. Việc hiểu rõ sự khác biệt, ưu nhược điểm và trường hợp sử dụng phù hợp của từng dịch vụ sẽ giúp bạn thiết kế kiến trúc hệ thống hiệu quả, tiết kiệm chi phí và đáp ứng tốt yêu cầu về hiệu suất.
Bài viết này sẽ so sánh toàn diện 6 dịch vụ storage chính của AWS:
- Amazon EBS (Elastic Block Store)
- Amazon EFS (Elastic File System)
- Amazon FSx (Managed File Systems)
- Amazon S3 (Simple Storage Service)
- AWS Storage Gateway
- EC2 Instance Store
📊 Bảng so sánh tổng quan các dịch vụ AWS Storage
| Tiêu chí | EBS | EFS | FSx | S3 | Storage Gateway | Instance Store |
|---|---|---|---|---|---|---|
| Loại storage | Block Storage | File Storage (NFS) | Managed File System | Object Storage | Hybrid Storage Bridge | Ephemeral Block Storage |
| Giao thức truy cập | Block-level (iSCSI-like) | NFS v4.1 | SMB, NFS, Lustre, iSCSI | HTTP/HTTPS REST API | SMB, NFS, iSCSI | Block-level (trực tiếp) |
| Attach vào EC2 | 1 instance (hoặc 16 với Multi-Attach) | Nhiều instances đồng thời | Nhiều instances đồng thời | Không attach (API access) | Via Gateway VM/Appliance | 1 instance (local) |
| Hiệu suất | Cao (IOPS có thể provision) | Trung bình đến cao | Rất cao (tùy loại FSx) | Thấp đến trung bình | Phụ thuộc cache và network | Rất cao (I/O trực tiếp) |
| Độ bền (Durability) | 99.999% (trong 1 AZ) | 99.999999999% (11 nines) | 99.999999999% (11 nines) | 99.999999999% (11 nines) | Dựa trên AWS (S3/Glacier) | ❌ Không bền (mất khi stop) |
| Availability Zone | Single AZ | Multi-AZ hoặc Single AZ | Multi-AZ hoặc Single AZ | Regional (multi-AZ) | Hybrid (on-premises + AWS) | Single AZ (local) |
| Tính liên tục dữ liệu | ✅ Persistent | ✅ Persistent | ✅ Persistent | ✅ Persistent | ✅ Persistent (on AWS side) | ❌ Ephemeral |
| Snapshot/Backup | ✅ EBS Snapshot | ✅ AWS Backup | ✅ AWS Backup | ✅ Versioning, Lifecycle | ✅ Via AWS services | ❌ Không hỗ trợ |
| Mã hóa | ✅ AWS KMS | ✅ AWS KMS | ✅ AWS KMS | ✅ SSE-S3, SSE-KMS, SSE-C | ✅ In-transit và at-rest | ✅ Tùy instance type |
| Mở rộng dung lượng | Manual resize (có downtime) | ✅ Tự động elastic | Manual hoặc elastic | ✅ Unlimited | Hybrid capacity | ❌ Cố định |
| Chi phí | $$ (theo GB + IOPS) | $$ (theo GB used) | $$$ (cao hơn EFS) | $ (rẻ nhất, pay-as-you-go) | $$ (phụ thuộc usage) | Miễn phí (trong giá EC2) |
| Độ trễ (Latency) | Thấp (< 1ms) | Trung bình (1-3ms) | Thấp đến rất thấp | Cao hơn (10-100ms) | Trung bình | Rất thấp |
| Use case chính | OS, Database, transactional apps | Shared file storage, web apps, containers | Windows apps, HPC, enterprise file systems | Backup, Data Lake, static content | Hybrid cloud, backup, migration | Cache, temp data, high-perf compute |
🔍 Chi tiết từng dịch vụ AWS Storage
1️⃣ Amazon EBS (Elastic Block Store)
📝 Mô tả ngắn:
Block storage hiệu suất cao được thiết kế để gắn vào EC2 instances, hoạt động như ổ đĩa ảo có thể format và mount.
🔹 Đặc điểm chính:
- Loại storage: Block Storage
- Giao thức: Block-level (như ổ đĩa vật lý)
- Attach: 1 instance mặc định (Multi-Attach: tối đa 16 instances với io1/io2)
- Availability: Single AZ
- Persistence: ✅ Dữ liệu liên tục (persistent)
📊 Các loại EBS Volume:
| Loại Volume | IOPS | Throughput | Use Case |
|---|---|---|---|
| gp3 (General Purpose SSD) | 3,000-16,000 | 125-1,000 MB/s | Balanced workloads |
| gp2 (General Purpose SSD) | 100-16,000 | 128-250 MB/s | Legacy general purpose |
| io2 (Provisioned IOPS SSD) | 100-64,000 | 1,000 MB/s | Critical databases |
| io1 (Provisioned IOPS SSD) | 100-64,000 | 1,000 MB/s | High-perf databases |
| st1 (Throughput Optimized HDD) | 500 | 500 MB/s | Big data, log processing |
| sc1 (Cold HDD) | 250 | 250 MB/s | Infrequent access |
✅ Ưu điểm:
- Hiệu suất cao, IOPS có thể provision
- Hỗ trợ snapshot và backup
- Có thể dùng làm boot volume
- Mã hóa tích hợp (KMS)
❌ Nhược điểm:
- Chỉ gắn được vào 1 instance (trừ Multi-Attach)
- Bị giới hạn trong 1 Availability Zone
- Phải quản lý capacity thủ công
🎯 Use Cases:
- Boot volumes cho EC2
- Database storage (MySQL, PostgreSQL, Oracle)
- Transactional applications
- Enterprise applications cần IOPS cao
2️⃣ Amazon EFS (Elastic File System)
📝 Mô tả ngắn:
File storage được quản lý hoàn toàn, tự động mở rộng, hỗ trợ NFS protocol cho phép nhiều EC2 instances truy cập đồng thời.
🔹 Đặc điểm chính:
- Loại storage: File Storage (Network File System)
- Giao thức: NFS v4.1
- Attach: Nhiều instances đồng thời (thousands)
- Availability: Multi-AZ (Regional) hoặc One Zone
- Persistence: ✅ Persistent
📊 Performance Modes:
| Mode | Latency | Throughput | Use Case |
|---|---|---|---|
| General Purpose | Thấp (< 1ms) | Moderate | Web apps, CMS |
| Max I/O | Cao hơn | High | Big data, parallel access |
📊 Storage Classes:
| Class | Mô tả | Chi phí |
|---|---|---|
| Standard | Frequent access | $$ |
| Infrequent Access (IA) | Ít truy cập | $ (rẻ hơn 85%) |
✅ Ưu điểm:
- Tự động scale (elastic)
- Chia sẻ dữ liệu giữa nhiều instances
- Multi-AZ durability
- Không cần quản lý capacity
- Lifecycle management tự động
❌ Nhược điểm:
- Hiệu suất không cao bằng EBS
- Chỉ hỗ trợ Linux (NFS)
- Đắt hơn S3
🎯 Use Cases:
- Web server clusters (shared content)
- Content Management Systems (WordPress, Drupal)
- Container storage (ECS, EKS)
- Machine Learning training data
- Development environments
3️⃣ Amazon FSx (Managed File Systems)
📝 Mô tả ngắn:
Fully-managed file systems chuyên dụng với hiệu năng cao, hỗ trợ nhiều protocols và tối ưu cho workloads cụ thể.
🔹 Các loại FSx:
| Loại FSx | Protocol | Use Case | Hiệu suất |
|---|---|---|---|
| FSx for Windows File Server | SMB | Windows workloads, Active Directory | Cao |
| FSx for Lustre | Lustre | HPC, AI/ML, video processing | Rất cao |
| FSx for NetApp ONTAP | NFS, SMB, iSCSI | Enterprise multi-protocol | Cao |
| FSx for OpenZFS | NFS | Linux workloads, data migration | Cao |
🔹 Đặc điểm chính:
- Loại storage: Managed File System
- Giao thức: SMB, NFS, Lustre, iSCSI (tùy loại)
- Attach: Nhiều instances đồng thời
- Availability: Multi-AZ hoặc Single-AZ
- Persistence: ✅ Persistent
✅ Ưu điểm:
- Hiệu năng rất cao (đặc biệt FSx for Lustre)
- Hỗ trợ nhiều protocols
- Tích hợp Active Directory (Windows FSx)
- Backup và replication tích hợp
- Tính năng enterprise (deduplication, compression)
❌ Nhược điểm:
- Đắt hơn EFS và EBS
- Phức tạp hơn trong setup
- Overkill cho simple workloads
🎯 Use Cases:
- Windows FSx: File servers, SharePoint, SQL Server
- Lustre: High-Performance Computing, genomics, autonomous vehicles
- NetApp ONTAP: Enterprise applications cần multi-protocol
- OpenZFS: Data analytics, database backups
4️⃣ Amazon S3 (Simple Storage Service)
📝 Mô tả ngắn:
Object storage có khả năng mở rộng không giới hạn, được thiết kế để lưu trữ và truy xuất bất kỳ lượng dữ liệu nào từ bất kỳ đâu trên Internet.
🔹 Đặc điểm chính:
- Loại storage: Object Storage
- Giao thức: HTTP/HTTPS REST API
- Attach: Không attach trực tiếp (API-based access)
- Availability: Regional (multi-AZ)
- Persistence: ✅ Persistent
- Durability: 99.999999999% (11 nines)
📊 S3 Storage Classes:
| Storage Class | Use Case | Durability | Availability | Chi phí |
|---|---|---|---|---|
| S3 Standard | Frequent access | 11 nines | 99.99% | $$$ |
| S3 Intelligent-Tiering | Auto-tiering | 11 nines | 99.9% | $$ (auto) |
| S3 Standard-IA | Infrequent access | 11 nines | 99.9% | $$ |
| S3 One Zone-IA | Non-critical, infrequent | 11 nines | 99.5% | $ |
| S3 Glacier Instant Retrieval | Archive, instant access | 11 nines | 99.9% | $ |
| S3 Glacier Flexible Retrieval | Archive (minutes-hours) | 11 nines | 99.99% | $ |
| S3 Glacier Deep Archive | Long-term archive (12+ hours) | 11 nines | 99.99% | $ (cheapest) |
✅ Ưu điểm:
- Khả năng mở rộng không giới hạn
- Độ bền dữ liệu cực cao (11 nines)
- Chi phí rẻ nhất (đặc biệt với Glacier)
- Versioning và lifecycle management
- Tích hợp tốt với hầu hết AWS services
- Static website hosting
❌ Nhược điểm:
- Không phù hợp cho block/file-level access
- Độ trễ cao hơn EBS/EFS
- Eventual consistency cho một số operations
- Không thể mount như filesystem
🎯 Use Cases:
- Backup và archive
- Data lakes và big data analytics
- Static website hosting
- Media storage (images, videos)
- Application assets
- Log storage
- Disaster recovery
5️⃣ AWS Storage Gateway
📝 Mô tả ngắn:
Hybrid cloud storage bridge kết nối giữa môi trường on-premises và AWS Cloud storage, cho phép ứng dụng on-prem sử dụng cloud storage một cách seamless.
🔹 Các loại Storage Gateway:
| Gateway Type | Protocol | Use Case |
|---|---|---|
| File Gateway | NFS, SMB | File sharing, backup to S3 |
| Volume Gateway | iSCSI | Block storage backup to S3/EBS |
| Tape Gateway | iSCSI | Virtual tape library backup to Glacier |
🔹 Đặc điểm chính:
- Loại storage: Hybrid Storage Bridge
- Giao thức: NFS, SMB, iSCSI (tùy loại)
- Deployment: VM hoặc hardware appliance
- Backend: S3, Glacier, EBS
- Local cache: Có (cho frequently accessed data)
✅ Ưu điểm:
- Kết nối seamless giữa on-prem và cloud
- Local caching cho low-latency access
- Backup tự động lên cloud
- Tiết kiệm chi phí on-premises storage
- Hỗ trợ disaster recovery
❌ Nhược điểm:
- Phụ thuộc vào network bandwidth
- Cần deployment và maintenance của gateway
- Độ trễ cao hơn pure cloud solutions
- Phức tạp hơn trong setup
🎯 Use Cases:
- Hybrid cloud storage
- Backup và archive from on-premises
- Disaster recovery
- Cloud migration
- Tiered storage (hot data on-prem, cold data on cloud)
6️⃣ EC2 Instance Store
📝 Mô tả ngắn:
Ephemeral block storage gắn trực tiếp vào máy chủ vật lý (physically attached disks) hosting EC2 instance, cung cấp hiệu suất I/O cực cao nhưng dữ liệu mất khi instance stop/terminate.
Instance Store lý tưởng cho temporary storage của dữ liệu thay đổi thường xuyên như buffers, caches, scratch data, và các temporary content khác.
🔹 Đặc điểm chính:
- Loại storage: Ephemeral Block Storage (Temporary)
- Giao thức: Block-level (trực tiếp, không qua network)
- Attach: 1 instance (local, physically attached)
- Availability: Single AZ (on physical host)
- Persistence: ❌ Không persistent (ephemeral)
- Chi phí: Miễn phí (bao gồm trong giá EC2 instance)
- Virtual device names: ephemeral0 đến ephemeral23
📊 Đặc điểm hiệu suất:
| Đặc điểm | Mô tả |
|---|---|
| Latency | Cực thấp (microseconds) - không có network overhead |
| IOPS | Rất cao (hàng trăm nghìn IOPS) |
| Throughput | Rất cao (GB/s với NVMe) |
| Technology | SSD, NVMe SSD (tùy instance type) |
| Số lượng volumes | Phụ thuộc instance type & size |
✅ Ưu điểm:
- ⚡ Hiệu suất I/O cực cao (fastest storage option)
- Low latency (< 1ms, thường microseconds)
- High IOPS và throughput
- Không có network latency
- 💰 Miễn phí (included in EC2 instance price)
- 🚀 NVMe support cho performance tối đa
- 📍 Locally attached - direct access to physical disks
- 🎯 Ideal cho high-speed temporary data
❌ Nhược điểm (yêu cầu fault-tolerant architecture):
⚠️ Critical limitations - Hệ thống PHẢI có khả năng chịu lỗi:
- ❌ Dữ liệu mất khi:
- Stop instance
- Terminate instance
- Hardware failure (host hardware fails)
- Instance hibernates
- ❌ Không thể detach/attach sang instance khác
- ❌ Không hỗ trợ snapshot/backup tự động
- ❌ Không persistent - data lifetime = instance lifetime
- 🔒 Kích thước cố định (không thể resize sau khi launch)
- ⚠️ Chỉ available trong instance lifetime
⚠️ Yêu cầu quan trọng:
🛡️ Hệ thống PHẢI có khả năng fault tolerance:
-
Data replication: Dữ liệu phải được replicate sang:
- EBS volumes
- S3 buckets
- Các instances khác trong cluster
-
Application-level redundancy:
- Load-balanced pool of instances
- Database replication (master-slave, multi-master)
- Distributed systems (Cassandra, Redis Cluster)
-
Backup strategy:
- Định kỳ backup critical data sang persistent storage
- Automated backup scripts
- Disaster recovery plan
-
Stateless applications: Hoặc có khả năng recreate data từ source
🎯 Use Cases (cho fault-tolerant systems):
| Use Case | Lý do phù hợp |
|---|---|
| Cache systems | Redis, Memcached - data có thể recreate |
| Temporary buffers | Data processing pipelines |
| Scratch data | Intermediate computation results |
| Replicable data | Load-balanced web servers với shared content |
| NoSQL databases | Cassandra, MongoDB với replication |
| Big data processing | Hadoop HDFS, Spark - data distributed |
| High-performance computing | Parallel processing với temp results |
| Video encoding | Temporary files during transcoding |
| Queue/Message systems | Kafka, RabbitMQ với replication |
💡 Best Practices:
- Never store critical data exclusively on Instance Store
- Implement data replication across multiple instances or to persistent storage
- Use for workloads that can tolerate data loss
- Regular backups to S3 or EBS if data has any value
- Combine with EBS - OS on EBS, temp data on Instance Store
- Monitor instance health and plan for failures
- Use Auto Scaling với launch templates để quick recovery
Yêu cầu đăng nhập
Vui lòng đăng nhập để truy cập nội dung này
Additional Resources
Course Guide
Comprehensive PDF guide with examples
GitHub Repository
Example code for all lessons
Discussion
Have a question about this lesson? Post it here and get answers from instructors and peers.
