liveBook · Manning

EFS storage

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

Amazon EFS is a managed elastic network file system that provides shared file storage accessible by multiple compute resources.

Amazon Elastic File System (EFS) is a network filesystem that multiple Linux EC2 instances can mount and use at the same time. It speaks NFSv4.1 and grows as files are added, so you do not provision storage capacity up front. EFS replicates data across availability zones within an AWS region. section 9.0 section 9.1

A load-balanced WordPress site shows why shared files matter: either web server may handle a request, but both need access to application files and user uploads. EFS supplies that shared filesystem; RDS stores the MySQL database. Unlike EFS, an EBS volume is tied to one availability zone and normally attached to one EC2 instance. section 2.1 section 2.2.4 section 9.0

To share files across EC2 instances:

  • Create an EFS filesystem and mount targets. Use mount targets in two availability zones for fault tolerance; protect them with security groups. section 9.1 section 9.7
  • On each Linux instance, install the EFS mount helper and mount the filesystem at a local directory. The filesystem’s DNS name resolves to the mount target for the instance’s subnet. section 9.3
  • Use the mount options tls for encrypted transport and iam for authentication through the instance’s IAM role. Configure /etc/fstab if the filesystem should mount on startup. section 9.3

Mount a shared home directory

On Amazon Linux 2, run `sudo yum install amazon-efs-utils`, then `sudo mount -t efs -o tls,iam fs-123456 /home`, replacing the example filesystem ID. Before mounting an initially empty filesystem over an existing `/home`, copy any files that must remain available. Mount it on a second instance and create a file on one machine; seeing that file on the other confirms they share the directory. section 9.3 section 9.4

Figure 9.2 Mount targets provide an endpoint for EC2 instances to mount the filesystem in a subnet.

Mount targets are the subnet endpoints through which EC2 instances reach the shared filesystem. section 9.0

Plan for workload and operating costs. Bursting throughput suits short periods of heavier I/O; provisioned throughput is an option for consistently high demand and incurs an additional charge. General Purpose and Max I/O performance modes serve different file-access patterns. Monitor throughput and burst credits, and use AWS Backup to create and restore filesystem snapshots. EFS is not supported by Windows EC2 instances in this setup. section 9.5.2 section 9.7 section 9.0

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Works through filesystem creation, mount targets, mounting, file-sharing verification, throughput choices, monitoring, and backups.
Examples
Uses shared WordPress files, a two-instance home directory test, and Jenkins state stored at /var/lib/jenkins.
What it assumes
Assumes familiarity with EC2 instances and subnets while showing mount-helper installation and filesystem mounting.
What you can do after
Operate/configure it by mounting one filesystem on multiple EC2 instances and choosing security, availability, throughput, and backup settings.
How it connects
Relates EFS to EC2, availability zones, security groups, IAM, TLS, CloudWatch, AWS Backup, EBS, and S3.

Also explained in

Compare how 2 books explain EFS storage →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.