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 AWS 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:
String
IpAddress:String
SecurityGroups:- String
SubnetId:String
Properties
FileSystemId
-
The ID of the file system for which to create the mount target.
Required: Yes
Type: String
Pattern:
^(arn:aws[-a-z]*:elasticfilesystem:[0-9a-z-:]+:file-system/fs-[0-9a-f]{8,40}|fs-[0-9a-f]{8,40})$
Maximum:
128
Update requires: Replacement
IpAddress
-
Valid IPv4 address within the address range of the specified subnet.
Required: No
Type: String
Pattern:
^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$
Minimum:
7
Maximum:
15
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: Array of String
Maximum:
100
Update requires: No interruption
SubnetId
-
The ID of the subnet to add the mount target in. For One Zone file systems, use the subnet that is associated with the file system's Availability Zone.
Required: Yes
Type: String
Pattern:
^subnet-[0-9a-f]{8,40}$
Minimum:
15
Maximum:
47
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the MountTarget ID. For example:
{"Ref":"logical_mount_target_id"}
returns
fsmt-0123456789abcdef8
.
For more information about using the Ref
function, see Ref
.
Fn::GetAtt
The Fn::GetAtt
intrinsic 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::GetAtt
intrinsic function, see Fn::GetAtt
.
Id
-
The ID of the Amazon EFS file system that the mount target provides access to.
Example:
fs-0123456789111222a
IpAddress
-
The IPv4 address of the mount target.
Example: 192.0.2.0
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"