The Pragmatic Programmer

Appian, Pega, Java, DevSecOps, Quality Engineering

Lab 5: Migrating an On-Premises NFS Share Using AWS DataSync and Storage Gateway

This lab demonstrates how to use AWS DataSync and an AWS Storage Gateway file gateway to migrate data from an on-premises Network File System (NFS) server to Amazon Simple Storage Service (Amazon S3).

After completing this lab, you will be able to :

Deploy and activate a DataSync agent as an Amazon Elastic Compute Cloud (Amazon ECS) instance

Create a DataSync task to copy data from a Linux-based NFS server to an S3 bucket

Deploy and activate a Storage Gateway file gateway appliance as an EC2 instance

Create an NFS file share on a file gateway

Configure a Linux host to connect to an NFS share on a file gateway

Task 1 : Connect to the On-Premises NFS Server

To mount the on-premise NFS share to the client instance, run the following command.

Replace <NfsServerPrivateIp> with the actual NfsServerPrivateIp

sudo mount <NfsServerPrivateIp>:/var/nfs /mnt/nfs
sudo mount 10.10.2.132:/var/nfs /mnt/nfs

To verify that the NFS file share was mounted successfully, run the following command :

df - h

Filesystem            Size  Used Avail Use% Mounted on
devtmpfs              475M     0  475M   0% /dev
tmpfs                 492M     0  492M   0% /dev/shm
tmpfs                 492M  392K  492M   1% /run
tmpfs                 492M     0  492M   0% /sys/fs/cgroup
/dev/xvda1            8.0G  1.1G  7.0G  14% /
tmpfs                  99M     0   99M   0% /run/user/1000
10.10.2.154:/var/nfs  8.0G  1.1G  7.0G  14% /mnt/nfs
ls /var/nfs
1.png  10.png  2.png  3.png  4.png  5.png  6.png  7.png  8.png  9.png

Task 2 : Deploy and Activate a DataSync Agent Instance

In a physical environment, DataSync can also be deployed as a VMware-based virtual machine.

Task 3 : Create and Run a DataSync Task