Guide · AWS DataSync · Amazon FSx
AWS DataSync with FSx for MCP Servers — Lustre, Windows, ONTAP, and OpenZFS Location Types
Amazon FSx offers four file system engines, and AWS DataSync has a dedicated location type for each: CreateLocationFsxLustreCommand, CreateLocationFsxWindowsCommand, CreateLocationFsxOntapCommand, and CreateLocationFsxOpenZfsCommand. Each location type has different required parameters, security group port requirements, and credential models. This guide covers the exact parameters for all four, the right choice between DataSync and FSx native replication for each variant, and common migration scenarios MCP server teams encounter when moving from on-premises storage to FSx.
TL;DR
Use DataSync for one-time migrations to FSx (from on-premises or cross-account). For ongoing replication, prefer the native tool for each variant: FSx for Lustre uses Data Repository Associations for S3 sync; FSx for ONTAP uses SnapMirror for cross-region DR; FSx for Windows uses DFS Replication or native Windows replication. DataSync is not a continuous replication tool — it is a scheduled job runner. The choice between DataSync and native replication is therefore "one-time migration" vs "ongoing sync".
Quick reference: DataSync location command per FSx variant
| FSx Variant | DataSync location command | Protocol used by DataSync | Credential required | Ports needed (client SG outbound) |
|---|---|---|---|---|
| FSx for Lustre | CreateLocationFsxLustreCommand |
Lustre LNET | None (network access only) | TCP/UDP 988, TCP 1018–1023 |
| FSx for Windows | CreateLocationFsxWindowsCommand |
SMB v2 / v3 | AD domain user + password (or AD service account) | TCP 445 |
| FSx for ONTAP | CreateLocationFsxOntapCommand |
NFS v3/4.1 or SMB | ONTAP export policy (NFS) or AD credentials (SMB) | TCP 2049 (NFS) or TCP 445 (SMB) |
| FSx for OpenZFS | CreateLocationFsxOpenZfsCommand |
NFS v3 or v4.1 | None (NFS export policy) | TCP 2049 |
FSx for Lustre: CreateLocationFsxLustreCommand
FSx for Lustre uses the Lustre LNET protocol, not NFS. DataSync requires ports 988 and 1018–1023, plus the Lustre SG must have a self-referencing inbound rule.
import {
DataSyncClient,
CreateLocationFsxLustreCommand,
} from "@aws-sdk/client-datasync";
const datasync = new DataSyncClient({ region: "us-east-1" });
const lustreLoc = await datasync.send(new CreateLocationFsxLustreCommand({
// Required: FSx Lustre file system ARN
FsxFilesystemArn:
"arn:aws:fsx:us-east-1:123456789012:file-system/fs-lustre-0abc123",
// Required: security group for DataSync ENI
// Must have outbound TCP/UDP 988 and TCP 1018-1023 to the Lustre SG
SecurityGroupArns: [
"arn:aws:ec2:us-east-1:123456789012:security-group/sg-datasync-lustre",
],
// Optional: path within the Lustre file system (default: /)
Subdirectory: "/mcp-models/",
}));
The Lustre security group (sg-fsx-lustre) requires a self-referencing inbound rule on ports 988 and 1018–1023 — Lustre metadata servers communicate with each other on these ports. If this rule is missing, the Lustre file system will not function at all, not just for DataSync.
When to use DataSync with Lustre vs Data Repository Associations
FSx for Lustre has a native S3 integration called Data Repository Associations (DRA) that uses lazy import — file metadata is immediately visible, data is fetched from S3 on first read. For ongoing S3 ↔ Lustre sync, DRA is better: it is event-driven, has lower latency, and does not require a separate DataSync task.
Use DataSync for Lustre when:
- You are migrating from an on-premises Lustre cluster or NFS server to FSx for Lustre — DRA only speaks to S3, not to arbitrary file servers.
- You need a cross-account copy of a Lustre file system (DRA cannot pull from another account's S3 bucket without complex cross-account S3 configuration).
- You need to pre-load all data onto Lustre before first access, eliminating lazy-import latency for the first read of each file — DataSync writes all bytes eagerly, while DRA defers the actual data fetch.
FSx for Windows: CreateLocationFsxWindowsCommand
FSx for Windows uses SMB and requires Active Directory credentials. The AD domain must be accessible from the VPC where DataSync creates its ENI.
import { CreateLocationFsxWindowsCommand } from "@aws-sdk/client-datasync";
const windowsLoc = await datasync.send(new CreateLocationFsxWindowsCommand({
// Required: FSx Windows file system ARN
FsxFilesystemArn:
"arn:aws:fsx:us-east-1:123456789012:file-system/fs-windows-0def456",
// Required: AD domain that the FSx file system is joined to
Domain: "corp.example.internal",
// Required: AD user with access to the FSx share
User: "datasync-svc",
Password: "s3cr3tP@ssword!", // See note below on secrets management
// Required: security groups for the DataSync ENI
// Must have outbound TCP 445 (SMB) to the FSx Windows SG
SecurityGroupArns: [
"arn:aws:ec2:us-east-1:123456789012:security-group/sg-datasync-windows",
],
// Optional: SMB share subdirectory on the FSx file system
Subdirectory: "\\mcp-tools\\models",
}));
Important: Password is passed as plaintext in the API call as of 2026. It is encrypted at rest in the DataSync service, but you must handle it carefully in your MCP tool — do not log the CreateLocationFsxWindowsCommand input object directly. Retrieve the password from Secrets Manager at runtime:
import { SecretsManagerClient, GetSecretValueCommand } from "@aws-sdk/client-secrets-manager";
const sm = new SecretsManagerClient({ region: "us-east-1" });
const secret = await sm.send(new GetSecretValueCommand({
SecretId: "datasync/fsx-windows-svc-account",
}));
const { User, Password, Domain } = JSON.parse(secret.SecretString!);
await datasync.send(new CreateLocationFsxWindowsCommand({
FsxFilesystemArn: "...",
Domain,
User,
Password,
SecurityGroupArns: ["..."],
}));
SMB share path format
The Subdirectory for Windows locations uses Windows path separator \\ (backslash), not Unix /. The root of the file system is \\. A specific share is \\share-name (without the full UNC path — DataSync prepends the FSx DNS name automatically). If you omit Subdirectory, DataSync accesses the root of the default share.
FSx for ONTAP: CreateLocationFsxOntapCommand
ONTAP is unique in that it has Storage Virtual Machines (SVMs) and Volumes as addressable resources. DataSync requires the SVM ARN and Volume ARN in addition to the file system ARN.
import { CreateLocationFsxOntapCommand } from "@aws-sdk/client-datasync";
// NFS protocol variant (recommended for Linux-based MCP server migrations)
const ontapNfsLoc = await datasync.send(new CreateLocationFsxOntapCommand({
// Required: FSx ONTAP file system ARN
FsxFilesystemArn:
"arn:aws:fsx:us-east-1:123456789012:file-system/fs-ontap-0ghi789",
// Required: SVM ARN within that file system
StorageVirtualMachineArn:
"arn:aws:fsx:us-east-1:123456789012:storage-virtual-machine/fs-ontap-0ghi789/svm-0jkl012",
// Required: Volume ARN within that SVM
FsxVolumeArn:
"arn:aws:fsx:us-east-1:123456789012:volume/fs-ontap-0ghi789/fsvol-0mno345",
// Required: security groups for DataSync ENI
SecurityGroupArns: [
"arn:aws:ec2:us-east-1:123456789012:security-group/sg-datasync-ontap",
],
// Required: protocol configuration
Protocol: {
// Use NFS for POSIX-compatible MCP server workflows
NFS: {
MountOptions: { Version: "NFS4_1" },
},
// Or use SMB for Windows-based workflows:
// SMB: {
// Domain: "corp.example.internal",
// User: "datasync-svc",
// Password: "...",
// MountOptions: { Version: "SMB3" },
// },
},
// Optional: path within the volume
Subdirectory: "/mcp-data/",
}));
For NFS access to ONTAP, the volume's export policy must include the DataSync ENI's IP range. ONTAP export policies are managed via the ONTAP REST API or CLI (vserver export-policy rule create) — DataSync cannot modify them automatically. Add the CIDR of the DataSync ENI subnet to the export policy before running the task.
DataSync vs SnapMirror for ONTAP
FSx for ONTAP includes SnapMirror — NetApp's block-level replication that runs continuously at RPO <15 minutes and can replicate between FSx ONTAP file systems across regions. For disaster recovery, SnapMirror is superior to DataSync because:
- SnapMirror replicates at the volume level (block-level), not file-level — faster for large binary files
- SnapMirror runs continuously; DataSync runs on a schedule
- SnapMirror can replicate read-only snapshots; DataSync only transfers visible files
Use DataSync with ONTAP when migrating from a non-ONTAP source (on-premises NFS server, EFS, another cloud provider) to FSx for ONTAP. Use SnapMirror when you need ONTAP-to-ONTAP replication for DR.
FSx for OpenZFS: CreateLocationFsxOpenZfsCommand
OpenZFS uses NFS — the simplest FSx DataSync location to configure. No AD credentials, no ONTAP SVM/Volume ARNs. Just the file system ARN, security groups, and an NFS mount path.
import { CreateLocationFsxOpenZfsCommand } from "@aws-sdk/client-datasync";
const openZfsLoc = await datasync.send(new CreateLocationFsxOpenZfsCommand({
// Required: FSx OpenZFS file system ARN
FsxFilesystemArn:
"arn:aws:fsx:us-east-1:123456789012:file-system/fs-openzfs-0pqr678",
// Required: security groups for the DataSync ENI
// Must have outbound TCP 2049 (NFS) to the FSx OpenZFS SG
SecurityGroupArns: [
"arn:aws:ec2:us-east-1:123456789012:security-group/sg-datasync-openzfs",
],
// Required: protocol configuration
Protocol: {
NFS: {
MountOptions: {
// NFS4_1 is preferred; NFS3 may be needed for older clients
Version: "NFS4_1",
},
},
},
// Optional: subdirectory within the OpenZFS volume
Subdirectory: "/mcp-cache/",
}));
Unlike EFS (where DataSync creates its own ENI), for FSx OpenZFS the DataSync agent mounts the NFS export directly. The OpenZFS NFS export settings must allow the DataSync agent's source IP. By default, FSx for OpenZFS creates an NFS export at / that allows access from the VPC CIDR — this usually works without additional configuration.
DataSync vs OpenZFS native snapshots and clones
FSx for OpenZFS's primary advantage over EFS is instant snapshots and writable clones. DataSync does not create snapshots — it transfers files. For cross-AZ data protection, the right tools are:
- Snapshots — use
CreateSnapshotCommand(from@aws-sdk/client-fsx) to create ZFS snapshots on a schedule - Cross-region copy — use DataSync to copy from FSx OpenZFS in one region to EFS or S3 in another region (OpenZFS does not have native cross-region replication as of 2026)
- Dev/test clones — use
CreateVolumeCommandwithOriginSnapshotto create writable clones from snapshots without DataSync
Choosing: DataSync vs native FSx replication
| FSx Variant | Use DataSync when | Use native replication when |
|---|---|---|
| FSx for Lustre | Migrating from on-premises NFS or non-S3 source; pre-loading all data before first access; cross-account copies | Ongoing S3↔Lustre sync → use Data Repository Associations (DRA) for event-driven lazy import |
| FSx for Windows | Migrating from on-premises Windows file server; one-time cross-account FSx Windows copy | Ongoing Windows file replication → use DFS Replication (DFS-R) or Windows Server Replication |
| FSx for ONTAP | Migrating from non-ONTAP source (NFS server, EFS, other cloud NFS); one-time cross-account volume copy | Ongoing DR replication → use SnapMirror (supports ONTAP→ONTAP cross-region, RPO <15 min) |
| FSx for OpenZFS | Migrating from EFS or on-premises NFS; cross-region backup to S3 or another EFS | Point-in-time backups → use OpenZFS snapshots directly; AWS Backup for schedule management |
Migration pattern: on-premises NFS → FSx for Lustre (pre-loading models)
This is the most common FSx + DataSync pattern for MCP server teams: you have an on-premises NFS share with large model files, and you need them in FSx for Lustre before your GPU ECS tasks start.
import {
DataSyncClient,
CreateAgentCommand,
CreateLocationNfsCommand,
CreateLocationFsxLustreCommand,
CreateTaskCommand,
StartTaskExecutionCommand,
DescribeTaskExecutionCommand,
} from "@aws-sdk/client-datasync";
const datasync = new DataSyncClient({ region: "us-east-1" });
// 1. Register the on-premises DataSync agent (agent already deployed and activated)
const agent = await datasync.send(new CreateAgentCommand({
ActivationKey: "AAAA1-BBBBB-2CCCCC-3DDDDD-EEEEE",
AgentName: "on-prem-nfs-agent",
}));
// 2. Create NFS source location pointing to on-premises model server
const nfsLoc = await datasync.send(new CreateLocationNfsCommand({
ServerHostname: "nfs-models.corp.example.com",
Subdirectory: "/exports/llm-models/",
OnPremConfig: { AgentArns: [agent.AgentArn] },
MountOptions: { Version: "NFS4_1" },
}));
// 3. Create FSx Lustre destination location
const lustreLoc = await datasync.send(new CreateLocationFsxLustreCommand({
FsxFilesystemArn:
"arn:aws:fsx:us-east-1:123456789012:file-system/fs-0abc123",
SecurityGroupArns: ["arn:aws:ec2:us-east-1:123456789012:security-group/sg-datasync-lustre"],
Subdirectory: "/models/",
}));
// 4. Create migration task with no bandwidth cap (run once, off-hours)
const task = await datasync.send(new CreateTaskCommand({
SourceLocationArn: nfsLoc.LocationArn,
DestinationLocationArn: lustreLoc.LocationArn,
Name: "on-prem-nfs-to-fsx-lustre-migration",
Options: {
VerifyMode: "ONLY_FILES_TRANSFERRED",
OverwriteMode: "ALWAYS",
Mtime: "PRESERVE",
Uid: "INT_VALUE",
Gid: "INT_VALUE",
PosixPermissions: "PRESERVE",
BytesPerSecond: -1, // unlimited
TaskQueueing: "ENABLED",
LogLevel: "BASIC",
},
CloudWatchLogGroupArn:
"arn:aws:logs:us-east-1:123456789012:log-group:/datasync/lustre-migration",
}));
// 5. Start and poll
const exec = await datasync.send(new StartTaskExecutionCommand({
TaskArn: task.TaskArn,
}));
let status = "";
do {
await new Promise(r => setTimeout(r, 30_000));
const result = await datasync.send(new DescribeTaskExecutionCommand({
TaskExecutionArn: exec.TaskExecutionArn,
}));
status = result.Status!;
console.log(`status=${status} bytes=${result.BytesTransferred}`);
} while (status !== "SUCCESS" && status !== "ERROR");
Common DataSync + FSx errors and fixes
| Error / symptom | FSx variant | Cause | Fix |
|---|---|---|---|
Execution hangs in LAUNCHING then CANNOT_CONNECT |
Lustre | Missing outbound TCP/UDP 988 or TCP 1018–1023 from DataSync SG to Lustre SG; or Lustre SG missing self-referencing inbound rule | Add outbound rules; ensure Lustre SG self-referencing rule exists on ports 988 + 1018–1023 |
InvalidRequestException: User authentication failed |
Windows | AD credentials incorrect, or the AD domain is not reachable from the DataSync ENI subnet (DNS resolution failure) | Verify AD credentials; ensure the DataSync ENI subnet can resolve the AD domain via its DNS servers; check outbound TCP/UDP 389 (LDAP) and 88 (Kerberos) to AD DCs |
InvalidRequestException: StorageVirtualMachineArn not found |
ONTAP | Wrong SVM ARN format — common mistake is using the file system ID instead of the full SVM ARN | Get the correct SVM ARN from fsx describe-storage-virtual-machines --file-system-id fs-xxx; format is arn:aws:fsx:region:account:storage-virtual-machine/fs-xxx/svm-yyy |
| Files transferred to ONTAP with wrong ownership | ONTAP (NFS) | ONTAP export policy using root squashing (anon=65534) overrides UID/GID values from DataSync |
Modify ONTAP export policy rule to set anon=0 (allow root UID to pass through) for the DataSync subnet during migration, then restore root squashing after |
OpenZFS task fails with Permission denied at destination root |
OpenZFS | OpenZFS NFS export policy does not include the DataSync agent's source IP or the subnet CIDR | Update the OpenZFS NFS export via fsx update-file-system --open-zfs-configuration to include the DataSync subnet CIDR in the export's client list |
Related guides
- AWS DataSync overview: tasks, locations, and execution lifecycle
- DataSync with S3: storage classes, filter patterns, and cross-account copies
- DataSync with EFS: on-premises NFS migration and cross-region replication
- Amazon FSx for MCP Servers: choosing between Lustre, OpenZFS, ONTAP, and Windows
- FSx for Lustre: high-performance ML model loading and S3 data repositories
- FSx for ONTAP: multi-protocol NFS+SMB and SnapMirror cross-region replication
- MCP server uptime monitoring