| Did this page help you? Yes No Tell us about it... |
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. Device xvda is assigned to drive C:\, and, depending on the instance type, devices xvdb through xvde might be reserved by the ephemeral stores. Any device that is not reserved can be attached to an Amazon EBS volume. |
The short version of this command is ec2attvol.
ec2-attach-volume
volume_id --instance instance_id --device
device
| 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 i-6058a509 |
Yes |
|
|
Specifies how the device is exposed to the instance. Type: String Default: None Example: -d /dev/sdf (for Linux/UNIX) or -d xvdf (for Windows) |
Yes |
| Option | Description |
|---|---|
|
|
Overrides the Region specified in the Default: The Example: |
|
|
Default: The Example: |
|
|
The private key to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
The X.509 certificate to use when constructing requests to Amazon EC2. Default: The value of the Example: |
|
|
Specifies a connection timeout (in seconds). Example: --connection-timeout 30 |
|
|
Specifies a request timeout (in seconds). Example: --request-timeout 45 |
|
|
Displays verbose output by showing the SOAP request and response on the command line. This is particularly useful if you are building tools to talk directly to our SOAP API. |
|
|
Displays column headers in the output. |
|
|
Shows empty columns as |
|
|
Do not display tags for tagged resources. |
|
|
Prints internal debugging information. This is useful to assist us when troubleshooting problems. |
|
|
Displays Help. |
|
|
If Example: |
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 command line tools display errors on stderr.
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 User Guide.
PROMPT>ec2-attach-volume vol-4d826724 -i i-6058a509 -d /dev/sdhATTACHMENT vol-4d826724 i-6058a509 /dev/sdh attaching 2008-02-14T00:15:00+0000