|« PreviousNext »|
|Did this page help you? Yes | No | Tell us about it...|
Attaches an Amazon EBS volume to a running or stopped instance and exposes it to the instance with the specified device name.
Encrypted Amazon EBS volumes can be attached only to instances that support Amazon EBS encryption. For more information, see Amazon EBS encryption in the Amazon Elastic Compute Cloud User Guide.
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 in the Amazon Elastic Compute Cloud User Guide.
If a volume has an AWS Marketplace product code:
The volume can be attached only to the root device of a stopped instance.
AWS Marketplace product codes are copied from the volume to the instance.
You must be subscribed to the product.
The instance type and operating system of the instance must support the product. For example, you can't detach a volume from a Windows instance and attach it to a Linux instance.
For an overview of the AWS Marketplace, see Introducing AWS Marketplace.
For information about the common parameters that all actions use, see Common Query Parameters.
The ID of the volume. The volume and instance must be in the same Availability Zone.
The ID of the instance. The instance and volume must be in the same Availability Zone.
The device name to expose to the instance (for example,
The following elements are returned in an
The ID of the request.
The ID of the volume.
The ID of the instance.
The device name.
The attachment state of the volume.
The time stamp when the attachment initiated.
The following are some of the client API errors you might encounter when using this request. For more information about common API errors, see Common Causes of Client Errors. For a summary of API error codes, see Client Error Codes.
This example request attaches the volume with the ID
vol-1a2b3c4d to the instance
with the ID
i-1a2b3c4d and exposes it as
https://ec2.amazonaws.com/?Action=AttachVolume &VolumeId=vol-1a2b3c4d &InstanceId=i-1a2b3c4d &Device=/dev/sdh &AUTHPARAMS
<AttachVolumeResponse xmlns="http://ec2.amazonaws.com/doc/2014-06-15/"> <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>