What is ephemeral storage good for?

I have been reading about the ephemeral storage with amazon ec2 and am trying to figure out what is the best way to use the 100s of GBs they supply you. If it isn't persistent, what can it be good for?


As Flashman pointed out the ephemeral storage is "persistent" for the life of the instance -- It's great for stuff like /tmp & /var/tmp, or for caching - Basically anything where you wouldn't be horribly inconvenienced by it going away on restart.

If you routinely need to process huge data files to distill them down into more usable information this is a great option -- you can keep hundreds of gigs of original data on the ephemeral storage & put the distilled data someplace more permanent.


Temporary files and/or as a swap partition.

Here are some instructions for automatically creating a swap drive on boot. To quote the article...

Create a service named ‘swapon’.

sudo nano /etc/init.d/swapon

And add the following content:

# chkconfig: 2345 95 20
# description: Adding swap to ephemeral0
# Adding swap to ephemeral0
# processname: swap
dd if=/dev/zero of=/media/ephemeral0/swap bs=1024 count=8M
mkswap /media/ephemeral0/swap
chown root:root /media/ephemeral0/swap
chmod 600 /media/ephemeral0/swap
swapon /media/ephemeral0/swap

This service will generate a swap file of 8GB (hence the 8M * 1024byte). If you need less or more, change the ‘count’ parameter.

Now last step: let’s assign execute rights and enable this script/service at boot time.

sudo chmod +x /etc/init.d/swapon
sudo chkconfig --level 345 swapon on

Now your swap will be created every time you boot (or reboot) your EC2 instance.

.. /end quote.

You might be able to do something similar with the Windows page file but I haven't seen any instructions for it. I don't think you can just format the drive and move the pagefile across because the next time the instance starts the disk(s) will be initialized again (and moving the page file requires a restart.. ).

Also, keep in mind that most instance types come with multiple ephemeral disks (presumably) representing separate physical drives so striping across these devices (ie. RAID 0, for no redundancy or RAID 10 for redundancy) should improve swap performance further.