AWS::EFS::MountTarget
The AWS::EFS::MountTarget resource is an Amazon EFS resource that creates a mount target for an EFS
file system. You can then mount the file system on Amazon EC2 instances or other resources by using the mount target.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::EFS::MountTarget", "Properties" : { "FileSystemId" :String, "IpAddress" :String, "SecurityGroups" :[ String, ... ], "SubnetId" :String} }
YAML
Type: AWS::EFS::MountTarget Properties: FileSystemId:StringIpAddress:StringSecurityGroups:- StringSubnetId:String
Properties
FileSystemId-
The ID of the file system for which to create the mount target.
Required: Yes
Type: String
Maximum:
128Pattern:
^(arn:aws[-a-z]*:elasticfilesystem:[0-9a-z-:]+:file-system/fs-[0-9a-f]{8,40}|fs-[0-9a-f]{8,40})$Update requires: Replacement
IpAddress-
Valid IPv4 address within the address range of the specified subnet.
Required: No
Type: String
Minimum:
7Maximum:
15Pattern:
^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$Update requires: Replacement
SecurityGroups-
Up to five VPC security group IDs, of the form
sg-xxxxxxxx. These must be for the same VPC as subnet specified.Required: Yes
Type: List of String
Maximum:
100Update requires: No interruption
SubnetId-
The ID of the subnet to add the mount target in. For file systems that use One Zone storage classes, use the subnet that is associated with the file system's Availability Zone.
Required: Yes
Type: String
Minimum:
15Maximum:
47Pattern:
^subnet-[0-9a-f]{8,40}$Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Reffunction, Refreturns the MountTarget ID. For example:
{"Ref":"logical_mount_target_id"} returns
fsmt-0123456789abcdef8.
For more information about using the Reffunction, see Ref.
Fn::GetAtt
The Fn::GetAttintrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the Fn::GetAttintrinsic function, see Fn::GetAtt.
Examples
Declare a Mount Target for an EFS File System
The following example declares a mount target that is associated with a file system, subnet, and security group, which are all declared in the same template. EC2 instances that are in the same Availability Zone (AZ) as the mount target can use the mount target to connect to the associated file system. For information about mounting file systems on EC2 instances, see Mounting File Systems in the EFS User Guide.
JSON
"MountTarget": { "Type": "AWS::EFS::MountTarget", "Properties": { "FileSystemId": { "Ref": "FileSystem" }, "SubnetId": { "Ref": "Subnet" }, "SecurityGroups": [ { "Ref": "MountTargetSecurityGroup" } ] } }
YAML
MountTarget: Type: AWS::EFS::MountTarget Properties: FileSystemId: Ref: "FileSystem" SubnetId: Ref: "Subnet" SecurityGroups: - Ref: "MountTargetSecurityGroup"