Arkinu
AWS service comparison

Amazon EBS vs Amazon EFS: differences and when to use each

Amazon EBS
Amazon EFS

Often confused on the examQuestions tend to offer one as a distractor for the other: look for the phrase in the scenario that tips the balance.

Storage

Amazon EBS

Block storage for Amazon EC2 instances: volumes that you attach to an instance and use like a local hard drive, plus snapshots that store point-in-time copies. It provides an instance's disk, for example to store files or install applications.

Exam phrases that point here

  • «persistent block storage for an EC2 instance»

    An Amazon EBS volume behaves like a disk attached to the instance, and its data survives even if the instance is stopped or terminated (if so configured).

    When not: If several instances, even in different Availability Zones, must share the same files, Amazon EFS fits. If the data is temporary and can be lost along with the instance, instance store may be enough.

  • «mission-critical database that needs high, consistent IOPS with very low latency»

    io2 Block Express volumes are designed for demanding databases: sub-millisecond latency, provisioned IOPS, and higher durability than the other EBS volumes.

    When not: If a balance between price and performance is enough, gp3 is usually the choice. And if the scenario prioritizes not managing the database, the answer may be a managed service such as Amazon RDS instead of choosing the volume.

  • «high-throughput sequential workloads, such as big data or log processing»

    HDD volumes (st1 and sc1) are optimized for large, sequential reads and writes, measured in MB/s, at a lower cost than SSDs.

    When not: With small, random I/O, such as that of a transactional database, HDDs perform poorly and the answer becomes an SSD volume (gp3 or io2). Of the two HDDs, sc1 is for cold data that is accessed infrequently.

  • «automate the creation, retention, and deletion of EBS snapshots»

    Amazon Data Lifecycle Manager creates snapshots of volumes or instances with certain tags on a schedule, deletes old ones according to retention, and can copy them to other Regions, at no additional cost.

    When not: If you need to manage backups of several services (EBS, RDS, DynamoDB, EFS...) from a single place, or apply policies across the whole organization, the tool is AWS Backup.

  • «attach the same volume to multiple instances in a cluster»

    EBS Multi-Attach lets you attach a Provisioned IOPS volume (io1 or io2) to multiple instances in the same Availability Zone at once, for cluster applications that coordinate access to the disk.

    When not: The application must coordinate writes (for example, Windows Server Failover Cluster or NVMe reservations); a regular file system would be corrupted. If all that is needed is to share files between instances, the answer is Amazon EFS. A volume with Multi-Attach cannot be used as a boot volume.

  • «ensure that all new volumes are encrypted»

    EBS encryption by default is turned on with a single setting per Region and requires every new volume to be created encrypted with AWS KMS.

    When not: The setting is per Region: it must be turned on in each Region you use. If you must also share encrypted snapshots with other accounts, they must be encrypted with a customer managed key, not the default key.

Study Amazon EBS →

Storage

Amazon EFS

Serverless, elastic file system, accessible through the NFS protocol, that grows and shrinks automatically as you add or delete files. It lets many Amazon EC2 instances, containers, or AWS Lambda functions share the same files without provisioning capacity; it is not supported on Windows instances.

Exam phrases that point here

  • «a shared file system accessed by multiple Linux instances at the same time»

    Amazon EFS is a managed NFS file system: many instances mount it at the same time and see the same files, with file locking included.

    When not: If the clients are Windows and use SMB, the answer is usually Amazon FSx for Windows File Server. If the disk is used by a single instance (for example, a self-managed database), Amazon EBS fits.

  • «mount the same storage from instances in multiple Availability Zones»

    A Regional EFS file system stores data across several zones and supports a mount target in each one, so instances in different zones share the same data and the file system survives the loss of a zone.

    When not: If you choose EFS One Zone to save money, the data lives in a single zone and does not survive its loss. And if what you need is a block disk for an instance, Amazon EBS cannot be shared across zones.

  • «file storage that grows and shrinks automatically, without provisioning capacity»

    EFS is elastic: you pay for what you store and do not have to reserve a size in advance.

    When not: If the data is read and written as objects over HTTP or an API (website images, a data lake), Amazon S3 is usually more suitable and cheaper. If you need an extreme-performance parallel file system for HPC, think of Amazon FSx for Lustre.

  • «reduce the cost of files that are rarely accessed, without changing the application»

    With lifecycle management, EFS automatically moves files that are not being used to the Infrequent Access or Archive classes; the application still sees them at the same path.

    When not: If the data is objects in a bucket, the equivalent tool is Amazon S3 lifecycle rules. And if cold files are read frequently and latency matters, it is best to have them return to Standard on first access.

  • «persistent, shared storage for Lambda functions or containers on Fargate»

    Both AWS Lambda and Amazon ECS (with EC2 or Fargate) can mount an EFS file system, and the data survives each invocation or task.

    When not: If you only need temporary space during execution, the service's own ephemeral storage is enough. If the data is stored as objects, Amazon S3 is the simplest option.

Often paired with

  • Amazon EC2
  • AWS Lambda
Study Amazon EFS →