AWS Storage File Gateway Walk Through

Yst@IT
5 min readJun 14, 2019
AWS Storge File Gateway

The AWS Storage Gateway is a service connecting an on-premises software appliance with cloud-based storage to provide seamless and secure integration between an organization’s on-premises IT environment and AWS’s storage infrastructure.

Below is a walk through of how to setup AWS Storage File Gateway using EC2 instance.

Go to AWS Storage Gateway home page and click Get started. Choose File gateway and click Next.

AWS Storge File Gateway

As you can see, there are four ways to setup Storage File Gateway, in this demo, I will use EC2. Click Launch instance will take you to a new EC2 launch page with selected AMI. Get the IPv4 address of the instance after launched then come back to this page and click Next.

AWS Storge File Gateway

Following is the process of creating EC2 instance for Storage File Gateway. Make sure to choose instance type larger than m4.xlarge otherwise at later stage, the disk allocation will fail.

AWS Storge File Gateway

Config according to your needs. For demo purpose, I used default settings.

AWS Storge File Gateway

Add an extra EBS for File Gateway to act as cache, to transit uploaded files from your local side to S3. The recommended minimal cache size is 150GB, for demo purpose, I only create a 50GB EBS.

AWS Storge File Gateway

Tag the instance at your choice.

AWS Storge File Gateway

Choose security group which needs the following configuration.
1. http 80 port for file gateway activation
2. TCP 2049 for NFS, For local systems to connect to NFS shares that your gateway exposes.
3. TCP 20048 for NFSv3, For local systems to connect to mounts that your gateway exposes.
4. TCP 111 for NFSv3, For local systems to connect to the port mapper that your gateway exposes.

For more information, please refer here.

AWS Storge File Gateway

Lastly, choose the private key and finish the setup.

AWS Storge File Gateway

Get the IPv4 of the instance just created.

AWS Storge File Gateway

Now, back to Store File Gateway page and hit Next.

AWS Storge File Gateway

Enter the IPv4 of the instance just created.

AWS Storge File Gateway

Give the gateway a need and set the time zone.

AWS Storge File Gateway

Gateway is now activated and initializing the EBS cache (50GB) created.

AWS Storge File Gateway

EBS cache (50GB) will be initialized in few minutes. As mentioned before, 150GB for EBS cache is recommended. Also, if you did not choose instance type larger than m4.xlarge, the disk initialization will fail.

AWS Storge File Gateway

Storage File Gateway is created. Now we need to create file shares for clients to mount and therefore able to transfer files.

AWS Storge File Gateway

Since we are using File Gateway to store files in AWS, specific S3 in this demo, we need to assign a S3 bucket as the destination storage.

AWS Storge File Gateway

You can choose S3 class to be Standard, Standard-IA or One Zone-IA. A role is needed since File Gateway needs to access S3 bucket, so proper privileges is needed.

AWS Storge File Gateway

In the review page after clicking Next, by default, everyone can mount and access to your Gateway, so you can restrict client source as below.

AWS Storge File Gateway
AWS Storge File Gateway

Lastly, create your file share.

AWS Storge File Gateway

You can see that file share is created and with command for different devices to mount the file share. Pay attention that the command is using the private IP of the Gateway instance. You must use the IPv4 of the instance if you are connecting file share from public internet.

AWS Storge File Gateway

Now, from my mac, let’s verify the functionality. I have a folder called awsFileGateway. I used the command provided by File Gateway but change IP to IPv4 and do a file system check and I was connected to file share successfully.

mount_nfs -o vers=3,nolock,hard -v GatewayIPv4:/S3BucketName localMountPoint/

AWS Storge File Gateway

I rsync a local pdf file to my awsFileGateway folder, which is already mounted to the file share, which the destination is a S3 bucket called ystataws.

AWS Storge File Gateway

Rsync is successful and S3 bucket ystataws is also verified that the pdf is uploaded.

AWS Storge File Gateway

And that’s it! Now you can transfer your file up and down from your local computer to S3 bucket in the cloud!

--

--

Yst@IT

Cloud Solution Architect, focusing on Oracle Cloud Infrastructure currently.