Ravindra BagaleCourses & study guides मराठी Track your progress

AWS Cloud

What Is Amazon EFS? Shared File Storage vs EBS vs S3

EBS is a USB disk stuck to one laptop. S3 is a locker where you drop files by name. EFS is a shared office network drive — many EC2s open the same folders at once over NFS.

In this chapter

  • What EFS is and why shared files matter
  • EFS vs EBS vs S3 decision table
  • Performance and throughput modes (basics)
  • Cost shape and when not to use EFS

1. Everyday example

A WordPress site on two EC2s behind an ALB must share wp-content/uploads. EBS cannot attach read-write to two instances in normal setups. S3 needs code changes. EFS mounts like a normal Linux folder on both.

Amazon EFS (Elastic File System) is a managed NFSv4 file system. It grows and shrinks as you add or delete files. Multiple mounts across AZs are normal.

Shared uploadsUser uploadsphoto via ALBEC2-A or EC2-Bhandles requestBoth mountsame EFS pathFile visibleon every instance
Same idea for CMS, home dirs, and shared ML feature files.

2. EFS vs EBS vs S3

Choose storage by looking at how the program reads and writes. A block device such as EBS presents disk space to a server. The server usually formats and mounts it as a file system. EFS already provides a network file system that authorized clients can mount and use through familiar paths such as /shared/reports. S3 holds objects that programs get and put using bucket and key names.

Consider two servers preparing reports. If both need to update files through the same mounted folder, compare EFS. If one server needs a disk for its local database, compare EBS and check the database’s storage requirements. If the report is finished and clients download it by object key or link, consider private S3 storage. Moving a program between these types can require changing its access method, not just where you put the data.

Read the storage modes below after choosing the access method. Throughput is the rate of data moved. It is different from the amount of data stored and from latency, the time one operation takes.

NeedPickWhy
Boot disk / database data dir on one EC2EBSLow latency block storage
Many EC2s need POSIX files + locksEFSNFS shared file system
Images, backups, static website, data lakeS3Object storage; cheapest at scale
Lambda needs a shared /mnt libraryEFS + LambdaSupported mount for large deps

3. Modes you will hear in interviews

  • Regional file system (default): data stored across AZs — use this.
  • Performance: General Purpose (default) vs Max I/O (legacy large scale).
  • Throughput: Elastic adjusts to workload demand, Provisioned sets a capacity level, and Bursting varies with the file system’s storage size and available burst credits.
  • Storage classes: Standard and Infrequent Access (lifecycle).

Ravindra Bagale's Tip

EFS is wonderful for shared folders and painful as a high-IOPS database disk. Keep MySQL data on EBS or Aurora, not EFS.

4. Cost shape

You pay for GB stored and for some throughput modes. Idle empty file systems still have tiny charges; delete lab file systems. Cross-AZ mount traffic can add data-transfer cost — mount from the same AZ when you can.

5. Interview angles

Q. Protocol?

NFSv4.

Q. EBS multi-attach vs EFS?

EBS multi-attach is special/limited; EFS is made for many clients.

Q. S3 vs EFS for WordPress uploads?

S3 needs plugin/SDK; EFS is a plain mount.

Q. Can Lambda use EFS?

Yes — configure a mount path.

Q. Encryption?

In transit (TLS mount) and at rest (KMS).

Try at home

  1. List three apps that need EFS and three that should stay on S3.
  2. Do the next chapter lab: mount EFS on EC2.

In short

  1. EFS = shared NFS file system on AWS.
  2. EBS = disks; S3 = objects; EFS = shared folders.
  3. Great for CMS uploads and shared home dirs.
  4. Delete unused file systems.

Choose storage by what the program calls

Two Linux workers write shared path names with POSIX-style operations, a database needs a block device, and a site serves independent immutable objects. Match these respectively to EFS, EBS and S3. Before selecting EFS, verify throughput and access patterns against real requirements.

Interview check Why is S3 not simply shared EFS?

S3 clients use an object API with buckets and keys rather than mounting a conventional shared POSIX filesystem.

Reference documentation

Practise this chapter

Interview questions and answers

How do you choose storage for an application you have never seen?

I would ask whether it opens shared paths, needs a disk formatted by one server, or reads objects by a bucket and key. That gives an initial EFS, EBS or S3 choice. Then I would compare location, durability, performance and cost for the workload.

Check your understanding

Choose an answer, then compare your reasoning with the explanation.

0 of 3 answered correctly
1. Which storage fits two authorized Linux hosts using the same mounted report directory?

Answer and explanation

B. EFS mounted on both hosts

EFS provides a shared network file system. Independent disks do not share the application’s file updates.

2. What is an object key used for?

Answer and explanation

A. Naming an item in an S3 bucket

A key is the full name under which S3 stores and retrieves an object.

3. Which term denotes time taken by an individual operation?

Answer and explanation

B. Latency

Latency is how long an operation takes. Throughput measures data movement per unit of time.

Choose storage from the way an app accesses data

Before you start

  • Use these sample requirements. No AWS resources are needed.
  1. Read this requirement: two Linux report workers concurrently open a shared /reports directory. Note how the programs address their files and select a suitable storage model.

    Expected result: They use shared file paths. EFS is the candidate to evaluate; two separate local disks would not provide one shared directory.

  2. Read this requirement: one Linux VM’s test database expects a formatted block device. Match the need to a storage type and name the mount verification you would run.

    Expected result: EBS supplies the block device. Verify the identified device and the completed mount before writing database files.

  3. Read this requirement: a finished PDF is retrieved by bucket name and key. Name that storage type and how the access is different.

    Expected result: S3 provides object access. The application uses a service call or approved link rather than needing a shared mount.

If the result differs

  • If you selected the same service each time, highlight the words open a path, format a disk, and get by key. They describe different interfaces.

Finish and clean up

  • No cloud resources were created.

Practice Tasks

Practice checks run in your browser. They check the answer for this exercise; they do not create resources or connect to your AWS account.

About this scenario

Shivneri Schools is a education business in Junnar. Kavita Shinde looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 10

Easy How many addresses in a /16?

Picking a VPC size needs this count.

Shivneri Schools plans the VPC 10.64.0.0/16. How many IP addresses does it hold in total?

  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy Port for SSH

Security group rules need the right port.

Which TCP port must the security group open for SSH?

  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy Show where you are

Before you copy or delete anything, you must know which folder you are in.

Kavita Shinde logged in to the Shivneri Schools server and is not sure which folder the terminal is in. Print the current folder path.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Easy Read-only access to one bucket

Least privilege: give only the actions and the bucket the job needs.

Write an identity policy that lets the user read objects (s3:GetObject) only in bucket shivnerischool-data.

  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Easy List all files with details

Hidden files (like .env) and file sizes or owners only show with the right options.

Show a long listing of every file, including hidden ones, in /var/www/shivnerischool.

  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Create an EFS file system

EFS is shared storage that many servers can mount at once.

Create an encrypted EFS file system with creation token shivnerischool-shared.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Storage cost

Storage is billed per GB-month.

500 GB in S3 Standard at USD 0.023 per GB-month. Monthly cost in USD?

  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Medium Usable IPs in an AWS /24 subnet

AWS keeps 5 addresses in every subnet.

How many addresses can Shivneri Schools use for servers in subnet 10.64.1.0/24 on AWS?

  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Hard Create a mount target

Servers in a subnet reach EFS through a mount target in that AZ.

Create a mount target for fs-0abc1234 in subnet subnet-0103da55255dbb1 with security group sg-0103c655255c4c3b2.

  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Hard S3 lifecycle rule (JSON)

Old files move to cheaper storage automatically.

Write lifecycle JSON: one Enabled rule, prefix logs/, transition to GLACIER after 90 days.

  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.

Revision, comparison and interview cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Revision card: What is Amazon EFS?. Two EC2 web servers must see the same uploaded files. EBS attaches to one instance; S3 is object storage, not a classic file path. Amazon EFS is a managed NFS file system many EC2s (and some containers) can mount at once across AZs in a region. Create file system → mount targets in subnets → security group NFS 2049 → mount helper on Amazon Linux. echo hi > /mnt/efs/hello.txt on instance A; cat shows the same file on instance B.
Revision card: What is Amazon EFS? · Download PNG · Open card page
Revision card: When EFS wins vs EBS/S3. Wrong storage type breaks sharing or costs a fortune for the wrong access pattern. EBS: one instance block disk. EFS: shared POSIX files. S3: durable objects via API/SDK, not a drop-in /var/www. Shared CMS uploads, lift-and-shift NFS apps → EFS. Boot disks → EBS. Backups/static assets → S3. WordPress content directory on EFS across two web EC2s; AMI root still on EBS.
Revision card: When EFS wins vs EBS/S3 · Download PNG · Open card page
Revision card: EFS performance modes. Default settings are fine for labs; production needs the right throughput mode. General Purpose is the usual latency-sensitive default. Max I/O is for highly parallel scale. Throughput can be bursting or provisioned/elastic depending on config era. For class labs keep General Purpose and clean up the file system after the mount test. A student mount of a tiny hello.txt does not need Max I/O or provisioned TB.
Revision card: EFS performance modes · Download PNG · Open card page
Comparison: Amazon EFS vs Amazon EBS. Amazon EFS: NFS file system many instances can mount across AZs. Amazon EBS: Block volume typically attached to one instance.
Comparison: Amazon EFS vs Amazon EBS · Download PNG · Open card page
Comparison: Amazon EFS vs Amazon S3. Amazon EFS: POSIX file paths over NFS. Amazon S3: Object API (SDK/CLI/HTTP), not a drop-in filesystem.
Comparison: Amazon EFS vs Amazon S3 · Download PNG · Open card page
Interview card: Can multiple EC2s mount one EFS?. Yes — that is the point of EFS (NFS shared file system across AZs in the region). EBS volumes attach to one instance (with multi-attach only for special io2 cases). Create mount targets in each subnet/AZ; mount the same fs-id on every web EC2.
Interview card: Can multiple EC2s mount one EFS? · Download PNG · Open card page
Interview card: Why not S3 for /var/www files?. S3 is object storage via API; many legacy apps expect POSIX file paths and locking. EFS gives NFS paths; S3 shines for durable objects, static websites, and data lakes. Shared CMS uploads → EFS; static assets/CDN → S3 (+ CloudFront).
Interview card: Why not S3 for /var/www files? · Download PNG · Open card page

More cards: Ravi Sir's Cards.