Module 14 - Guided Lab - Hybrid Storage and Data Migration With AWS Storage Gateway File Gateway
Module 14 - Guided Lab - Hybrid Storage and Data Migration With AWS Storage Gateway File Gateway
Configure a File Gateway with an NFS file share and attach it to a Linux instance
Migrate a set of data from the Linux instance to an S3 bucket
Create and configure a primary S3 bucket to migrate on-premises server data to AWS
Create and configure a secondary S3 bucket to use for cross-Region replication
Create an S3 lifecycle policy to automatically manage data in a bucket
Duration
This lab will require approximately 90 minutes to complete.
Tip: If you need more time to complete the lab, restart the timer for the environment by choosing the Start Lab button again.
2. Wait until the Start Lab panel displays the message Lab status: ready, then close the panel by choosing the X.
This action opens the AWS Management Console in a new browser tab. The system automatically logs you in.
Tip: If a new browser tab does not open, a banner or icon is usually at the top of your browser with the message that your
browser is preventing the site from opening pop-up windows. Choose the banner or icon, and then choose Allow pop-ups.
4. Arrange the AWS Management Console tab so that it displays alongside these instructions. Ideally, you will have both browser
tabs open at the same time so that you can follow the lab steps more easily.
The primary S3 bucket is created in the us-east-2 (Ohio) Region. Data from the Linux host is copied to the primary S3 bucket. This
bucket can also be called the source.
The secondary S3 bucket is created in the us-west-2 (Oregon) Region. This secondary bucket is the target for the cross-Region
replication policy. It can also be called the destination.
5. In the search box to the right of Services, search for and choose S3 to open the S3 console.
Bucket name: Create a name that you can remember easily. It must be globally unique.
For cross-Region replication, you must enable versioning for both the source and destination buckets.
Bucket name: Create a name you can easily remember. It must be globally unique.
Region: US West (Oregon) us-west-2
Versioning: Enable
9. Select the name of the source bucket that you created in the US East (Ohio) Region.
10. Select the Management tab and under Replication rules select Create replication rule
Status Enabled
Source bucket:
For Choose a rule scope, select Apply to all objects in the bucket
Destination:
Choose Browse S3 and select the bucket you created in the US West (Oregon) Region.
Note: To find the AWS Identity and Access Management (IAM) role, in the search box, enter: S3-CRR (This role
was pre-created with the required permissions for this lab)
12. Choose Save . When prompted, if you want to replicate existing objects, choose No, and then choose Submit
Note: there are no objects currently in the bucket, so the answer will have no effect in this case.
13. Return to and select the link to the bucket you created in the US East (Ohio) Region.
14. Choose Upload to upload a file from your local computer to the bucket.
For this lab, use a small file that does not contain sensitive information, such as a blank text file.
15. Choose Add files , locate and open the file, then choose Upload
16. Wait for the file to upload, then choose Close . Return to the bucket you created in the US West (Oregon) Region.
The file that you uploaded should also now have been copied to this bucket.
Note: You may need to refresh the console for the object to appear.
Task 4: Configuring the File Gateway and creating an NFS file share
In this task, you will deploy the File Gateway appliance as an Amazon Elastic Compute Cloud (Amazon EC2) instance. You will then
configure a cache disk, select an S3 bucket to synchronize your on-premises files to, and select an IAM policy to use. Finally, you will
create an NFS file share on the File Gateway.
17. In the search box to the right of Services, search for and choose Storage Gateway to open the Storage Gateway console.
18. At the top-right of the console, verify that the current Region is N. Virginia.
19. Choose Create gateway then begin configuring the Step 1: Set up gateway settings:
Gateway time zone: Choose GMT -5:00 Eastern Time (US & Canada), Bogota, Lima
Host platform: choose Amazon EC2. Choose Customize your settings. Then choose the Launch instance button.
A new tab opens to the EC2 instance launch wizard. This link automatically selects the correct Amazon Machine Image (AMI)
that must be used for the File Gateway appliance.
20. In the Launch an instance screen, begin configuring the gateway as described:
Note: t2.xlarge is the only instance type that you can select in this lab environment. If you select any other instance type, it will
result in an error message when you attempt to launch the instance.
The t2.xlarge instance type is used only as an example in this lab. For correct appliance sizing when you deploy a Storage
Gateway appliance, refer to the Storage Gateway documentation.
Key pair name - required: choose the existing vockey key pair.
Note: This SSH key pair is provided on the Details > Show page for this lab.
21. Configure the network and security group settings for the gateway.
VPC: On-Prem-VPC
Subnet: On-Prem-Subnet
Auto-assign public IP: Enable
Under Firewall (security groups), choose Select an existing security group.
For Common security groups:
Note: This security group is configured to allow traffic through ports 80 (HTTP), 443 (HTTPS), 53 (DNS), 123 (NTP), and
2049 (NFS). These ports enable the activation of the File Gateway appliance. They also enable connectivity from the
Linux server to the NFS share that you will create on the File Gateway.
For additional information about the ports used by Storage Gateway, refer to the Storage Gateway documentation.
Note: This security group is configured to allow Secure Shell (SSH) connections on port 22.
Verify that both security group now appear as selected (details on each will appear in boxes in the console).
Tip: You may need to choose Show all selected to see them both.
In the Configure storage panel, notice there is already an entry to create one 80GiB root volume.
In the Summary panel on the right, keep the number of instances set to 1, and choose Launch instance
Your File Gateway Appliance instance will take a few minutes to initialize.
24. Monitor the status of the deployment and wait for Status Checks to complete.
Tip: Choose the refresh button to more quickly learn the status of the instance.
25. Select your File Gateway instance, then in the Details tab below, locate the Public IPv4 address and copy it.
You will use this IP address when you complete the File Gateway deployment.
26. Return to the AWS Storage Gateway tab in your browser. It should still be at the Set up gateway on Amazon EC2 screen.
27. Check the box next to I completed all the steps above and launched the EC2 instance, then choose Next
For IP address, paste in the IPv4 Public IP address that you copied from your File Gateway Appliance instance
For the Service endpoint, select Publicly accessible.
Choose Next
29. In the Step 3: Review and activate settings screen choose Activate gateway
In the Configure cache storage panel, you will see that a message the local disks are loading.
Wait for the local disks status to show that it finished processing (approximately 1 minute).
Choose Configure
Gateway: Select the name of the File Gateway that you just created (which should be File Gateway Appliance)
File share protocol: NFS
Amazon S3 bucket name: Choose the name of the source bucket that you created in the US East (Ohio) us-east-2 Region in
Task 1.
Choose Customize configuration
For File share name use share and choose Next.
33. On the Amazon S3 storage settings screen, configure these settings:
Object metadata:
IAM role: Paste the FgwIamPolicyARN, which you can retrieve by following these instructions –
34. In the File access settings screen, accept the default settings.
Note: You might get a warning message that the file share is accessible from anywhere. For this lab, you can safely disregard this
warning. In a production environment, you should always create policies that are as restrictive as possible to prevent unwanted or
malicious connections to your instances.
Choose Next
35. Scroll to the bottom of the Review and create screen, then select Create
Monitor the status of the deployment and wait for Status to change to Available, which takes less than a minute.
Note: You can choose the refresh button occasionally to notice more quickly when the status has changed.
36. Select the file share that you just created by choosing the link.
37. At the bottom of the screen, note the command to mount the file share on Linux. You will need it for the next task.
Task 5: Mounting the file share to the Linux instance and migrating the
data
Before you can migrate data to the NFS share that you created, you must first mount the share. In this task, you will mount the NFS
share on a Linux server, then copy data to the share.
39. Above these instructions that you are currently reading, choose the Details dropdown menu, and then select Show
40. Choose the Download PPK button and save the labsuser.ppk file.
Note: Typically, your browser saves the file to the Downloads directory.
45. To keep the PuTTY session open for a longer period of time, configure the PuTTY timeout:
Choose Connection
Choose Session
Host Name (or IP address): Paste the OnPremLinuxInstance for the instance you noted earlier
48. When you are prompted with login as, enter: ec2-user
49. Microsoft Windows users: Click here to skip ahead to the next task.
50. Above these instructions that you are currently reading, choose the Details dropdown menu, and then select Show
51. Choose the Download PEM button and save the labsuser.pem file.
For example, if the labsuser.pem file was saved to your Downloads directory, run this command:
cd ~/Downloads
55. Change the permissions on the key to be read-only, by running this command:
56. Run the following command (replace <public-ip> with the OnPremLinuxInstance address that you copied earlier).
Alternatively, to find the IP address of the on-premises instance, return to the Amazon EC2 console and select Instances
Select the On-Prem Linux Server instance that you want to connect to
57. When you are prompted to allow the first connection to this remote SSH server, enter yes .
Because you are using a key pair for authentication, you are not prompted for a password.
ls /media/data
59. Create the directory that will be used to synchronize data with your S3 bucket by using the following command:
60. Mount the file share on the Linux instance by using the command that you located in the Storage Gateway file shares details screen
at the end of the last task.
Notice that the command starts with sudo and ends with /mnt/nfs/s3 .
For example:
df -h
[ec2-user@ip-10-10-1-210 ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 483M 64K 483M 1% /dev
tmpfs 493M 0 493M 0% /dev/shm
/dev/xvda1 7.8G 1.1G 6.6G 14% /
10.10.1.33:/share 8.0E 0 8.0E 0% /mnt/nfs/s3
62. Now that you created the mount point, you can copy the data that you want to migrate to Amazon S3 into the share by using this
command:
cp -v /media/data/*.png /mnt/nfs/s3
63. In the Services search box, search for and choose S3 to open the S3 console.
64. Select the bucket that you created in the US East (Ohio) Region.
Note: You might need to choose the refresh icon in the S3 console.
65. Return to the Buckets page and select the bucket that you created in the US West (Oregon) Region.
Verify that the images files were replicated to this bucket, based on the policy that you created earlier.
Note: S3 Object replication can take up to 15 minutes to complete. Keep refreshing until you see the replicated objects.
Congratuations, you successfully migrated data to Amazon S3 by using AWS Storage Gateway in File Gateway mode! After your data is
stored in Amazon S3, you can act on it like native Amazon S3 data. In this lab, you created a replication policy to copy the data to a
secondary Region. You could also perform other operations, such as configuring a lifecycle policy. For example, you could migrate
infrequently used data automatically from S3 Standard to Amazon Simple Storage Service Glacier for long-term storage, which can
reduce costs.
66. At the top of these instructions, choose Submit to record your progress and when prompted, choose Yes.
67. If the results don't display after a couple of minutes, return to the top of these instructions and choose Grades
Tip: You can submit your work multiple times. After you change your work, choose Submit again. Your last submission is what will
be recorded for this lab.
68. To find detailed feedback on your work, choose Details followed by View Submission Report.
Lab complete
Congratulations! You have completed the lab.
69. Choose End Lab at the top of this page, and then select Yes to confirm that you want to end the lab.
A panel should appear with this message: DELETE has been initiated... You may close this message box now.
70. Select the X in the top right corner to close the panel.
©2022 Amazon Web Services, Inc. and its affiliates. All rights reserved. This work may not be reproduced or redistributed, in whole or in
part, without prior written permission from Amazon Web Services, Inc. Commercial copying, lending, or selling is prohibited.