File Gateway provides a seamless way to connect to the cloud in order to store application data files and backup images as durable objects in Amazon S3 cloud storage. File Gateway offers SMB or NFS-based access to data in Amazon S3 with local caching. It can be used for on-premises applications, and for Amazon EC2-based applications that need file protocol access to S3 object storage.

In this post we going to learn how to make a File Gateway and used to communicate between on-premise and a s3 bucket


  • AWS account


  1. Create a bucket there the File Gateway is going to deposit the files, go to AWS Management Console and go to S3

2. Click on Create bucket

3. Give it a name and select the AWS Region

4. Click on Create bucket

5. Now we need to start the instance is going to serve as the File Gateway, go to EC2

6. Go to instances

7. Click in Launch instances

8. Select Community AMIs, and search for aws-storage-gateway

9. Select the latest version (highest number), I recommend you to look very well as in my case the highest number was not in the first place, once you find it, click on Select

10. AWS recommends that at minimum the instance type is xlarge, so this is the type we going to select, then click on Next: Configure Instance Details

11. You can leave all on defaults here, only check that you have Auto-assign Public IP enabled and click on Next

12. Click on Add New Volume, and add 10 GB of General Purpose, this is going to serve as cache, and check the Delete on Termination and click on Next: Add Tags

AWS Recommends to use at leats 150 GB of storage space to use as cache, for this lab we going to use 10 GB

13. You can leave this on defaults and click on Next: Configure Security Group

14. Here is where the things become more interesting, if we see the requirement page we going to find the port diagram for the File gateway, and some other ports depending on what services you going to use, I highly recommend that you go and check the page if you are using it on production

Port diagram for File Gateway

15. Give it a name and open the ports you need as in this lab we going to use NFS I open the ports related.

16. At the end this is how my open ports look like, click on Review and Launch

17. After Review click on Launch

18. On the next window create a new Key Pair, download it, and proceed to launch the instance

19. If everything is right, you will see the confirmation page, click on View Instances

20. Click on the Instance ID you just launch

21. Copy the Public IP address

22. Now lets configure the File Gateway, go to Storage Gateway

23. Click on Get started

24. Select File gateway and click on Next

25. Select Amazon EC2 as host Platform and click on next

26. Select Public Endpoint type and click next

27. Paste the public IP address from the instance, and click on Connect to gateway

28. Select your time zone and give a File gateway a name and click on Activate gateway

29. In the next screen wait a little bit until the instance disk are ready, when it does, select the 10 GB disk to be cache

30. In the next screen select create a new logging group and select the timezone, and click on Save and continue

If you add only 10 GB you will get a warning, this is ok for testing.

31. Now we need a File share, click on Create file share, put the S3 bucket name and click Next

32. You can leve this by default, and click on Next

33. In the next screen, review the configuration and click on Create file share

34. Wait until the Fileshare status is Available and select the File Share

35. The file gateway is ready, copy the mount command for your OS and test it, open a terminal, first create a folder where we going to mount the gateway

sudo mkdir /filegateway

36. Mount the file gateway, use the public IP of the instance

sudo mount -t nfs -o nolock,hard /filegateway

37. Go to the directory and make a file

cd /filegateway
touch test.txt
echo "This is my first file transfer with a file gateway" > test.txt

38. Go to S3

39. Select the bucket for this lab

40. And you will see the file you create it on-premise, this can take some minutes some time, depending on your internet and the size of the file.

Great! now you know how to make a AWS File gateway, in the next post we going to go deeper into the AWS services.


  1. Go to Storage Gateway

2. Click on File shares

3. Select the file share we make for the lab, click on Actions and select Delete file share

4. Confirm

5. Go to Gateways

6. Select the file-gateway and click on Actions, then click on Delete gateway

7. Confirm

8. Go to EC2

9. Go to instances

10. Select the instance and click on Instance state and select Terminate instance

11. Confirm

12. Go to Security groups

13. Select the security groups created for this lab and click on Actions and click on Delete security groups

14. Confirm

15. Go to S3

16. Select the bucket and click on Empty

17. Confirm

18. Exit from the bucket status, select the bucket again and click on Delete

19. Confirm