To access an EFS file system in a VPC, you need to create mount targets for the file system.
For an EFS file system, the following is true:
-
You can create one mount target in each Availability Zone.
-
You can create mount targets for the file system in one VPC at a time. If you want to access the file system from another VPC,. you need to delete the mount targets from the current VPC and then create new mount targets in the other VPC. For more information, see Changing the mount target VPC.
-
If the VPC has multiple subnets in an Availability Zone, you can create a mount target in only one of those subnets. All EC2 instances in the Availability Zone can share the single mount target.
-
At a minimum, you should create a mount target in each Availability Zone from which you want to access the file system.
Note
We recommend that you create a mount target in each of the Availability Zones. There are
cost considerations for mounting a file system on an EC2 instance in an
Availability Zone through a mount target created in another Availability Zone. For more information,
see Amazon EFS Pricing
You can create mount targets for a file system by using the AWS Management Console, AWS CLI, or programmatically by using the AWS SDKs. In the console, you can create mount targets when you create the file system or after the file system is created. For instructions on creating mount targets when creating a file system, see Custom using the console.
Use the following procedure to add mount targets to an existing EFS file system.
To create a mount target on an EFS file system
Open the Amazon Elastic File System console at https://console.aws.amazon.com/efs/
. -
In the left navigation pane, choose File systems, and then select the file system for which you want to change the VPC.
-
Choose Network and then choose Manage to display the mount targets for the file system.
-
Choose the file system that you want to add mount targets for by choosing its Name or the File system ID.
Note
For One Zone file systems, you can only create a single mount target that is in the same Availability Zone as the file system.
-
To add a mount target, choose Add mount target. This option is available only for file systems that use EFS Regional storage classes, and if mount targets do not already exist in each Availability Zone for the AWS Region.
-
For each mount target that you want to create for the file system:
-
Choose Add mount target.
-
Choose the Availability Zone and subnet ID for the mount target.
-
Provide an IP address from the subnet where you are placing the mount target. If you omit a value, Amazon EFS selects an unused IP address from that subnet.
Note
You can't change the IP address of a mount target after it's created. To change an IP address, you need to delete the mount target and create a new one with the new address.
-
-
Choose Save.
Note
For One Zone file systems, you can only create a single mount target that is in the same Availability Zone as the file system.
To create a mount target (CLI)
-
To create a mount target, use the
create-mount-target
CLI command (corresponding operation is CreateMountTarget), as shown following.$
aws efs create-mount-target \ --file-system-idfile-system-id
\ --subnet-idsubnet-id
\ --security-groupID-of-the-security-group-created-for-mount-target
\ --regionaws-region
\ --profile adminuserThe following example shows the command with sample data.
$
aws efs create-mount-target \ --file-system-id fs-0123467 \ --subnet-id subnet-b3983dc4 \ --security-group sg-01234567 \ --region us-east-2 \ --profile adminuserAfter successfully creating the mount target, Amazon EFS returns the mount target description as JSON as shown in the following example.
{ "MountTargetId": "fsmt-f9a14450", "NetworkInterfaceId": "eni-3851ec4e", "FileSystemId": "fs-b6a0451f", "LifeCycleState": "available", "SubnetId": "subnet-b3983dc4", "OwnerId": "23124example", "IpAddress": "10.0.1.24" }