| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Attaches an Amazon EBS volume to a running instance and exposes it to the instance with the specified device name.
For a list of supported device names, see Attaching the Volume to an Instance. Any device names that aren't reserved for instance store volumes can be used for Amazon EBS volumes. For more information, see Amazon EC2 Instance Store.
Note
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.
For an overview of the AWS Marketplace, see https://aws.amazon.com/marketplace/help/200900000. For details on how to use the AWS Marketplace, see AWS Marketplace.
VolumeIdThe ID of the Amazon EBS volume. The volume and instance must be within the same Availability Zone.
Type: String
Default: None
Required: Yes
InstanceIdThe ID of the instance. The instance must be running.
Type: String
Default: None
Required: Yes
DeviceThe device name as exposed to the instance (e.g., /dev/sdh, or xvdh).
Type: String
Default: None
Required: Yes
The following elements are returned in an
AttachVolumeResponse element.
requestIdThe ID of the request.
Type: xsd:string
volumeIdThe ID of the volume.
Type: xsd:string
instanceIdThe ID of the instance.
Type: xsd:string
deviceThe device name as exposed to the instance (for example, /dev/sdh, or xvdh).
Type: xsd:string
statusThe volume state.
Type: xsd:string
Valid values: attaching |
attached | detaching |
detached
attachTimeThe time stamp when the attachment initiated.
Type: xsd:dateTime
This example attaches volume vol-1a2b3c4d to instance i-1a2b3c4d
and exposes it as /dev/sdh. For information on standard storage
locations, see the Amazon Elastic Compute Cloud User Guide.
https://ec2.amazonaws.com/?Action=AttachVolume &VolumeId=vol-1a2b3c4d &InstanceId=i-1a2b3c4d &Device=/dev/sdh &AUTHPARAMS
<AttachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2013-02-01/"> <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> <volumeId>vol-1a2b3c4d</volumeId> <instanceId>i-1a2b3c4d</instanceId> <device>/dev/sdh</device> <status>attaching</status> <attachTime>YYYY-MM-DDTHH:MM:SS.000Z</attachTime> </AttachVolumeResponse>