Skip to content
GitHubXDiscordRSS

LocationEFS

Learn how to create, update, and manage AWS DataSync LocationEFSs using Alchemy Cloud Control.

The LocationEFS resource lets you manage AWS DataSync LocationEFSs for transferring data between AWS and on-premises environments using Amazon Elastic File System (EFS).

Create a basic EFS location with required properties and one optional property.

import AWS from "alchemy/aws/control";
const efsLocation = await AWS.DataSync.LocationEFS("myEfsLocation", {
EfsFilesystemArn: "arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-12345678",
Ec2Config: {
SecurityGroupArn: "arn:aws:ec2:us-west-2:123456789012:security-group/sg-12345678",
SubnetArn: "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-12345678"
},
Tags: [
{ Key: "Project", Value: "DataSync" },
{ Key: "Environment", Value: "Production" }
]
});

Configure an EFS location with additional optional settings, including access point and encryption.

const advancedEfsLocation = await AWS.DataSync.LocationEFS("advancedEfsLocation", {
EfsFilesystemArn: "arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-12345678",
Ec2Config: {
SecurityGroupArn: "arn:aws:ec2:us-west-2:123456789012:security-group/sg-12345678",
SubnetArn: "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-12345678"
},
AccessPointArn: "arn:aws:elasticfilesystem:us-west-2:123456789012:access-point/fsap-12345678",
Subdirectory: "/data",
InTransitEncryption: "ENABLED",
FileSystemAccessRoleArn: "arn:aws:iam::123456789012:role/DataSyncAccessRole",
Tags: [
{ Key: "Project", Value: "DataSync" },
{ Key: "Environment", Value: "Staging" }
]
});

Adopt an existing EFS location instead of failing if the resource already exists.

const adoptEfsLocation = await AWS.DataSync.LocationEFS("adoptEfsLocation", {
EfsFilesystemArn: "arn:aws:elasticfilesystem:us-west-2:123456789012:file-system/fs-12345678",
Ec2Config: {
SecurityGroupArn: "arn:aws:ec2:us-west-2:123456789012:security-group/sg-12345678",
SubnetArn: "arn:aws:ec2:us-west-2:123456789012:subnet/subnet-12345678"
},
adopt: true // Adopt the existing resource
});