Zend_Service_Amazon_Ec2-Ebs.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.amazon.ec2.ebs">
  4. <title>Zend_Service_Amazon_Ec2: Elastic Block Stroage (EBS)</title>
  5. <para>
  6. Amazon Elastic Block Store (Amazon EBS) is a new type of storage
  7. designed specifically for Amazon EC2 instances. Amazon EBS allows
  8. you to create volumes that can be mounted as devices by Amazon EC2
  9. instances. Amazon EBS volumes behave like raw unformatted external
  10. block devices. They have user supplied device names and provide a block
  11. device interface. You can load a file system on top of Amazon EBS volumes,
  12. or use them just as you would use a block device.
  13. </para>
  14. <para>
  15. You can create up to twenty Amazon EBS volumes of any size (from one GiB up
  16. to one TiB). Each Amazon EBS volume can be attached to any Amazon EC2
  17. instance in the same Availability Zone or can be left unattached.
  18. </para>
  19. <para>
  20. Amazon EBS provides the ability to create snapshots of your Amazon EBS volumes
  21. to Amazon S3. You can use these snapshots as the starting point for new Amazon
  22. EBS volumes and can protect your data for long term durability.
  23. </para>
  24. <sect2 id="zend.service.amazon.ec2.ebs.creating">
  25. <title>Create EBS Volumes and Snapshots</title>
  26. <example id="zend.service.amazon.ec2.ebs.creating.volume">
  27. <title>Create a new EBS Volume</title>
  28. <para>
  29. Creating a brand new EBS Volume requires the size and which zone you
  30. want the EBS Volume to be in.
  31. </para>
  32. <para>
  33. <code>createNewVolume</code> will return an array containing information
  34. about the new Volume which includes the volumeId, size, zone, status
  35. and createTime.
  36. </para>
  37. <programlisting language="php"><![CDATA[
  38. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  39. $return = $ec2_ebs->createNewVolume(40, 'us-east-1a');
  40. ]]></programlisting>
  41. </example>
  42. <example id="zend.service.amazon.ec2.ebs.creating.volumesnapshot">
  43. <title>Create an EBS Volume from a Snapshot</title>
  44. <para>
  45. Creating an EBS Volume from a snapshot requires the snapshot_id and which zone you
  46. want the EBS Volume to be in.
  47. </para>
  48. <para>
  49. <code>createVolumeFromSnapshot</code> will return an array containing information about
  50. the new Volume which includes the volumeId, size, zone, status, createTime and snapshotId.
  51. </para>
  52. <programlisting language="php"><![CDATA[
  53. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  54. $return = $ec2_ebs->createVolumeFromSnapshot('snap-78a54011', 'us-east-1a');
  55. ]]></programlisting>
  56. </example>
  57. <example id="zend.service.amazon.ec2.ebs.creating.snapshot">
  58. <title>Create a Snapshot of an EBS Volume</title>
  59. <para>
  60. Creating a Snapshot of an EBS Volume requires the volumeId of the EBS Volume.
  61. </para>
  62. <para>
  63. <code>createSnapshot</code> will return an array containing information about the
  64. new Volume Snapshot which includes the snapshotId, volumeId, status, startTime
  65. and progress.
  66. </para>
  67. <programlisting language="php"><![CDATA[
  68. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  69. $return = $ec2_ebs->createSnapshot('volumeId');
  70. ]]></programlisting>
  71. </example>
  72. </sect2>
  73. <sect2 id="zend.service.amazon.ec2.ebs.describing">
  74. <title>Describing EBS Volumes and Snapshots</title>
  75. <example id="zend.service.amazon.ec2.ebs.describing.volume">
  76. <title>Describing an EBS Volume</title>
  77. <para>
  78. <code>describeVolume</code> allows you to get information on an EBS Volume or a set of EBS
  79. Volumes. If nothing is passed in then it will return all EBS Volumes. If only
  80. one EBS Volume needs to be described a string can be passed in while an array of
  81. EBS Volume Id's can be passed in to describe them.
  82. </para>
  83. <para>
  84. <code>describeVolume</code> will return an array with information about each Volume which
  85. includes the volumeId, size, status and createTime. If the volume is attached to an instance,
  86. an addition value of attachmentSet will be returned. The attachment set contains information
  87. about the instance that the EBS Volume is attached to, which includes volumeId, instanceId,
  88. device, status and attachTime.
  89. </para>
  90. <programlisting language="php"><![CDATA[
  91. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  92. $return = $ec2_ebs->describeVolume('volumeId');
  93. ]]></programlisting>
  94. </example>
  95. <example id="zend.service.amazon.ec2.ebs.describing.attachedvolumes">
  96. <title>Describe Attached Volumes</title>
  97. <para>
  98. To return a list of EBS Volumes currently attached to a running instance you can call this method.
  99. It will only return EBS Volumes attached to the instance with the passed in instanceId.
  100. </para>
  101. <para>
  102. <code>describeAttachedVolumes</code> returns the same information as the <code>describeVolume</code>
  103. but only for the EBS Volumes that are currently attached to the specified instanceId.
  104. </para>
  105. <programlisting language="php"><![CDATA[
  106. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  107. $return = $ec2_ebs->describeAttachedVolumes('instanceId');
  108. ]]></programlisting>
  109. </example>
  110. <example id="zend.service.amazon.ec2.ebs.describing.snapshot">
  111. <title>Describe an EBS Volume Snapshot</title>
  112. <para>
  113. <code>describeSnapshot</code> allows you to get information on an EBS Volume Snapshot
  114. or a set of EBS Volume Snapshots. If nothing is passed in then it will return information
  115. about all EBS Volume Snapshots. If only one EBS Volume Snapshot needs to be described its
  116. snapshotId can be passed in while an array of EBS Volume Snapshot Id's can be passed in to
  117. describe them.
  118. </para>
  119. <para>
  120. <code>describeSnapshot</code> will return an array containing information about each EBS Volume Snapshot
  121. which includes the snapshotId, volumeId, status, startTime and progress.
  122. </para>
  123. <programlisting language="php"><![CDATA[
  124. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  125. $return = $ec2_ebs->describeSnapshot('volumeId');
  126. ]]></programlisting>
  127. </example>
  128. </sect2>
  129. <sect2 id="zend.service.amazon.ec2.ebs.attachdetach">
  130. <title>Attach and Detaching Volumes from Instances</title>
  131. <example id="zend.service.amazon.ec2.ebs.attachdetach.attach">
  132. <title>Attaching an EBS Volume</title>
  133. <para>
  134. <code>attachVolume</code> will attach an EBS Volume to a running Instance. To
  135. attach a volume you need to specify the volumeId, the instanceId and the
  136. device <emphasis>(ex: /dev/sdh)</emphasis>.
  137. </para>
  138. <para>
  139. <code>attachVolume</code> will return an array with information about the
  140. attach status which contains volumeId, instanceId, device, status and
  141. attachTime
  142. </para>
  143. <programlisting language="php"><![CDATA[
  144. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  145. $return = $ec2_ebs->attachVolume('volumeId', 'instanceid', '/dev/sdh');
  146. ]]></programlisting>
  147. </example>
  148. <example id="zend.service.amazon.ec2.ebs.attachdetach.detach">
  149. <title>Detaching an EBS Volume</title>
  150. <para>
  151. <code>detachVolume</code> will detach an EBS Volume from a running Instance.
  152. <code>detachVolume</code> requires that you specify the volumeId with the optional
  153. instanceId and device name that was passed when attaching the volume. If you need to
  154. force the detachment you can set the forth parameter to be true and it will force
  155. the volume to detach.
  156. </para>
  157. <para>
  158. <code>detachVolume</code> returns an array containing status information about
  159. the EBS Volume which includes volumeId, instanceId, device, status and attachTime.
  160. </para>
  161. <programlisting language="php"><![CDATA[
  162. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  163. $return = $ec2_ebs->detachVolume('volumeId');
  164. ]]></programlisting>
  165. </example>
  166. <note>
  167. <title>Forced Detach</title>
  168. <para>
  169. You should only force a detach if the previous detachment attempt did not occur
  170. cleanly (logging into an instance, unmounting the volume, and detaching normally).
  171. This option can lead to data loss or a corrupted file system. Use this option
  172. only as a last resort to detach a volume from a failed instance. The instance
  173. will not have an opportunity to flush file system caches or file system meta
  174. data. If you use this option, you must perform file system check and repair
  175. procedures.
  176. </para>
  177. </note>
  178. </sect2>
  179. <sect2 id="zend.service.amazon.ec2.ebs.deleting">
  180. <title>Deleting EBS Volumes and Snapshots</title>
  181. <example id="zend.service.amazon.ec2.ebs.deleting.volume">
  182. <title>Deleting an EBS Volume</title>
  183. <para>
  184. <code>deleteVolume</code> will delete an unattached EBS Volume.
  185. </para>
  186. <para>
  187. <code>deleteVolume</code> will return boolean true or false.
  188. </para>
  189. <programlisting language="php"><![CDATA[
  190. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  191. $return = $ec2_ebs->deleteVolume('volumeId');
  192. ]]></programlisting>
  193. </example>
  194. <example id="zend.service.amazon.ec2.ebs.deleting.snapshot">
  195. <title>Deleting an EBS Volume Snapshot</title>
  196. <para>
  197. <code>deleteSnapshot</code> will delete an EBS Volume Snapshot.
  198. </para>
  199. <para>
  200. <code>deleteSnapshot</code> returns booleen true or false.
  201. </para>
  202. <programlisting language="php"><![CDATA[
  203. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  204. $return = $ec2_ebs->deleteSnapshot('snapshotId');
  205. ]]></programlisting>
  206. </example>
  207. </sect2>
  208. </sect1>