- A VPC with at least two subnets in different Availability Zones (this demo uses
us-east-1aandus-east-1b). - Two EC2 instances (one in each subnet/AZ) with a security group you control.
- Appropriate IAM and console access to create EFS resources.
Create the EFS file system
From the EFS console choose the “Customize” option so you can review and set details. Key options to consider:- Name: e.g., “EFS demo”
- Storage class: Multi-AZ (redundant across AZs) or One Zone (single AZ)
- Automatic backups: optional — enable if you want automated backups
- Lifecycle management: transition to Infrequently Accessed (IA) after a defined age (e.g., 30 days) to reduce costs
- Encryption: enable encryption at rest if required
- Throughput & performance modes: choose
ElasticvsProvisionedthroughput andGeneral PurposevsMax I/Obased on workload
Choose the VPC that contains your EC2 instances. EFS will create mount targets in the selected subnets—create mount targets in each AZ you plan to access the file system from to ensure redundancy.
When configuring mount targets, select a security group that allows the EC2 instances to reach the EFS mount targets.

Available. Note the file system ID (e.g., fs-08de7b8e04f984697) — you will use it when mounting.

Security group for EFS
Create or select a security group for the EFS mount targets that allows inbound NFS (TCP port 2049) from the EC2 instances’ security group. Restrict the source to the EC2 instances’ security group for better security. Example rule to add to the EFS mount target security group:
If you inspect or create the security group in the EC2 console, you should see the inbound rule allowing port
2049 from the EC2 security group.

Mount the EFS on EC2 instances
Perform the following steps on each EC2 instance that will access the EFS. Commands below assume Amazon Linux 2; adjust package manager commands for other distributions (for example, usednf on some Fedora/RHEL derivatives).
- Create a mount point directory:
- Install the EFS mount helper (
amazon-efs-utils):
- Mount the EFS using the mount helper. Replace the file system ID with your own (example uses
fs-08de7b8e04f984697):
- Verify the mount:
- Verify read/write access across instances:
file2 appear. This confirms simultaneous read/write access from multiple EC2 instances.
Persist mounts across reboots
To make the EFS mount persistent, add an entry to/etc/fstab using the recommended EFS options. Example /etc/fstab line (replace the FS ID and mount point):
When editing
/etc/fstab, verify the entry before rebooting to avoid boot issues. Test the new entry without rebooting using sudo mount -a and confirm the mount succeeds.Troubleshooting tips
- If mounts fail, confirm:
- Mount targets exist in the AZs of your EC2 instances.
- The EFS mount target security group allows inbound
TCP/2049from the EC2 instances’ security group. - Network ACLs and route tables allow traffic between instances and the mount targets.
- Use
sudo journalctl -u amazon-efs-mount-watchdog(if available) anddmesgfor mount helper logs. - Confirm DNS resolution for the EFS endpoint:
nslookup fs-08de7b8e04f984697.efs.<region>.amazonaws.com.
Summary
- Create an EFS file system and ensure mount targets exist in the Availability Zones of your EC2 instances.
- Configure a security group for EFS that allows inbound
TCP/2049from the EC2 instances’ security group and restrict access where possible. - Install
amazon-efs-utilson each instance, mount the file system, and verify read/write access from multiple servers. - Make the mount persistent by adding the recommended
/etc/fstabentry and test withsudo mount -a.
Links and References
- Amazon EFS documentation: https://docs.aws.amazon.com/efs/
- Amazon EC2 security groups: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html
- amazon-efs-utils GitHub: https://github.com/aws/efs-utils