詳細検索

NFS mounting S3 from EC2 via Storage Gateway

Avatar
by 赤川蘭丸
3 min read

NFS mounting S3 from EC2 via Storage Gateway
Translated from 日本語 • View original

Hello, this is Akakawa, who is in charge of infrastructure.

AWS Latest Announcement Announces StorageGateway to EC2 to S3 Mount It was done.

We have taken a benchmark to see if this update can solve the problems so far.

Prepared Environment

Clients

For comparison, we have prepared three instances below A to C.

A. Instance with DocumentRoot in the directory where the S3 bucket was mounted nfs via FileGateway B. Instance where the directory where the S3 bucket was mounted with s3fs as DocumentRoot C. Instance with DocumentRoot deployed in the local disk

Install httpd on each instance. Change the DocumentRoot for each server.

StorageGateway

See Gateway requirements

However, if I proceeded without reading it, I could not connect to the Gateway instance no matter how long it took. When I connected to the Gateway instance with ssh, I was warned that the vCPU was not enough. Read it carefully to check the specs. (This image is a warning on the CPU, but if there is not enough memory, Critical was displayed.) )

aws-sg1

By the way, the default user for ssh connection to the Gateway instance is "sguser".

aws-sg2

S3

Make a bucket to mount in advance.

FileGateway Configuration

First, create a File Gateway from the Storage Gateway menu.

aws-sg3

Select EC2 for the Gateway type. Click the button outlined in red to open the EC2 startup screen.

aws-sg4

Apparently there is an AMI for Gateway. Create an instance with the aforementioned caveats in mind.

aws-sg5

Once you have created the instance, return to the File Gateway screen. Gateway IP address will be asked, so specify the IP of the instance you just created. This is followed by activation.

aws-sg6

Next, set up file sharing. Select the Gateway you created and click Create File Share.

aws-sg7

Enter the name of the S3 bucket to be mounted. You also set up IAM roles that can connect to S3.

aws-sg8

When you're done, it will even display the mount command. It's kind.

aws-sg9

Set up a Security Group so that clients can connect to the Gateway instance as appropriate. After that, prepare the client instance and change the http installation and DocumentRoot to the mount destination path.


Running an AB Bench

Deploy the test documentation on the mount destination and start httpd. Instances using S3FS and local disks are also launched and each benches are taken.

Results of S3 mounted instances via Gateway

fgw-ab

Results of S3 mounted instances with s3fs

s3fs-ab

Local Disk Usage Instance Results

local-ab

I benched it several times, and the results were comparable to those when using local disks. Great.

However, since the Gateway instance becomes SPOF and the specifications of the Gateway instance are required to a certain extent, it is necessary to consider whether the system is suitable for deployment.

See you then.

Related Articles