
- Source: NFS server reachable from the source network (in this lab simulated in a separate VPC on AWS).
- Agent: DataSync agent running in the same network (EC2 in this lab) so it can mount the NFS export.
- Destination: Amazon S3 (or EFS) where DataSync will copy the files.
Servers and mounts
The lab supplies pre-deployed instances. The application server mounts the NFS export and reads/writes files that we will copy using DataSync.

df -h output (mounted at /mnt/data):
images folder with many JPEG files — these are the files we will migrate:
DataSync-KodeKloud (pre-created). The DataSync task will copy the images folder contents into this bucket.

- Find the latest DataSync AMI via SSM Parameter Store (run in CloudShell or any machine with AWS CLI configured). Replace the region with the region where the agent and source are reachable:
- Launch the EC2 agent
- Use the returned AMI ID to launch an instance (you can open the EC2 launch wizard pre-populated with the AMI):
https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-0abcdef1234567890 - For production throughput, DataSync recommends instance types such as
m5.2xlarge,m5.4xlarge, orc5n.2xlarge. For testing, smaller instances may suffice. This lab usedm5.2xlarge. - Choose key pair, VPC/subnet, and security group rules that allow the agent to reach:
- NFS server (TCP port 2049)
- Outbound HTTPS to DataSync service endpoints


Do not leave security groups open in production. Restrict inbound access to the DataSync agent (source network CIDRs) and only allow necessary outbound traffic (DataSync endpoints). Also limit SSH access to trusted IPs.
- Register the agent in the DataSync console
- Open the DataSync console and choose to create/register an agent.
- Select EC2 as the deployment type.
- If required, enable the public service endpoint.
- Click “Get key” and provide the agent’s public IP (or the private IP reachable by the console). The console will contact the agent and retrieve an activation key to complete registration.

- Create the NFS source location
- Location type: Network File System (NFS)
- Agent: select the registered agent
- NFS server:
10.11.12.182(lab example) - Mount path:
/media/data(the export containingimages)

- Create the S3 destination location
- Location type: Amazon S3
- Bucket:
DataSync-KodeKloud - Storage class: Standard (or choose a different storage tier)
- IAM role: auto-generate a role for DataSync (or select an existing role with appropriate S3 permissions)

- Source location: NFS
- Destination location: S3
- Task name: e.g.,
copy-NFS-to-S3 - Options:
- Verify data after transfer (recommended for integrity)
- Bandwidth limits to avoid saturating links
- Include/exclude filters to pick subfolders or filename patterns
- Transfer mode and metadata handling
- Enable CloudWatch logging and/or schedule recurring transfers

- Click “Start” (use defaults or override options).
- Monitor the task execution status: Launching → Transferring → Completed (or Failed).
- Execution details show metrics: files transferred, bytes transferred, throughput, and elapsed time.
images folder and JPG files should be present.

- Deploy the agent in the same network as your source file system and restrict network access via security groups and network ACLs.
- Choose agent EC2 instance sizes based on expected throughput (see DataSync documentation for guidance).
- Use lifecycle policies and appropriate S3 storage classes for long-term cost optimization.
- Monitor CloudWatch logs and metrics for transfer health and performance.
- For large or recurring migrations, consider scheduling tasks and tuning bandwidth limits to avoid impacting production networks.
For production: tighten security group rules to limit agent access, pick instance types based on throughput requirements (e.g.,
m5.2xlarge, m5.4xlarge, c5n.2xlarge for heavy workloads), and plan S3 lifecycle rules or storage classes to control long‑term costs.- Deploy a DataSync agent within the network that can access your source file system.
- Create DataSync locations for source (NFS) and destination (S3 or EFS).
- Create and run a task to define which data to transfer and how.
- Monitor executions and verify the destination after completion.
- AWS DataSync documentation: https://docs.aws.amazon.com/datasync/latest/userguide/what-is-datasync.html
- AWS Systems Manager Parameter Store: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
- AWS CloudShell: https://docs.aws.amazon.com/cloudshell/latest/userguide/what-is-cloudshell.html
- AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html