AWS::DataSync::LocationEFS - AWS CloudFormation


The AWS::DataSync::LocationEFS resource specifies an endpoint for an Amazon EFS location.


To declare this entity in your AWS CloudFormation template, use the following syntax:


{ "Type" : "AWS::DataSync::LocationEFS", "Properties" : { "Ec2Config" : Ec2Config, "EfsFilesystemArn" : String, "Subdirectory" : String, "Tags" : [ Tag, ... ] } }


Type: AWS::DataSync::LocationEFS Properties: Ec2Config: Ec2Config EfsFilesystemArn: String Subdirectory: String Tags: - Tag



The subnet and security group that the Amazon EFS file system uses. The security group that you provide needs to be able to communicate with the security group on the mount target in the subnet specified.

The exact relationship between security group M (of the mount target) and security group S (which you provide for DataSync to use at this stage) is as follows:

  • Security group M (which you associate with the mount target) must allow inbound access for the Transmission Control Protocol (TCP) on the NFS port (2049) from security group S. You can enable inbound connections either by IP address (CIDR range) or security group.

  • Security group S (provided to DataSync to access EFS) should have a rule that enables outbound connections to the NFS port on one of the file system’s mount targets. You can enable outbound connections either by IP address (CIDR range) or security group.

    For information about security groups and mount targets, see Security Groups for Amazon EC2 Instances and Mount Targets in the Amazon EFS User Guide.

Required: Yes

Type: Ec2Config

Update requires: Replacement


The Amazon Resource Name (ARN) for the Amazon EFS file system.

Required: Yes

Type: String

Maximum: 128

Pattern: ^arn:(aws|aws-cn|aws-us-gov|aws-iso|aws-iso-b):elasticfilesystem:[a-z\-0-9]*:[0-9]{12}:file-system/fs-.*$

Update requires: Replacement


A subdirectory in the location’s path. This subdirectory in the EFS file system is used to read data from the EFS source location or write data to the EFS destination. By default, AWS DataSync uses the root directory.


Subdirectory must be specified with forward slashes. For example, /path/to/folder.

Required: No

Type: String

Maximum: 4096

Pattern: ^[a-zA-Z0-9_\-\+\./\(\)\p{Zs}]*$

Update requires: Replacement


The key-value pair that represents a tag that you want to add to the resource. The value can be an empty string. This value helps you manage, filter, and search for your resources. We recommend that you create a name tag for your location.

Required: No

Type: List of Tag

Maximum: 50

Update requires: No interruption

Return values


When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the location resource ARN. For example:


For more information about using the Ref function, see Ref.


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.


The Amazon Resource Name (ARN) of the Amazon EFS file system.


The URL of the Amazon EFS file system.


Create an EFS location for DataSync

The following example specifies an EFS location to be used by DataSync, with the subdirectory MySubdirectory.


{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Specifies an EFS location for DataSync", "Resources": { "LocationEFS": { "Type": "AWS::DataSync::LocationEFS", "Properties": { "Ec2Config": { "SecurityGroupArns": [ "arn:aws:ec2:us-east-2:11122233344:security-group/sg-0117195988293d62f" ], "SubnetArn": "arn:aws:ec2:us-east-2:11122233344:subnet/subnet-f45a0e678" }, "EfsFilesystemArn": "arn:aws:elasticfilesystem:us-east-2:111222333444:file-system/fs-12345efs", "Subdirectory": "/MySubdirectory" } } }


AWSTemplateFormatVersion: 2010-09-09 Description: Specifies an EFS location for DataSync Resources: LocationEFS: Type: AWS::DataSync::LocationEFS Properties: Ec2Config: SecurityGroupArns: - arn:aws:ec2:us-east-2:11122233344:security-group/sg-0117195988293d62f SubnetArn: arn:aws:ec2:us-east-2:11122233344:subnet/subnet-f45a0e678 EfsFilesystemArn: arn:aws:elasticfilesystem:us-east-2:111222333444:file-system/fs-12345efs Subdirectory: /MySubdirectory