| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Detaches an Amazon EBS volume from an instance. Make sure to unmount any file systems on the device within your operating system before detaching the volume. Failure to do so will result in volume being stuck in "busy" state while detaching. For more information about Amazon EBS, see Using Amazon Elastic Block Store in the Amazon Elastic Compute Cloud User Guide.
Note
If an Amazon EBS volume is the root device of an instance, it cannot be detached while the instance is in the "running" state. To detach the root volume, stop the instance first.
If the root volume is detached from an instance with an AWS Marketplace product code, then the AWS Marketplace product codes from that volume are no longer associated with the instance.
VolumeIdThe ID of the volume.
Type: String
Default: None
Required: Yes
InstanceIdThe ID of the instance.
Type: String
Default: None
Required: No
DeviceThe device name.
Type: String
Default: None
Required: No
ForceForces detachment if the previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach a volume from a failed instance. The instance won't have an opportunity to flush file system caches or file system metadata. If you use this option, you must perform file system check and repair procedures.
Type: Boolean
Default: None
Required: No
The following elements are returned in a
DetachVolumeResponse 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 exposed to the instance.
Type: xsd:string
statusThe attachment state.
Type: xsd:string
Valid values: attaching |
attached | detaching |
detached
attachTimeThe time stamp when the attachment initiated.
Type: xsd:dateTime
This example detaches volume vol-1a2b3c4d.
https://ec2.amazonaws.com/?Action=DetachVolume &VolumeId=vol-1a2b3c4d &AUTHPARAMS
<DetachVolumeResponse 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>detaching</status> <attachTime>YYYY-MM-DDTHH:MM:SS.000Z</attachTime> </DetachVolumeResponse>