When you launch an instance in EC2, be it EBS root or instance-store, you are "entitled" to some amount of ephemeral storage. Ephemeral storage is basically just extra local disk that lives in the host machine where your instance will run. How much instance-store disk you are entitled to is described with the instance size descriptions.
The described amount of ephemeral storage is allocated to all instance-store instances. However, at register time of EBS-root instances the default "block-device-mapping" is set. Because an EBS-root AMI may be run with different instance-types, it is impossible to set the correct mapping for all scenarios. For the Ubuntu images, the default mapping only includes ephemeral0, which is present in all but t1.micro sizes.
So, if you want to "get all that you're paying for", you'll have to launch instances with different '--block-device-mapping' arguments to ec2-run-instances (or euca-run-instances). I've written a little utility named bdmapping to make that easier, and hold the knowledge.
You can use it to show the mappings for a given instance type:
$ ./bdmapping
--block-device-mapping=sdb=ephemeral0 --block-device-mapping=sdc=ephemeral1
Or, use it with command substitution when you launch an instance:
$ ec2-run-instances $(bdmapping -c m1.xlarge) --key mykey ami-c692ec94
#
# the above is the same as running:
# ec2-run-instances --block-device-mapping=sdb=ephemeral0 \
# --block-device-mapping=sdc=ephemeral1 --instance-type=m1.large \
# --key mykey ami-c692ec94
You can view or download 'bdmapping' at https://gist.github.com/809587
Is there a community ubuntu hvm AMI with ephemeral storage defined/mapped? I would like to launch an ubuntu HVM AMI from the AWS console with instance storage that I can mount.
ReplyDeleteThank you for any help you can provide.
Audree Thurman
@Aud,
ReplyDeleteIt is probably just oversite that the ubuntu hvm images do not have ephemeral devices by default. We've adjusted the publishing scripts so future images will [1].
In the mean time, you always specify ephemeral devices on launch via the ec2-api-tools:
ec2-run-instances --instance-type=cc1.4xlarge \
--block-device-mapping /dev/sdb=ephemeral0 \
--block-device-mapping /dev/sdc=ephemeral1 \
ami-b562a9dc
--
[1] http://bazaar.launchpad.net/~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts/revision/395
Thanks so much Scott. So far, I've managed to use only the AWS console (I may have to start using the command line tools, I suppose).
ReplyDeleteDo you have any idea when an ami will be available with these mappings?
Audree
I see it in the daily build AMI's - thanks again.
ReplyDeleteAud