Can EC2 Mac instances mount Amazon EFS and Amazon FSx?
Yes, Amazon EC2 Mac instances can mount shared network storage from both Amazon Elastic File System and Amazon FSx. By using standard network file protocols built into macOS, such as Network File System and Server Message Block, EC2 Mac instances can connect to scalable shared storage across an Amazon Virtual Private Cloud. This capability allows development teams to share build artifacts, source code, media assets, and continuous integration caches across multiple macOS environments and other compute platforms without duplicating data on local Amazon Elastic Block Store volumes.
Supported Storage Services and Protocols
macOS includes native client support for the NFS (v3 and v4) and SMB protocols, enabling direct integration with several AWS storage services:
- Amazon EFS: Supports NFSv4.0 and NFSv4.1. EC2 Mac
instances can mount EFS file systems either through the standard macOS
mount_nfsutility or by installing theamazon-efs-utilspackage via Homebrew, which provides Transport Layer Security (TLS) encryption in transit and simplifies mounting by file system ID. - Amazon FSx for NetApp ONTAP: Supports both NFS (v3, v4.0, v4.1) and SMB protocols, making it suitable for multiprotocol environments where macOS, Linux, and Windows instances access the same datasets.
- Amazon FSx for OpenZFS: Supports NFS (v3, v4.0, v4.1), offering low-latency shared file storage for macOS build and test workloads.
- Amazon FSx for Windows File Server: Supports the SMB protocol, allowing EC2 Mac instances to connect to Active Directory-integrated shared folders alongside Windows workloads.
Note that Amazon FSx for Lustre does not provide a native macOS client and cannot be mounted directly on EC2 Mac instances.
Network and Security Prerequisites
Before mounting an Amazon EFS or Amazon FSx file system on an EC2 Mac instance, ensure the following network requirements are met:
- VPC Connectivity: The EC2 Mac instance and the storage mount target (or file system endpoint) must reside in the same VPC, or have routing configured via VPC peering or AWS Transit Gateway.
- Security Groups:
- For Amazon EFS and FSx over NFS,
the security group attached to the file system mount target must allow
inbound TCP traffic on port
2049from the EC2 Mac instance's security group or subnet CIDR. - For Amazon FSx over SMB, the file system's security
group must allow inbound TCP traffic on port
445from the EC2 Mac instance.
- For Amazon EFS and FSx over NFS,
the security group attached to the file system mount target must allow
inbound TCP traffic on port
- DNS Resolution: Enable DNS hostnames and DNS resolution in your VPC settings so the instance can resolve the file system's DNS name.
Mounting Amazon EFS on an EC2 Mac Instance
You can mount an Amazon EFS file system using either the native macOS
NFS client or the AWS-provided amazon-efs-utils mount
helper.
Option 1: Using the Native macOS NFS Client
Connect to your EC2 Mac instance via SSH or screen sharing and create a local mount point directory:
sudo mkdir -p /Volumes/efsMount the EFS file system using its DNS name or mount target IP address:
sudo mount -t nfs -o nfsvers=4.0,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-0123456789abcdef0.efs.us-east-1.amazonaws.com:/ /Volumes/efs
Option 2: Using amazon-efs-utils via Homebrew
If you require encryption in transit or IAM authorization, install
amazon-efs-utils:
Install the utility using Homebrew:
brew install amazon-efs-utilsMount the file system with TLS enabled:
sudo mount -t efs -o tls fs-0123456789abcdef0:/ /Volumes/efs
Mounting Amazon FSx on an EC2 Mac Instance
Mounting via NFS (FSx for NetApp ONTAP or FSx for OpenZFS)
Create a directory for the mount point:
sudo mkdir -p /Volumes/fsx-nfsRun the
mountcommand using the storage virtual machine (SVM) or file system DNS endpoint and junction path:sudo mount -t nfs -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,noresvport svm-0123456789abcdef0.fs-0123456789abcdef0.fsx.us-east-1.amazonaws.com:/vol1 /Volumes/fsx-nfs
Mounting via SMB (FSx for Windows File Server or FSx for NetApp ONTAP)
Create a local mount directory owned by the active macOS user:
mkdir -p ~/fsx-smbMount the SMB share using
mount_smbfs:mount_smbfs '//DOMAIN;username:password@amznfsx01234567.corp.example.com/share' ~/fsx-smb
Best Practices and Considerations for macOS
Use the
noresvportOption for NFS: When mounting NFS shares on macOS, always include thenoresvportmount option. This allows the macOS NFS client to use non-reserved source ports and ensures seamless reconnection if a network connection drops temporarily.Prevent Finder Metadata Overhead: By default, macOS creates
.DS_Storefiles on network volumes, which adds metadata IOPS overhead. Disable.DS_Storecreation on network volumes by running the following command and restarting the instance:defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUEConsider Workload I/O Patterns: Xcode builds that compile thousands of small intermediate files generate high metadata operations. While Amazon EFS and Amazon FSx work well for storing shared SDKs, Xcode archives, dependency caches, and media assets, placing active Xcode
DerivedDatadirectories on local Amazon EBS gp3 or io2 volumes alongside shared network storage often yields the best build performance.