Overview and What You Will Learn
AWS has a specialised service for each storage problem that S3, EBS and EFS do not cover. Use FSx for Windows shares and high-performance file systems, Storage Gateway to extend on-premises storage into AWS, Snowball for one-time bulk moves, DataSync for scheduled online transfers, and Transfer Family for SFTP.
In this lab, you will:
- Run a verified DataSync transfer between two S3 buckets with the AWS CLI
- Review the FSx file system options in the console without creating anything
- Optionally mount an S3 File Gateway and see a file appear in S3
- Clean up the roles, tasks and buckets you created
Why This Matters in Production
Picture a media company with a 200 TB video archive on-premises. Over a 100 Mbps link, sending it takes about 185 days (200,000 GB x 8 bits / 100 Mbps, which is roughly 16 million seconds), while a Snowball device does the bulk move in about a week. A financial services firm with Windows servers has a different problem: EFS is NFS and Linux-only, so they need an SMB share that works with Active Directory, which is exactly what FSx for Windows provides. Choosing the right service is what separates knowing one tool from knowing the right one.
Core Principles
How to Pick the Right Service
Start with what you are trying to do, then match it to the service.
Amazon FSx: Four Managed File Systems
EFS covers Linux NFS, and FSx covers the rest. Each of the four flavours targets a different workload.
| Need | Use |
|---|---|
| Windows SMB with Active Directory | FSx for Windows File Server |
| ML training or HPC at extreme throughput | FSx for Lustre |
| Migrating NetApp from on-premises | FSx for NetApp ONTAP |
| Migrating ZFS workloads | FSx for OpenZFS |
FSx for Windows File Server is a fully managed NTFS file system over SMB. It integrates with Active Directory, supports Multi-AZ, shadow copies and DFS namespaces, and gives windows applications the same experience as an on-premises file server.
FSx for Lustre is managed Lustre, built for sub-millisecond latency and very high throughput. It links to an S3 bucket: data loads on demand as files are read, and results can be written back to S3. Scratch deployments are cheaper and temporary, while persistent deployments replicate within an AZ for longer jobs.
TipKeep training data in S3 for cheap durability, and put FSx for Lustre in front of it only while the training job runs. You pay for Lustre for the duration of the job, not the lifetime of the dataset.
FSx for NetApp ONTAP serves NFS, SMB and iSCSI at once, with SnapMirror replication from on-premises ONTAP. FSx for OpenZFS gives Linux workloads native ZFS snapshots, cloning and compression.
AWS Storage Gateway: On-Premises Meets AWS
Storage Gateway runs as a virtual machine or appliance on-premises, speaks standard protocols to your servers, and stores the data in AWS. The three types match three on-premises storage patterns.
| Gateway | On-premises sees | Data lands in |
|---|---|---|
| File Gateway | NFS or SMB file share | S3 objects |
| Volume Gateway | iSCSI block volume | S3, with EBS snapshots |
| Tape Gateway | Virtual tape library | S3 Glacier |
RememberStorage Gateway runs on-premises but stores data in AWS. Frequently used data is cached locally, so applications keep low latency.
AWS Snowball: Physical Data Transfer
Snowball is a ruggedised device that AWS ships to you. You copy data onto it at local disk speed, ship it back, and AWS loads it into S3. Snowball Edge adds compute, so Lambda and EC2 can run on the device at remote sites such as ships or oil rigs, with OpsHub as the graphical management tool.
RememberSnowball is for the one-time bulk move, measured in days. For continuous or scheduled transfer use DataSync or Direct Connect. AWS has been changing which Snowball devices are available to new customers, so confirm availability for your account and Region before you plan around it.
AWS DataSync: Automated Online Transfer
DataSync moves data between on-premises storage and S3, EFS or FSx, and between AWS storage services. It verifies integrity with checksums, preserves metadata such as permissions and timestamps, schedules transfers and resumes after network interruptions. On-premises sources need a DataSync agent VM, while AWS-to-AWS transfers need none.
| Service | Pattern |
|---|---|
| DataSync | Move or sync data to AWS on a schedule |
| Storage Gateway | Use AWS storage as a continuous extension of on-premises |
AWS Transfer Family: SFTP Into S3 and EFS
Transfer Family provides managed SFTP, FTPS and FTP endpoints that write straight into S3 or EFS. A trading partner uploads over SFTP, the file lands in a bucket, and an S3 event can trigger processing, with no FTP server to run or patch.
Detailed Step-by-Step Practical Lab
This lab uses the AWS CLI. DataSync between two S3 buckets needs no on-premises agent, so you can verify a real transfer end to end. Bucket names are global, so change the suffix to your own.
export AWS_REGION=ap-south-1export SRC=devops-datasync-src-rahul-2026export DST=devops-datasync-dst-rahul-2026- Create two buckets and upload sample files to the source:
aws s3 mb s3://$SRC --region $AWS_REGIONaws s3 mb s3://$DST --region $AWS_REGION for i in 1 2 3; do echo "invoice $i" > invoice-$i.txt; doneaws s3 cp . s3://$SRC/ --recursive --exclude "*" --include "invoice-*.txt"- Create an IAM role that DataSync can assume, with access to both buckets:
cat > datasync-trust.json << 'EOF'{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "Service": "datasync.amazonaws.com" }, "Action": "sts:AssumeRole" }]}EOF cat > datasync-s3-access.json << EOF{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["s3:GetBucketLocation", "s3:ListBucket", "s3:ListBucketMultipartUploads"], "Resource": ["arn:aws:s3:::$SRC", "arn:aws:s3:::$DST"] }, { "Effect": "Allow", "Action": ["s3:AbortMultipartUpload", "s3:DeleteObject", "s3:GetObject", "s3:ListMultipartUploadParts", "s3:PutObject", "s3:GetObjectTagging", "s3:PutObjectTagging"], "Resource": ["arn:aws:s3:::$SRC/*", "arn:aws:s3:::$DST/*"] } ]}EOF export ROLE_ARN=$(aws iam create-role --role-name DataSyncLabRole \ --assume-role-policy-document file://datasync-trust.json \ --query Role.Arn --output text) aws iam put-role-policy --role-name DataSyncLabRole \ --policy-name DataSyncS3Access --policy-document file://datasync-s3-access.json sleep 10 # Give IAM a moment to propagate- Create a DataSync location for each bucket:
export SRC_LOC=$(aws datasync create-location-s3 \ --s3-bucket-arn arn:aws:s3:::$SRC \ --s3-config BucketAccessRoleArn=$ROLE_ARN \ --query LocationArn --output text --region $AWS_REGION) export DST_LOC=$(aws datasync create-location-s3 \ --s3-bucket-arn arn:aws:s3:::$DST \ --s3-config BucketAccessRoleArn=$ROLE_ARN \ --query LocationArn --output text --region $AWS_REGION)- Create a task that verifies only the files it transfers, then start it:
export TASK_ARN=$(aws datasync create-task \ --source-location-arn $SRC_LOC --destination-location-arn $DST_LOC \ --name mumbai-invoice-sync \ --options VerifyMode=ONLY_FILES_TRANSFERRED \ --query TaskArn --output text --region $AWS_REGION) export EXEC_ARN=$(aws datasync start-task-execution --task-arn $TASK_ARN \ --query TaskExecutionArn --output text --region $AWS_REGION)- Watch the execution until it reports
SUCCESS, then confirm the files arrived:
aws datasync describe-task-execution --task-execution-arn $EXEC_ARN \ --query '{Status:Status,Files:FilesTransferred,Bytes:BytesTransferred}' \ --region $AWS_REGION aws s3 ls s3://$DST/Review FSx without creating anything. In the console, open FSx, choose Create file system, and compare the four options. Open the Windows option to see that it requires an Active Directory domain, a VPC and subnets, and open the Lustre option to see the S3 link and the scratch versus persistent choice.
Optional: test an S3 File Gateway. Launch the gateway on EC2 for testing, activate it, and create an NFS file share on your bucket in the Storage Gateway console. Allow the NFS client ports in the gateway's security group. In production you would run the gateway as an on-premises VM. Then mount it from a client in the same VPC:
sudo mkdir -p /mnt/s3gatewaysudo mount -t nfs -o nolock,hard GATEWAY-IP:/BUCKET-NAME /mnt/s3gateway echo "Stored via Storage Gateway" | sudo tee /mnt/s3gateway/test.txtaws s3 ls s3://BUCKET-NAME/ --region ap-south-1- Clean up the DataSync resources, role and buckets, and delete the gateway and its EC2 instance if you created one:
aws datasync delete-task --task-arn $TASK_ARN --region $AWS_REGIONaws datasync delete-location --location-arn $SRC_LOC --region $AWS_REGIONaws datasync delete-location --location-arn $DST_LOC --region $AWS_REGION aws iam delete-role-policy --role-name DataSyncLabRole --policy-name DataSyncS3Accessaws iam delete-role --role-name DataSyncLabRole aws s3 rb s3://$SRC --forceaws s3 rb s3://$DST --forceProduction Best Practices & Common Pitfalls
Common MistakeUsing Snowball for ongoing sync. It is a bulk, one-time tool with a turnaround of days. After the initial move, use DataSync for scheduled transfers or Direct Connect for continuous connectivity.
Common MistakeUsing EFS where Windows servers need shared storage. EFS speaks NFS and works only with Linux, so Windows needs FSx for Windows File Server over SMB.
SecurityEncrypt data in transit and at rest on every one of these services. Prefer VPC endpoints for Storage Gateway and DataSync over public endpoints, and give DataSync roles access to only the buckets they need.
- Pick FSx for Windows when permissions come from Active Directory. Windows ACLs, shadow copies and DFS namespaces work as they do on-premises.
- Use Lustre scratch for short training jobs. It costs less, and persistent deployments are for long jobs that must survive node failures.
- Size Storage Gateway cache to your working set. A cache that is too small turns hot reads into slow S3 fetches.
- Compare transfer time before choosing Snowball. If the data would move online in a few days, DataSync is simpler and needs no shipping.
- Verify what DataSync moved. Keep verification on, and check the execution results rather than assuming a clean copy.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
aws datasync create-location-s3 |
Define an S3 location for a task |
aws datasync create-task |
Create a transfer task between two locations |
aws datasync start-task-execution |
Run a task |
aws datasync describe-task-execution |
Check status and bytes transferred |
aws storagegateway list-gateways |
List your Storage Gateways |
aws fsx describe-file-systems |
List FSx file systems |
| Problem | Likely cause | Fix |
|---|---|---|
| Task fails with an access error | Role cannot reach a bucket | Check the role's S3 policy and the bucket policy |
| Execution stays in LAUNCHING | IAM role not yet propagated | Wait a minute and retry |
| NFS mount to the gateway fails | Security group blocks NFS ports | Allow the client range on the gateway's NFS ports |
| Files missing in S3 after a gateway write | Cache not yet flushed | Wait for upload, then list the bucket again |
| Windows cannot mount EFS | NFS only, no SMB | Use FSx for Windows File Server |