Amazon Elastic Compute Cloud
User Guide (API Version 2014-02-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Attaching an Amazon EBS Volume to an Instance

This section describes how to attach an Amazon EBS volume that you created to an instance.

The following table lists the available device names on Amazon EC2. You can specify these names when attaching a volume to a running instance or when attaching a volume when launching an instance using a block device mapping. The block device driver for the instance assigns the actual volume names when mounting the volumes, and these names can be different than the names that Amazon EC2 recommends. For more information about the instance store, see Amazon EC2 Instance Store. For information about the root device storage, see Amazon EC2 Root Device Volume.

Instance TypePossible for ConnectionReserved for RootInstance Store VolumesRecommended for EBS Connection

Linux / Unix (paravirtual)

/dev/sd[a-z]

/dev/sd[a-z][1-15]

/dev/hd[a-z]

/dev/hd[a-z][1-15]

/dev/sda1

/dev/sd[b-e]

/dev/sd[f-p]

/dev/sd[f-p][1-6]

Linux / Unix (HVM)

/dev/sd[a-z]

/dev/xvd[b-c][a-z]

Differs by AMI

/dev/sda1 or /dev/xvda

/dev/sd[b-e]

/dev/sd[b-y] (for hs1.8xlarge instances)

/dev/sd[f-p]

Windows (HVM)

xvd[a-z]

xvd[b-c][a-z]

/dev/sda[1-2]

/dev/sd[b-e]

/dev/sda1

xvd[a-e]

xvdc[a-x] (for hs1.8xlarge instances)

xvd[f-p] (with Red Hat PV drivers)

xvd[f-z] (with Citrix PV drivers)

For Linux/Unix instance types, we've received reports that some custom kernels might have restrictions that limit use to /dev/sd[f-p] or /dev/sd[f-p][1-6]. If you're having trouble using /dev/sd[q-z] or /dev/sd[q-z][1-6], try switching to /dev/sd[f-p] or /dev/sd[f-p][1-6].

Important

You cannot attach volumes that share the same device letters both with and without trailing digits. For example, if you attach a volume as /dev/sdc and another volume as /dev/sdc1, only /dev/sdc will be visible to the instance. If you wish use trailing digits in device names, you must use trailing digits on all device names that share the same base letters.

Depending on the block device driver of your instance's kernel, the device may be attached with a different name than what you specify. For example, if you specify a device name of /dev/sdh, your device may be renamed /dev/xvdh or /dev/hdh by the kernel; in some cases, even the trailing letter may also change (where /dev/sda could become /dev/xvde). Amazon Linux AMIs create a symbolic link from the renamed device path to the name you specify, but other AMIs may behave differently.

Hardware virtual machine (HVM) AMIs (such as the base Windows and Cluster Compute images) do not support the use of trailing numbers on device names (xvd[a-p][1-15]). You can view the virtualization type of your instance on the Virtualization field of the instance's details pane.

Depending on the size of your instance, Amazon EC2 provides instance store volumes on sd[b-e] (on Linux/Unix) or xvd[a-e]. Although you can connect your Amazon EBS volumes using these device names, we highly recommend that you don't because the behavior can be unpredictable.

An Amazon EC2 Windows AMI comes with an additional service installed, the Ec2Config Service. The Ec2Config service runs as a local system and performs various functions to prepare an instance when it first boots up. After the devices have been mapped with the drives, the Ec2Config service then initializes and mounts the drives. The root drive is initialized and mounted as c:\. The instance stores that comes attached to the instance are initialized and mounted as d:\, e:\, and so on. By default, when an Amazon EBS volume is attached to a Windows instance, it may show up as any drive letter on the instance. You can change the settings of the Ec2Config service to set the drive letters of the Amazon EBS volumes per your specifications. For more information, see Using Ec2Config in the Amazon Elastic Compute Cloud Microsoft Windows Guide.

Important

The volumes page in the Amazon EC2 console has been redesigned, and you can switch between the new and old interfaces by clicking the link in the preview message at the top of the console page. You can switch back to the old interface during the trial period; however, this topic may sometimes describe the new interface only.

To attach an Amazon EBS volume to an instance using the console

  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Click Volumes in the navigation pane.

    The console displays a list of current volumes.

  3. Select a volume and click Attach Volume.

    The Attach Volume dialog box appears.

  4. In the Instance box, start typing the name or ID of the instance to attach the volume to, and select it from the list of suggestion options (only instances in the same Availability Zone as the volume are displayed).

    Note

    If you're using the old design of the volumes page, select the instance from the Instance list.

  5. Enter a device name in the Device box, or verify that the suggested device name is suitable.

  6. Click Attach to attach the volume to the instance. The volume and instance must be in the same Availability Zone.

Note

  • Windows instances use either Red Hat or Citrix paravirtual (PV) drivers. If your Windows instance is using Citrix PV drivers, you can attach up to a total of 25 Amazon EBS volumes using the Amazon EC2 CLI; Windows instances with Red Hat PV drivers are limited to 16 volumes. Regardless of which drivers you are using, you can attach up to 16 Amazon EBS volumes using the Amazon EC2 console. To upgrade your Windows instance from Red Hat to Citrix paravirtual drivers, see Upgrading Your PV Drivers on Your Windows AMI.

  • Although it is technically possible to attach more than 25 volumes to a Windows instance with Citrix PV drivers, this is likely to cause performance issues and is not recommended.

  • If you want to push an Amazon S3 object to an Amazon EBS volume, follow the procedure above to attach the volume, then use a data transfer application (such as FTP/SFTP or SCP) on your running instance to transfer the data.

If a volume has an AWS Marketplace product code:

  • The volume can only be attached to the root device of a stopped instance.

  • You must be subscribed to the AWS Marketplace code that is on the volume.

  • The configuration (instance type, operating system) of the instance must support that specific AWS Marketplace code. For example, you cannot take a volume from a Windows instance and attach it to a Linux instance.

  • AWS Marketplace product codes are copied from the volume to the instance.

To attach an Amazon EBS volume to an instance using the command line

You can use one of the following commands. For more information about these command line interfaces, see Accessing Amazon EC2.