ec2-attach-volume
Description
Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.
Note | |
---|---|
Windows instances currently support devices xvda through xvdp. Devices xvda and xvdb are reserved by the operating system, xvdc is assigned to drive C:\, and, depending on the instance type, devices xvdd through xvde might be reserved by the instance stores. Any device that is not reserved can be attached to an Amazon EBS volume. For a list of devices that are reserved by the instance stores, go to the |
Syntax
ec2-attach-volume
volume_id
--instance instance_id
--device device
Options
Name | Description | Required |
---|---|---|
|
The ID of the Amazon EBS volume. The volume and instance must be within the same Availability Zone and the instance must be running. Type: String Default: None Example: vol-4d826724 |
Yes |
|
The ID of the instance to which the volume attaches. The volume and instance must be within the same Availability Zone and the instance must be running. Type: String Default: None Example: i-6058a509 |
Yes |
|
Specifies how the device is exposed to the instance (e.g., /dev/sdh). Type: String Default: None Example: /dev/sdf (Linux and UNIX) or xvdf (Windows) |
Yes |
Output
The command returns a table that contains the following information:
-
ATTACHMENT identifier
-
ID of the volume
-
ID of the instance
-
The device as it is exposed to the instance
-
Attachment state (e.g., attaching, attached, detached, detaching, error)
-
Time stamp when attachment initiated
Amazon EC2 displays errors on stderr.
Examples
Example Request
This example attaches volume vol-4d826724
to instance i-6058a509
and exposes it as /dev/sdh
. For information on standard storage locations, go to the Amazon Elastic Compute Cloud Developer Guide.
PROMPT>ec2-attach-volume vol-4d826724 --instance i-6058a509 --device /dev/sdh
ATTACHMENT vol-4d826724 i-6058a509 /dev/sdh attaching 2008-02-14T00:15:00+0000