To access the ephemeral (instance-store) storage Amazon includes with an EC2 instance, you need to define it when you launch an instance. Using the EC2 command line tools all you need to do is include the -b or --block-device-mapping option flag.
For example, this command would launch a single m1.large instance in us-east-1a, with ephemeral0 and ephemeral1 mapped to sdb1 and sdb2 respectively and the following options:
- ami-id
- (-n) number of instances to launch
- (-t) instance type
- (-z) availability zone
- (-b) block device mapping
- (-g) security group
- (-k) key name
-
ec2-run-instances ami-id -n 1 -t m1.large -z us-east-1a -b "/dev/sdb1=ephemeral0" -b "/dev/sdb2=ephemeral1" -g security_group -k key_name
Then you can format and mount the devices. (repeat each command once for each device)
sudo mkfs /dev/sdb[1..n]
sudo mkdir -p /media/ephemeral[0...n]
You can then either add the following two lines to your /etc/fstab (feel free to adjust your mount options, file system, etc.)
/dev/sdb1 /media/ephemeral0 auto defaults,comment=cloudconfig 0 2
/dev/sdb2 /media/ephemeral1 auto defaults,comment=cloudconfig 0 2
And mount the devices
sudo mount /media/ephemeral0
sudo mount /media/ephemeral1
Or, just mount the devices without adding these devices to the fstab file
sudo mount -t ext3 /dev/sdb1 /media/ephemeral0
sudo mount -t ext3 /dev/sdb2 /media/ephemeral1
Verify
df -h
Sample Output:
[ec2-user@ip-10-251-159-223 media]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 883M 7.0G 12% /
tmpfs 3.7G 48K 3.7G 1% /dev/shm
/dev/xvdb1 414G 199M 393G 1% /media/ephemeral0
/dev/xvdb2 414G 199M 393G 1% /media/ephemeral1
[ec2-user@ip-10-251-159-223 media]$
By the way, once you customize your instance. Create your own AMI based on this instance and whenever you launch an instance from the resulting AMI the ephemeral storage will already be configured.
Also, take a look at the documentation provided on the AWS website.
Amazon Command Line Tools Documentation
Good Luck!