Tuần 3 - Ngày 5: EFS và FSx
Mục tiêu học tập
- Hiểu EFS: managed NFS multi-AZ
- Phân biệt 4 FSx flavors: Windows, Lustre, NetApp ONTAP, OpenZFS
- Nắm EFS storage classes và performance modes
- Biết khi nào chọn EFS vs FSx vs S3
1. Tổng quan File Storage Options
2. EFS (Elastic File System)
Đặc điểm
- NFSv4.1 file system, Linux only
- Auto-scaling: tự động grow/shrink, không provisioning
- Multi-AZ: data replicate across AZs (Standard)
- POSIX-compliant (full Unix permission)
- Multi-attach: hàng nghìn EC2 mount cùng lúc
- Pay-per-use: chỉ trả cho data đã lưu (không pre-provision)
Use cases
- Web application với nhiều EC2 cần shared content (WordPress)
- CMS / Content management
- Data sharing trong team / DevOps
- Lift-and-shift Linux apps cần shared filesystem
- Big data analytics
Architecture
Mount Targets
- 1 Mount Target per AZ trong VPC
- ENI có IP private
- Mount qua DNS:
<fs-id>.efs.<region>.amazonaws.com
Mount example
# Cài amazon-efs-utils
sudo yum install -y amazon-efs-utils
# Mount
sudo mount -t efs -o tls fs-1234567:/ /mnt/efs
# Hoặc trong /etc/fstab
fs-1234567:/ /mnt/efs efs _netdev,tls 0 0
3. EFS Storage Classes
4 storage classes
| Class | AZ | Latency | Cost |
|---|---|---|---|
| Standard | Multi-AZ | Low | $$$$$ |
| Standard-IA | Multi-AZ | Higher (cold) | $$$ |
| One Zone | Single-AZ | Low | $$$ |
| One Zone-IA | Single-AZ | Higher (cold) | $ |
EFS Lifecycle Management
- Auto-move files không truy cập trong N ngày sang IA tier
- N = 7, 14, 30, 60, 90, 180, 270, 365 days
- Move back to Standard khi access (configurable)
Use case
- Standard: Production, active data
- Standard-IA: Backup files, archived data accessible
- One Zone: Dev/test, reproducible data
- One Zone-IA: Long-term archive single-AZ OK
4. EFS Performance Modes
2 modes (chọn khi tạo)
General Purpose (default)
- Low latency, most use cases
- Tối đa ~7,000 file operations/giây
- Web servers, CMS
Max I/O
- Higher latency per op nhưng higher throughput (50,000+ ops/s)
- Big data analytics, media processing
- KHÔNG thể change sau khi tạo
2025 update: Elastic Throughput
- AWS đã thêm Elastic Throughput mode mặc định
- Auto-scale throughput, pay per usage
- Replaces Bursting/Provisioned cho hầu hết workload
Throughput Modes (legacy/optional)
| Mode | Cách tính |
|---|---|
| Bursting (legacy) | Throughput scale với storage size |
| Provisioned | Set throughput độc lập với size |
| Elastic (mới, recommended) | Auto-scale, pay per use |
5. EFS Access Points
Định nghĩa
Access Point = enforced root directory + user/group ID cho mỗi application.
Use case
- Multiple apps share 1 EFS với strict separation
- POSIX user enforcement per app
Ví dụ
- App A: Access Point
/app-a, UID 1000 - App B: Access Point
/app-b, UID 2000 - Cùng EFS nhưng mỗi app chỉ thấy thư mục của mình
6. EFS với On-Premises
EFS có thể mount từ on-prem qua:
- Direct Connect
- VPN
- VPC Peering
Use case
- Sync data on-prem ↔ AWS
- Migration data lên cloud
- Hybrid burst compute
7. FSx for Windows File Server
Đặc điểm
- SMB protocol (Windows native)
- Tích hợp Active Directory (AWS Managed AD hoặc self-hosted)
- Windows ACLs (NTFS permissions)
- DFS Namespaces support
- Multi-AZ option
- Storage: SSD (1-100,000 IOPS) hoặc HDD
- Snapshot, shadow copies (Windows previous versions)
- Backup tự động + on-demand
Use cases
- Lift-and-shift Windows apps cần shared filesystem
- Home directories user Windows
- Media workflows (Avid, Adobe Premier)
- Cluster data shared (SQL Server FCI, SharePoint)
Performance
- Up to 2 GB/s throughput, 80,000 IOPS
- Sub-ms latency
8. FSx for Lustre
Đặc điểm
- Parallel POSIX filesystem cho HPC
- Hundreds GB/s throughput, millions IOPS
- Designed cho:
- Machine Learning training
- HPC (genomics, oil & gas, fluid dynamics)
- Video rendering
- Financial modeling
2 deployment types
- Scratch File System: Temporary, no replication, max performance
- Persistent File System: Long-term, replicated, durable
S3 Integration
- Auto-import từ S3 (lazy load files khi access)
- Auto-export sang S3 sau khi modify
- Pattern: training data ở S3, mount FSx Lustre, train, kết quả tự sync back S3
Architecture
9. FSx for NetApp ONTAP
Đặc điểm
- Multi-protocol: NFS (v3/4.1/4.2), SMB, iSCSI
- Multi-OS: Linux, Windows, macOS
- ONTAP features: SnapMirror, SnapVault, dedup, compression
- Multi-AZ HA
- Tier data tự động: SSD (hot) + capacity pool (cold)
Use cases
- Replicating on-prem NetApp lên AWS
- Multi-protocol shared storage
- Enterprise apps (Oracle DB, SAP HANA shared)
10. FSx for OpenZFS
Đặc điểm
- NFS protocol (v3, v4, v4.1, v4.2)
- ZFS features: snapshots, cloning, compression
- Cost-effective compared NetApp ONTAP
- Up to 1 million IOPS, 21 GB/s throughput
Use cases
- Lift-and-shift on-prem ZFS workload
- Media processing
- Web hosting
- Software development workspace
11. So sánh tất cả options
| Option | Protocol | OS | Multi-AZ | Use case |
|---|---|---|---|---|
| EBS | Block | All | No (per AZ) | DB, boot volume |
| EFS | NFS | Linux | Yes | Shared Linux files |
| FSx for Windows | SMB | Windows | Yes (option) | Windows shared |
| FSx for Lustre | POSIX | Linux | Yes (Persistent) | HPC, ML |
| FSx for ONTAP | NFS, SMB, iSCSI | All | Yes | Enterprise multi-protocol |
| FSx for OpenZFS | NFS | Linux/Mac | Yes (HA option) | ZFS workload |
| S3 | HTTP API | All | Yes (cùng region ≥3 AZs) | Object storage |
12. Decision Tree
Câu hỏi ôn tập
-
EFS hỗ trợ Windows không?
Xem đáp án
Không — EFS dùng NFS protocol (NFSv4.1/4.0), chỉ hỗ trợ Linux-based instances. Để shared filesystem cho Windows, dùng FSx for Windows File Server (SMB protocol, Active Directory integration). FSx for NetApp ONTAP hỗ trợ cả NFS lẫn SMB nên có thể dùng cho cả Linux và Windows.
-
FSx for Lustre dùng cho use case nào?
Xem đáp án
FSx for Lustre dùng cho High Performance Computing (HPC) workloads cần throughput cực cao: Machine Learning training, computational simulations, financial modeling, media processing. Tốc độ lên đến hàng trăm GB/s và millions of IOPS. Có thể link với S3 bucket để lazy-load data — chỉ load file từ S3 khi được access lần đầu.
-
EFS có bao nhiêu Mount Target per AZ?
Xem đáp án
1 Mount Target per AZ. Mỗi Mount Target có một IP address trong subnet của AZ đó. EC2 instances trong AZ mount EFS qua Mount Target của AZ đó để tối ưu latency. Một EFS filesystem có thể có Mount Targets trong nhiều AZs (và nhiều VPCs qua VPC peering hoặc Transit Gateway).
-
FSx for Windows tích hợp với gì để authentication?
Xem đáp án
Microsoft Active Directory (AD) — cả AWS Managed Microsoft AD lẫn on-premises AD. FSx for Windows là fully managed Windows file system hỗ trợ SMB protocol, DFS Namespaces, DFS Replication, và Windows ACLs. Authentication qua AD cho phép dùng existing Windows credentials mà không cần quản lý users riêng.
-
Khi nào chọn EFS vs S3?
Xem đáp án
Chọn EFS khi: cần shared filesystem giữa nhiều EC2 Linux instances cùng lúc (concurrent read/write), applications cần POSIX filesystem semantics (file locks, directory structure), workload như CMS, web servers dùng NFS mount. Chọn S3 khi: object storage, data lake, static files, backup, archival, HTTP access, cross-Region distribution, serverless access từ Lambda. S3 rẻ hơn nhiều cho cold/archival data.
Bài tập thực hành
- Tạo EFS file system với Lifecycle: move to IA sau 30 days
- Mount EFS vào 2 EC2 (khác AZ), test ghi file từ EC2-1 đọc từ EC2-2
- Tạo FSx for Windows File Server, join domain AD
- Setup FSx for Lustre với S3 integration (auto-import)
- So sánh giá EFS Standard vs One Zone-IA cho 1 TB
Tài liệu tham khảo chính thức
Tiếp theo: AWS Backup