Create Volume operation for the Amazon EC2 REST adapter


The Create Volume operation enables you to create a new Amazon EBS volume to which any Amazon EC2 instance can attach within the same Availability Zone. If created from a snapshot, any AWS Marketplace product codes from the snapshot are propagated to the volume.

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

Sample <items> XML element for the Create Volume operation

<items>
   <item>
       <parameters>
           <!-- One of the parameters - 'size' and 'snapshot-id' is required. -->
           <snapshot-id></snapshot-id>
           <size></size>
           <!-Optional:->
           <volume-type></volume-type>
           <!-Optional:->
           <iops></iops>
           <!-- mandatory -->
           <availability-zone></availability-zone>
       </parameters>
   </item>
</items>

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

Adapter request elements for the Create 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;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Access Key is specified, the adapter ignores the value.
<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;

  • You must specify the Access Key and theSecret Key together in the configuration or the adapter request.
  • If you specify both the keys in the adapter request and in the adapter configuration, the key values in the request override the values in the configuration.
  • If only the Secret Access Key is specified, the adapter ignores the value.
<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:

  • us-east-1
  • us-west-2 (default)
  • us-west-1
  • eu-west-1
  • ap-southeast-1
  • ap-northeast-1
  • ap-southeast-2
  • sa-east-1

No

<operation-name>

Contains the name of the operation: create-volume

Yes

<availability-zone>

Specifies the Availability Zone in which to create the new volume

Yes

<size>

Specifies the size of the volume, in GB

Valid values: 1 to 1024

Conditional; required when not creating a volume from a snapshot

<snapshot-id>

Specifies the snapshot from which to create the new volume

No

<volume-type>

Specifies the type of volume

Valid values: standard, io1

No

<iops>

Specifies the number of I/O operations per second (IOPS) that the volume supports.

Conditional; required when the volume time is io1, not used with standard volumes

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

Sample adapter request for the Create Volume operation

<amazon-ec2-rest-request>
   <operation-name>create-volume</operation-name>
   <region>us-west-2</region>
   <parameters>
     <size>1</size>
     <snapshot-id>snap-99cf03a8</snapshot-id>
     <availability-zone>us-west-2c</availability-zone>
   </parameters>
 </amazon-ec2-rest-request>

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

Sample adapter response for the Create Volume operation

<amazon-ec2-rest-response>
 <metadata>
   <status>success</status>
 </metadata>
 <CreateVolumeResponse>
   <volumeId>vol-38c92f34</volumeId>
   <size>1</size>
   <snapshotId>snap-99cf03a8</snapshotId>
   <availabilityZone>us-west-2c</availabilityZone>
   <status>creating</status>
   <createTime>Wed Jan 08 02:56:22 EST 2014</createTime>
   <volumeType>standard</volumeType>
   <iops />
 </CreateVolumeResponse>
</amazon-ec2-rest-response>

 

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