Amazon Elastic Compute Cloud
User Guide (API Version 2011-12-15)
Print this pageEmail this pageGo to the ForumsView the PDFShare this page on TwitterShare this page on FacebookBookmark this page on DeliciousSubmit this page to RedditSubmit this page to DiggDid this page help you?  Yes  No   Tell us about it...

Amazon EC2 Instance Storage

When an instance is created from an Amazon Machine Image (AMI), in most cases it comes with a preconfigured block of pre-attached disk storage. Within this document, it is referred to as an instance store; it is also known as an ephemeral store. An instance store provides temporary block-level storage for Amazon EC2 instances. The data on the instance store volumes persists only during the life of the associated Amazon EC2 instance. The amount of this storage ranges from 160GiB to up to 3.3TiB and varies by Amazon EC2 instance type. Larger Amazon EC2 instances have more and larger instance store volumes. The instance store is dedicated to a particular instance, however the disk subsystem is shared among instances.

If you need a permanent storage solution, or if you need to improve storage latency or throughput, we recommend using Amazon EBS. For more information, see Amazon Elastic Block Store.

An Amazon EC2 instance store consists of the virtual machine's root partition (forinstance store-backed AMI's only), plus one or more additional volumes that are dedicated to the Amazon EC2 instance (for both EBS-backed AMIs and instance store--backed AMIs). This storage is usable only from a single Amazon EC2 instance during its lifetime. Unlike EBS volumes, the instance store cannot be detached or attached to another instance. For more information on instance store--backed AMIs and Amazon EBS-backed AMIs, see AMI Basics.

[Important]Important

If an instance reboots (intentionally or unintentionally), the data on the instance store will survive.

However, under the following circumstances the data in the instance store will be lost:

  • Failure of an underlying drive.

  • Running an instance on degraded hardware.

  • Stopping an Amazon EBS-backed instance.

  • Terminating an instance.

The data on the instance store is not included when you bundle an AMI. For example, if you have an Amazon EC2 instance store-backed Windows instance, the D: drive on that instance is typically an instance store drive by default, and it's not included in an AMI that you bundle from that instance.

Instance Stores Available On Instance Types

Amazon EC2 instances are divided into different instance types depending on the number and size of the instance storage available on each one of them. The following table shows the instance types along with the number and the sizes of the instance store volumes available with each instance type.

TypeNamePlatformMemoryInstance Storage

Small

m1.small

32-bit

1.7GiB

160GiB instance storage (150GiB plus 10GiB root partition)

Large

m1.large

64-bit

7.5GiB

850GiB instance storage (2 x 420GiB plus 10GiB root partition)

Extra Large

m1.xlarge

64-bit

15GiB

1690GiB instance storage (4 x 420GiB plus 10GiB root partition)

Micro

t1.micro

32-bit or 64-bit

613MiB

None (use Amazon EBS volumes for storage)

High-CPU Medium

c1.medium

32-bit

1.7GiB

350GiB instance storage (340GiB plus 10GiB root partition)

High CPU Extra Large

c1.xlarge

64-bit

7GiB

1690GiB instance storage (4 x 420GiB plus 10GiB root partition)

High-Memory Extra Large

m2.xlarge

64-bit

17.1GiB

420GiB instance storage (1 x 420GiB)

High-Memory Double Extra Large

m2.2xlarge

64-bit

34.2GiB

850GiB instance storage (1 x 840GiB plus 10GiB root partition)

High-Memory Quadruple Extra Large

m2.4xlarge

64-bit

68.4GiB

1690GiB instance storage (2 x 840GiB plus 10GiB root partition)

Cluster Compute Quadruple Extra Large

cc1.4xlarge

64-bit

23GiB

1690GiB instance 64-bit storage (2 x 840GiB plus 10GiB root partition)

Cluster Compute Eight Extra Large

cc2.8xlarge

64-bit

60.5 GiB

3370GiB instance 64-bit storage (4 x 840 plus 10GiB root partition)

Cluster GPU Quadruple Extra Large

cg1.4xlarge

64-bit

22GiB (see note after this table)

1690GiB instance 64-bit storage (2 x 840GiB plus 10GiB root partition)

[Note]Note

The cg1.4xlarge instance type has 23GiB of memory, with 1GiB reserved for GPU operation. The 22GiB doesn't include the on-board memory of the GPUs, which is 3GiB per GPU for the NVIDIA Tesla M2050.

[Note]Note

When you launch an instance, you specify the instance type (the value in the Name column in the preceding table). We launch an m1.small instance if you don't specify a particular instance type.

Instance Store Device Names

Inside the instance, instance stores are exposed as normal block devices. All instance store volumes are pre-formatted with ext3 file system. However, you can reformat the volumes with any filesystem of your choice after you launch your instance. A Windows instance uses the built-in EC2Config Service tool to reformat all the instance store volumes available on the instance with NTFS file system.

Every AMI and instance has a mapping of the instance store attached to the instance. The mapping consists of the device name and the instance store it is attached to.

[Note]Note

Even though the instance storage mapping information exists on both Amazon EC2 instance store-backed and Amazon EBS-backed AMIs and instances, it is visible to you in the descriptions of Amazon EBS-backed AMIs and instances only. However, you can determine which instance stores are mapped from within the running instance itself.

Instance store volumes have to be mounted on the devices before they can be used. On a Linux instance, depending on the instance type, some instance stores are formatted and mounted by default by Amazon build images. A Windows instance uses a built-in tool, EC2Config Service, to format and mount all the instance stores attached to the instance.

The following table lists the devices reserved for instance store on each instance type and the state of the device (formatted, mounted, available). Instance store chunks are specified as ephemeral0, ephemeral1, etc. Basically, you just count up based on your instance type. A small image has an ephemeral0 (ext3, 15GiB) and an ephemeral1 (swap, 1GiB).

Device NameDescription
/dev/sda1Formatted and mounted as root (/) on all Linux and UNIX instance types. Formatted and mounted as C:\ on all Windows instance types.
/dev/sda2 or xvdb (Windows)Formatted and mounted as /mnt on m1.small and c1.medium instances. Formatted and mounted on small Windows instance types.
/dev/sda3Formatted and mounted as /swap on m1.small and c1.medium instances on all Linux and UNIX instance types. Not available on Windows instances.
/dev/sdb or xvdb (Windows)Formatted and mounted as /mnt on m1.large, m1.xlarge, c1.xlarge, cc1.4xlarge, cc2.8xlarge, m2.xlarge, m2.2xlarge, and m2.4xlarge Linux and UNIX instances. Formatted and mounted on m1.large, m1.xlarge, c1.xlarge, m2.xlarge, and m2.2xlarge Windows instances.
/dev/sdc or xvdc (Windows)Available on m1.large, m1.xlarge, cc2.8xlarge, cc1.4xlarge, and c1.xlarge Linux and UNIX instances. Formatted and mounted on m1.large, m1.xlarge, c1.xlarge, and m2.4xlarge Windows instances.
/dev/sdd or xvdd (Windows)Available on m1.xlarge and c1.xlarge, cc2.8xlarge Linux and UNIX instances. Formatted and mounted on m1.xlarge and c1.xlarge Windows instances.
/dev/sde or xvde (Windows)Available on m1.xlarge and c1.xlarge Linux and UNIX instances. Formatted and mounted on m1.xlarge and c1.xlarge Windows instances.

Multiple instance store volumes can be mapped to the devices on any one instance. However, the number and size of these volumes must not exceed the number and size of the instance storage available for the instance type.

Amazon EC2 Instance Storage Usage Scenarios

Instance store volumes are ideal for temporary storage of information that changes frequently, such as buffers, caches, scratch data, and other temporary content, or for data that is replicated across a fleet of instances, such as a load-balanced pool of web servers.

Making Instance Stores Available on Your Instances

Instances that use Amazon EBS for the root device do not, by default, have instance store available at boot time. If you want to use the instance stores with your EBS-backed instance, you have to explicitly map the instance stores with the devices while launching the instance. Examples of mapping the instance stores with the devices are, dev/sdb=ephemeral0, dev/sdc=ephemeral1, and so on. You need to use command line tools for mapping the instance stores with the devices. For more information on device mapping, see Block Device Mapping

The following task list describes what you need to do to launch an EBS-backed m1.large Windows instance by mapping the instance stores with the devices.

Accessing Instance Stores on Amazon EBS-backed Windows Instances

1

Locate an Amazon EBS-backed Windows AMI.

2

Using command lines tools, launch an m1.large instance and add the following instance store mapping: /dev/xvdb=ephemeral0 and /dev/xvdc=ephemeral1.

3

Connect to the instance.

4

On the Start menu, choose Computer.

5

Devices listed:

  • Local Disk C:/ 9.98GiB

  • Local Disk D:/ 419GiB

  • Local Disk E:/ 419GiB

6

Double-click Local Disk C:/. You will see the list of all the installed applications. This is your root drive.

7

Double-click Local Disk D:/ and then double-click Local Disk E:/. These drives are empty. They are the instance stores that come with your large instance, and they are available to use with your applications just like any physical drive.


The following task list describes what you need to do to launch an Amazon EBS-backed m1.large Linux instance by mapping the instance stores with the devices.

Accessing Instance Stores on Amazon EBS-backed Linux Instances

1

Locate an Amazon EBS-backed Linux/UNIX AMI.

2

Using command lines tools, launch an m1.large instance and add the following instance store mapping: /dev/sdb=ephemeral0 and /dev/sdc=ephemeral1.

3

Connect to the instance.

4

Check out the instance stores currently mounted on the disk.

5

Notice a 10GiB root partition mounted on the root and 420GiB mounted on an ephemeral0 device. Your m1.large instance comes with 2x420GiB instance storage. The other 420GiB is available but is unformatted and unmounted.

6

To format and mount the other 420GiB:

a. Create a file system of your choice on the device /dev/sdc (requires root privileges).
b. Create a directory on which to mount the device.
c. Mount the device on the newly created directory.

7

Check to see if the device has been mounted.

8

Optionally, list the files on the root device.


Instance stores can also be mapped to the devices while the AMI image is being created. When you map instance stores to the devices (while creating the AMI image), subsequent instances launched from that AMI will all have instance stores by default. These instance stores are available only for that instance. You will have to use command line tools for mapping the instance stores with the devices. For information on adding instance stores while creating an AMI image, see the section called “Creating Your Own AMIs”.

[Note]Note

You cannot map the instance stores with the devices after you've launched the instance.

No matter how you get your instance storage device on your instance, any data on those stores is deleted if the instance stops, fails, or terminates (except for data on the Amazon EBS volume being used as a root device).

[Tip]Tip

Do not rely on your instance's instance storage for valuable, long-term data. Use a replication strategy across multiple instances to keep your data safe, or store your persistent data in Amazon S3, or use an Amazon EBS volume.

Instances that use Amazon S3 for the root device automatically have instance store available on them (for the root partition and other data you want to add). Instance stores on Amazon EC2 instance store-backed instances are visible and available from within a running instance.

The following task list describes what you need to do to access the instance stores from within an Amazon EC2 instance store-backed m1.large Windows instance.

Tasks for Accessing Instance Stores on Amazon EC2 instance store-backed Windows Instances

1

Locate an Amazon EC2 instance store-backed Windows AMI.

2

Launch an m1.large instance.

3

Connect to the instance.

4

On the Start menu, choose Computer.

5

Devices listed:

  • Local Disk C:/ 9.98GiB

  • Local Disk D:/ 419GiB

  • Local Disk E:/ 419GiB

6

Double-click Local Disk C:/. You see the list of all the installed applications. This is your root drive.

7

Double-click Local Disk D:/ and then double-click Local Disk E:/. These are empty. They are the instance stores that come with your m1.large instance, and they are available to use with your applications just like any physical drive.


Depending on the instance type, some instance stores on Amazon EC2 instance store-backed Linux and UNIX instances are not mounted. For example, on an m1.large Linux and UNIX instance, the device /dev/sdc, although formatted and available, has to be mounted before it can be used.

The following task list describes what you need to do to access the instance stores from within Amazon EC2 instance store-backed m1.large Linux instance.

Accessing Instance Stores on Amazon EC2 instance store-backed Linux Instances

1

Locate an Amazon EC2 instance store-backed Linux/Unix AMI.

2

Launch a m1.large instance.

3

Connect to the instance.

4

Check out the file systems currently mounted on the disk.

5

Notice 10GiB root partition mounted on the root and 420GiB mounted on an ephemeral0 device. Your m1.large instance comes with 2x420GiB instance storage. The other 420GiB is available but has to be mounted before it can be used.

6

To mount the other 420GiB:

a. Create a directory on which to mount the device.
b. Mount the device on the newly created directory.

7

Check to see if the device has been mounted.

8

Optionally, list the files on the root device.


Suppressing Instance Stores at Launch Time

You can use command line tools to prevent a particular instance storage device from attaching to the instance. You can do this for both Amazon EC2 instance store-backed and Amazon EBS-backed AMIs and instances. For example, mapping /dev/sdc=none when launching an instance will cause the device /dev/sdc to not attach to the instance. For more information on device mapping, see see Block Device Mapping and AMI Mapping Override.

Using Amazon EC2 Instance Storage

This section describes how to add instance stores while creating an AMI image.

Adding A Default Instance Store

Because Amazon EBS-backed AMIs include a root device volume, they don't include any default instance store (i.e., ephemeral storage) the way Amazon EC2 instance store-backed AMIs do. However, you might want instances launched from your Amazon EBS-backed AMIs to include instance storage by default. This section describes how to create an AMI that includes the instance storage of your choice by default. You must do this with the command line tools or API; there's currently no way to do it through the AWS Management Console.

Command Line Tools

Use the ec2-register command and specify a block device mapping that includes the instance storage that you want for the image. For more information about block device mapping, see Block Device Mapping.

To add instance storage by default

  • Use the ec2-register command with the desired block device mapping information.

    The following example registers an AMI with an 80GiB root device volume at /dev/sda1 created from the snap-12345678 snapshot. The root volume's DeleteOnTermination flag is set to false. The second block device mapping in the request maps /dev/sdc to the ephemeral0 instance store.

    You can omit the size in the block device mapping if you want to create a volume the size of the snapshot. If you do specify a size, it must be equal to or larger than the snapshot. You can also resize the partition or create a new partition later.

    [Note]Note

    If you're using the command line tools on a Windows machine, you need to put quotation marks around any part of the command that includes an equal sign. For example: ... -b "/dev/sdc=ephemeral0" ....

    PROMPT>  ec2-register -n My_Image_Name -d My_image_description --root-device-name /dev/sda1  -b /dev/sda1=snap-12345678:80:false -b /dev/sdc=ephemeral0

    In response, you get the ID for your new AMI.

    IMAGE     ami-61a54008

Then, any instance of the AMI that you launch includes the instance storage you specified. You can view the block device mappings for the instance. Unfortunately, the information that's available doesn't include the instance store mappings. You can confirm that the instance store devices are available from within the instance itself. For more information, see Viewing Block Device Mappings.

API

You can use RegisterImage and specify a block device mapping that includes the instance storage that you want for the image.

To add instance storage by default

  • Issue the following Query request to register the image. The example registers an AMI with an 80 GiB root device volume at /dev/sda1 created from the snap-12345678 snapshot. The root volume's deleteOnTermination flag is set to false. The second block device mapping in the request maps /dev/sdc to the ephemeral0 instance store.

    [Note]Note

    You can omit the size in the block device mapping if you want to create a volume the size of the snapshot. If you do specify a size, it must be equal to or larger than the snapshot.

    https://ec2.amazonaws.com/
    ?Action=RegisterImage
    &Name=MyImage
    &KernelId=aki-f70657b2
    &RamdiskId=ari-ff0d5cba
    &RootDeviceName=/dev/sda1
    &BlockDeviceMapping.1.DeviceName=/dev/sda1
    &BlockDeviceMapping.1.Ebs.SnapshotId=snap-12345678
    &BlockDeviceMapping.1.Ebs.VolumeSize=80
    &BlockDeviceMapping.1.Ebs.DeleteOnTermination=false
    &BlockDeviceMapping.2.DeviceName=/dev/sdc
    &BlockDeviceMapping.2.VirtualName=ephemeral0
    &...auth parameters...

    For information about the auth parameters, go to Common Query Parameters in the Amazon Elastic Compute Cloud API Reference.

    Following is an example response.

    <RegisterImageResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
       <imageId>ami-61a54008</imageId>
    </RegisterImageResponse>

Any instance you then launch of the AMI includes the instance storage you specified. You can view the block device mappings for the instance. Unfortunately, the information that's available doesn't include the instance storage mappings. You can confirm the local storage devices are available from within the instance itself.For more information, see Viewing Block Device Mappings).

Disk Performance Optimization

Because of the way that Amazon EC2 virtualizes disks, the first write to any location on an instance's drives performs more slowly than subsequent writes. For most applications, amortizing this cost over the lifetime of the instance is acceptable. However, if you require high disk performance, we recommend that you initialize your drives by writing once to every drive location before production use. If you require further improvements in latency or throughput, we recommend using Amazon EBS.

To initialize the stores, use the following Linux/UNIX dd commands, depending on which store you want to initialize (/dev/sdb, etc.).

[Note]Note

Make sure to unmount the drive before performing this command.

Initialization can take a long time (about 8 hours for an extra large instance).

To initialize the stores, use the following commands on the m1.large, m1.xlarge, c1.xlarge, m2.xlarge, m2.2xlarge, and m2.4xlarge instance types:

dd if=/dev/zero of=/dev/sdb bs=1M          
               dd if=/dev/zero of=/dev/sdc bs=1M          
               dd if=/dev/zero of=/dev/sdd bs=1M          
               dd if=/dev/zero of=/dev/sde bs=1M 

For information about the stores that are available for each instance type, see Instance Stores Available On Instance Types.

To perform initialization on all drives at the same time, use the following command:

dd if=/dev/zero bs=1M|tee /dev/sdb|tee /dev/sdc|tee /dev/sde > /dev/sdd
RAID Configuration

Configuring drives for RAID initializes them by writing to every drive location. When configuring software-based RAID, make sure to change the minimum reconstruction speed:

echo $((30*1024)) > /proc/sys/dev/raid/speed_limit_min