Ubuntu – Autoscaling EC2 with NFS mounts

amazon ec2amazon-elbautoscalingnfsUbuntu

I'm trying to set up a shared filesystem on EC2 and I've read tutorials such as this: http://blog.ronaldmccollam.com/2012/07/configuring-nfs-on-ubuntu-in-amazon-ec2.html

In step 2 it talks about configuring the exports, for this I need an IP range but when I'm auto-scaling I can't predict what the IP will be before it scales. Is there any other way of doing this while still staying secure?

Thanks

Edit: Just tried s3fs, didn't seem to work properly

Best Answer

First off I would not recommend using S3 as your shared filesytem. It can be extremely costly due to how the IO works.

There's a couple ways to do this.

The easiest way is to add your hosts EC2 security group as a source IP rule for the security group of the NFS server while blocking all other unnecessary traffic. This usually means having two rules; one for your management of the NFS server over SSH [typically] and the other rule allowing all traffic from your connecting hosts to the group. This allows only that traffic to the NFS host. At that point you can safely set the permissions in NFS to 10.0.0.0/8 or just leave it open to everyone. No connections to NFS will be allowed except those in your security group settings.

Alternately you can set up a startup script on the connecting hosts that either remotely configures the NFS host or pings it somehow so that it knows how to configure itself. This way you can leave the NFS settings to a per-IP setup rather than being more open.

Update June 2015:

Elastic File System is coming and would be a much better solution. http://aws.amazon.com/efs/

Related Topic