NFS AWS how to
So... everyone are speaking about having single storage unit in AWS. That's a real demand these days, and here is one way of doing that. The answer is - NFS!
So basically, you do the following:
- launch/create VPC
http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/ExercisePreqs.html
- create VPC private subnet
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario2.html
- Launch instance in public subnet, and create NFS server:
yum install nfs-utils.x86_64 nfs-utils-lib-devel.x86_64 nfs4-acl-tools.x86_64 nfs-utils-lib.x86_64
- Create raid1 with "mdadm" tool as described here http://www.igord.net/2013/02/04/mdadm-raid-configuration/
- Mount your new mdadm raid volume to /mnt/data
- Put into /etc/exports the following (change IP addresses to suit your private IPs):
/mnt/data 10.0.2.123(rw,sync,fsid=0,no_root_squash) 10.0.3.123(rw,sync,fsid=0,no_root_squash)
- On the client side:
yum install nfs-utils.x86_64 nfs-utils-lib.x86_64
- Put into NFS client /etc/fstab:
10.0.2.123:/ /mnt/data/ nfs4 soft,intr,rsize=8192,wsize=8192,nosuid
(adopt your private IP of NFS server)
$ mount -a
that's it!