Attach Volume operation for the Amazon EC2 REST adapter
The Attach Volume operation attaches an Amazon EBS volume to a running instance and exposes the instance as the specified device.
The following figure shows a sample <items> XML element for the Attach Volume operation.
Sample <items> XML element for the Attach Volume operation
<item>
<parameters>
<volume-id></volume-id>
<instance-id></instance-id>
<device></device>
</parameters>
</item>
</items>
The following table shows adapter request elements for the Attach Volume operation.
Adapter request elements for the Attach Volume operation
Element | Definition | Required |
---|---|---|
<access-key> | Specifies the Amazon Web Services (AWS) access key You need to generate the AWS access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<secret-key> | Specifies the AWS secret access key You need to generate the AWS secret access key by going to the Security Credentials tab in the AWS console. | Conditional;
|
<session-token> | Specifies the temporary session token generated using the AWS APIs. | Conditional; You must specify the Access Key and Secret Key as well in the configuration or the adapter request, else the <session-token> value is ignored. |
<region> | Specifies the region with which you want the adapter to communicate Amazon EC2 is hosted in multiple locations world-wide. You must specify the region in which you want the adapter to perform the actions. Valid values:
| No |
<operation-name> | Contains the name of the operation: attach-volume | Yes |
<volume-id> | Specifies the ID of the Amazon EBS volume The volume and instance must be within the same Availability Zone and the instance must be running. | Yes |
<instance-id> | Specifies 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. | Yes |
<device> | Specifies how the device is exposed to the instance For example, /dev/sdh | Yes |
The following figure shows a sample adapter request for the Attach Volume operation.
Sample adapter request for the Attach Volume operation
<operation-name>attach-volume</operation-name>
<parameters>
<volume-id>vol-4b410e45</volume-id>
<instance-id>i-8ae53c83</instance-id>
<device>/dev/sdf</device>
</parameters>
</amazon-ec2-rest-request>
The following figure shows a sample adapter response for the Attach Volume operation.
Sample adapter response for the Attach Volume operation
<metadata>
<status>success</status>
</metadata>
<AttachVolumeResponse>
<volumeId>vol-4b410e45</volumeId>
<instanceId>i-8ae53c83</instanceId>
<device>/dev/sdf</device>
<status>attaching</status>
<attachmentTime>Thu Jan 09 05:08:52 EST 2014</attachmentTime>
<deleteOnTermination />
</AttachVolumeResponse>
</amazon-ec2-rest-response>