2.4.4. Shared Storage: EFS and FSx Selection and Tuning
💡 First Principle: EBS gives you a dedicated disk attached to one instance. But what if multiple instances need to share the same files? Shared file systems solve the concurrent access problem — multiple servers reading and writing to the same storage, with each seeing the same data in real time.
This matters for applications that weren't designed for distributed storage: content management systems storing user uploads, application servers sharing configuration files, or batch processing jobs reading from the same input dataset.
Amazon EFS (Elastic File System):
- NFS protocol (Linux only)
- Scales automatically to petabytes — no capacity planning
- Multi-AZ by default (data replicated across AZs)
- Thousands of concurrent connections from EC2, Lambda, ECS, EKS
EFS Performance Modes:
| Mode | Use Case | Tradeoff |
|---|---|---|
| General Purpose | Default; web serving, content management, home directories | Best latency; some IOPS limit |
| Max I/O | Big data, media processing, >500 clients | Higher aggregate throughput; higher per-operation latency |
EFS Throughput Modes:
| Mode | How Throughput Works |
|---|---|
| Elastic (Recommended) | Automatically scales up and down; pay per GB transferred; best for spiky or unpredictable throughput |
| Bursting | Throughput tied to storage size; earns credits when idle, spends during bursts |
| Provisioned | You specify throughput regardless of storage size; use when you need consistent high throughput with small storage |
EFS Lifecycle Management moves files automatically between three storage classes, Standard, Infrequent Access (IA) and Archive, based on how long since each file was last accessed. You choose the periods (defaults: IA after 30 days, Archive after 90). A separate policy decides whether a file returns to Standard on first access; by default it stays in IA or Archive. Tiering is transparent: files keep their paths and applications need no changes.
Amazon FSx — When EFS Isn't Enough:
| FSx Variant | Protocol | Best For |
|---|---|---|
| FSx for Windows File Server | SMB | Windows applications, Active Directory integration, NTFS |
| FSx for Lustre | Lustre (custom) | High-performance computing, ML training, financial modeling — maximum throughput |
| FSx for NetApp ONTAP | NFS, SMB, iSCSI | Hybrid cloud; existing NetApp workloads |
| FSx for OpenZFS | NFS | ZFS features, data compression, deduplication |
Key Decision Rule:
⚠️ Exam Trap: FSx for Lustre integrates natively with S3 — you can configure it to automatically load data from an S3 bucket and write results back to S3. This is the recommended pattern for HPC workloads processing data from S3. An EFS file system does not have this native S3 integration (Amazon S3 Files, below, is a separate resource built for that purpose).
Amazon S3 Files: A File System Over Your Bucket (added in exam guide v1.1):
The decision rule above assumes the data lives in a file system. Increasingly the data already lives in S3, where pipelines read it through the S3 API, while newer tools and agents expect to open files by path. Copying terabytes into EFS or FSx to bridge that gap duplicates the data and creates a second copy that drifts. Amazon S3 Files removes the copy: it is a shared file system, built using Amazon EFS, that is linked to an S3 bucket (or a prefix) and presents its objects as files. The bucket stays the authoritative store.
- Protocol and clients: NFS 4.1 and 4.2 with file-system semantics (read-after-write consistency, advisory file locking, POSIX permissions). Mountable from EC2, Lambda, EKS and ECS in the same VPC. EC2 mounting supports Linux distributions only, not Windows or macOS.
- Mounting: install
amazon-efs-utils3.0.0 or later and runsudo mount -t s3files <file-system-id>:/ /mnt/s3files. For boot-time mounting, add an/etc/fstabentry with_netdev(andnofailin production). Mounts always use TLS and IAM authentication. - Network: clients connect through a mount target in their own AZ (at most one per AZ) on TCP 2049. The console creates a mount target in every AZ of the VPC; if you create mount targets yourself, add one in every AZ your clients use, as AWS recommends.
- Prerequisites: an S3 general purpose bucket, S3 Versioning enabled, default encryption of SSE-S3 or SSE-KMS, an IAM role that S3 Files assumes to sync with the bucket, and a compute role (for example,
AmazonS3FilesClientFullAccess, or…ReadOnlyAccess).
How Data Moves Between the File System and the Bucket:
| Event | What S3 Files Does |
|---|---|
| First access to a directory | Imports metadata for every file in it, plus data for small files (under 128 KiB by default) |
| A large read (1 MiB or more), or a read of data not on the file system | Streams it directly from S3 |
| Write through the file system | Exports it to S3 after 60 seconds of write inactivity, as a new object version (deletes become delete markers) |
| Object changed through the S3 API | Detected through S3 event notifications (an EventBridge rule named DO-NOT-DELETE-S3-Files… that you must not modify) |
| File not read for 30 days (configurable 1–365) | Data expires from the file system and stays in S3; metadata remains |
| Both sides changed before an export | The bucket wins. The file-system version moves to .s3files-lost+found-<file-system-id> at the file system root |
| Directory rename | Copy + delete of every object under the prefix, so it is slow and costly on huge directories |
Choosing Shared Storage With S3 Files in the Picture:
| If the Requirement Is… | Choose |
|---|---|
| Data's system of record is an S3 bucket that other systems use through the S3 API, and file-based tools (including Lambda) need path-based access without a copy | S3 Files |
| General-purpose shared Linux file storage whose data lives only in the file system | Amazon EFS |
| Windows/SMB with Active Directory, HPC throughput, NetApp or ZFS features | Amazon FSx (see the table above) |
Monitoring S3 Files: metrics are in the AWS/S3/Files namespace, per FileSystemId. Alarm on ExportFailures (changes that failed to reach S3 and will not be retried) and ImportFailures. Watch ExportAge / PendingExports for export lag, ImportAge for import lag, and LostAndFoundFiles for conflicts. The client also publishes NFSConnectionAccessible, S3BucketAccessible and S3BucketReachable to the efs-utils/S3Files namespace.
⚠️ Exam Trap: S3 Files is not a copy of the bucket, and the bucket always wins a conflict. Edits that were never exported are not in S3 version history; they are in the lost+found directory. Archived objects in S3 Glacier Flexible Retrieval or Deep Archive (or Intelligent-Tiering's archive tiers) cannot be read through the file system until restored, and hard links are not supported.
Reflection Question: Two teams share an S3 file system: one writes results through the mount, the other overwrites the same keys with a batch upload through the S3 API. Results keep "disappearing". What is happening, where do the lost results go, and what design rule prevents it?
Reflection Question: A media company runs Linux-based video transcoding on a cluster of 200 EC2 instances. Source videos are in S3. The cluster needs shared access to partially processed files with throughput exceeding 50 GB/s. Which storage service do you choose and why?