Amazon Elastic File System (EFS)

Amazon Elastic File System provides scalable, persistent file storage for use with EC2. One of the main difference between EBS and EFS is that EFS can be used by multiple EC2 instances at the same time (1 to 1000 from different AZ). It is accessible to operating system by Network File System version 4 protocol (NFSv4.1 and NFSv4.0). Storage capacity is growing and shrinking automatically and you pay only for space that you actually use. EFS file systems store data and metadata across multiple Availability Zones in an Region, providing a common data source for workloads and applications running on more than one instance. Big Data and analytics workloads, media processing workflows, content management and web serving are examples of these applications.

Performance and throughput

You can choose from two performance modes and two throughput modes.

Performance modes:

  • General Purpose performance mode is appropriate for most file systems, and is the mode selected by default.
  • Max I/O performance mode is optimized for applications where tens, hundreds, or thousands of EC2 instances are accessing the file system — it scales to higher levels of aggregate throughput and operations per second with a tradeoff of slightly higher latencies for file operations. You can use it with no additional costs.

Throughput modes:

  • Bursting Throughput mode, where throughput on EFS scales as a file system grows. File-based workloads are typically spiky, driving high levels of throughput for short periods of time, and low levels of throughput the rest of the time. To accommodate this, EFS is designed to burst to high throughput levels for periods of time. All file systems deliver a consistent baseline performance of 50 MB/s per TB of storage and can burst to 100 MB/s, regardless the size. File systems larger than 1TB can burst up to 100 MB/s per TB.
  • Provisioned Throughput mode enables to provision throughput independent of the amount of data stored. In this mode, you are billed for storage you use and throughput you provisioned independently.
EFS configuration screen

Encryption

EFS supports two forms of encryption for file systems, encryption of data in transit and encryption at rest. You can enable encryption of data at rest when creating an EFS file system. For encryption of data in transit you have to mount the file system with Transport Layer Security (TLS) option:

sudo mount -t efs -o tls fs-EFSSYSTEMID:/ /mnt/efs

Mounting

To access your EFS file system, you have to create one or more mount targets in your VPC. A mount target provides an IP address for an NFSv4 endpoint. You mount your file system using its DNS name, which will resolve to the IP address of the EFS mount target in the same Availability Zone as your EC2 instance. You can create one mount target in each Availability Zone in a Region. If there are multiple subnets in an Availability Zone in your VPC, you create a mount target in one of the subnets, and all EC2 instances in that Availability Zone share that mount target. You can mount an Amazon EFS file system on instances in only one VPC at a time.

Mount targets themselves are designed to be highly available. When designing your application for high availability and the ability to failover to other Availability Zones, keep in mind that the IP addresses and DNS for your mount targets in each Availability Zone are static.

VPC accessing an EFS file system
Source: https://docs.aws.amazon.com/efs/latest/ug/how-it-works.html

Consistency

EFS provides the open-after-close consistency semantics that applications expect from NFS. Write operations will be durably stored across Availability Zones when:

  • An application performs a synchronous write operation (for example, using the open Linux command with the O_DIRECT flag, or the fsync command).
  • An application closes a file.

EFS provides stronger consistency guarantees than open-after-close semantics depending on the access pattern. Applications that perform synchronous data access and perform non-appending writes will have read-after-write consistency for data access.

Reference Materials

AWS EFS documentation

Comments 1

Leave a Reply