Detach Volume operation


The Detach Volume operation detaches an Amazon EBS volume from an instance.

The following figure shows a sample <items> XML element for the Detach Volume operation. 

Sample <items> XML element for the Detach Volume operation

<items>
   <item>
       <parameters>
           <volume-id></volume-id>
           <!--Optional:-->
           <instance-id></instance-id>
           <!--Optional:-->
           <device></device>
           <!--Optional:-->
           <force></force>
       </parameters>
   </item>
</items>

The following table shows adapter request elements for the Detach Volume operation. 

Adapter request elements for the Detach Volume operation

Element

Definition

Required

<wsdl-location>

Specifies the target Web Service Description Language (WSDL) URL for Amazon EC2

Examples:

Conditional:

  • Required if not specified in the request
  • If specified in the configuration and request, the value in the request overrides the value in the configuration
<endpoint-address>

Specifies the web service endpoint for the adapter to use while performing operations on Amazon EC2 instances across different regions
Default value: US East region: http://us-east-1.ec2.amazonaws.com/

No

<signature-properties>

Specifies the mode for signing the adapter request



Conditional:


  • Required if not specified in the configuration
  • If <signature-properties mode = "key-files">, requires <private-key-file>
    and <certificate-file>
  • If <signature-properties mode = "key-data">, requires <private-key-data> and <certificate-data>


<operation-name>

Contains the name of the operation: detach-volume

Yes

<volume-id>

Specifies the ID of the Amazon EBS volume that you want to detach

Yes

<instance-id>

Specifies the ID of the instance from which the volume is detached

No

<device>

Specifies the name of the device

No

<force>

Forces detachment if the previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally)

Note

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 will not have an opportunity to flush file system caches nor file system meta data. If you use this option, you must perform file system check and repair procedures.


No

The following figure shows a sample adapter request for the Detach Volume operation. 

Sample adapter request for the Detach Volume operation

amazon-ec2-request>
   <wsdl-location>http://ec2.amazonaws.com/doc/2009-11-30/</wsdl-location>
   <endpoint-address>http://us-east-1.ec2.amazonaws.com/</endpoint-address>
   <signature-properties mode = "key-files">
       <private-key-file>C:\Security\
pk-MJ5GIUNLM2XJ3VRJSYTKOFDWILELDQHB.PEM</private-key-file>
       <certificate-file>C:\Security\
cert-MJ5GIUNLM2XJ3VRJSYTKOFDWILELDQHB.PEM</certificate-file>
   </signature-properties>
   <operation-name>detach-volume</operation-name>
   <parameters>
       <volume-id>vol-e14fec88</volume-id>
       <!--Optional:-->
       <instance-id>i-e577f48e</instance-id>
       <!--Optional:-->
       <device>/dev/sdh</device>
       <!--Optional:-->
       <force>true</force>
   </parameters>
</amazon-ec2-request>

The following figure shows a sample adapter response for the Detach Volume operation. 

Sample adapter response for the Detach Volume operation

<amazon-ec2-response>
   <metadata>
       <status>success</status>
   </metadata>
   <DetachVolumeResponse>
       <requestId>3e1d2401-c665-4547-b5d0-fccc29f5c961</requestId>
       <volumeId>vol-e14fec88</volumeId>
       <instanceId>i-e577f48e</instanceId>
       <device>/dev/sdh</device>
       <status>detaching</status>
       <attachTime>2010-03-31T08:25:25.000Z</attachTime>
   </DetachVolumeResponse>
</amazon-ec2-response>

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*