Amazon Elastic Compute Cloud
API Reference (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...

AttachVolume

Description

Attaches an Amazon EBS volume to a running instance and exposes it as the specified device.

[Note]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.

Request Parameters

NameDescriptionRequired

VolumeId

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

Yes

InstanceId

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

Yes

Device

How the device is exposed to the instance (e.g., /dev/sdh, or xvdh).

Type: String

Default: None

Yes

Response Elements

The elements in the following table are wrapped in an AttachVolumeResponse structure.

NameDescription

requestId

The ID of the request.

Type: xsd:string

volumeId

The ID of the volume.

Type: xsd:string

instanceId

The ID of the instance.

Type: xsd:string

device

The device as it is exposed to the instance (e.g., /dev/sdh, or xvdh).

Type: xsd:string

status

Volume state.

Type: xsd:string

Valid Values: attaching | attached | detaching | detached

attachTime

Time stamp when the attachment initiated.

Type: xsd:dateTime

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 User Guide.

https://ec2.amazonaws.com/?Action=AttachVolume
&VolumeId=vol-4d826724
&InstanceId=i-6058a509
&Device=/dev/sdh
&AUTHPARAMS

Example Response

<AttachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2011-12-15/">
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
  <volumeId>vol-4d826724</volumeId>
  <instanceId>i-6058a509</instanceId>
  <device>/dev/sdh</device>
  <status>attaching</status>
  <attachTime>2008-05-07T11:51:50.000Z</attachTime>
</AttachVolumeResponse>