Zend_Service_Amazon_Ec2-Ebs.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 Storage (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
  50. about the new Volume which includes the volumeId, size, zone, status, createTime and
  51. snapshotId.
  52. </para>
  53. <programlisting language="php"><![CDATA[
  54. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  55. $return = $ec2_ebs->createVolumeFromSnapshot('snap-78a54011', 'us-east-1a');
  56. ]]></programlisting>
  57. </example>
  58. <example id="zend.service.amazon.ec2.ebs.creating.snapshot">
  59. <title>Create a Snapshot of an EBS Volume</title>
  60. <para>
  61. Creating a Snapshot of an EBS Volume requires the volumeId of the EBS Volume.
  62. </para>
  63. <para>
  64. <code>createSnapshot</code> will return an array containing information about the
  65. new Volume Snapshot which includes the snapshotId, volumeId, status, startTime
  66. and progress.
  67. </para>
  68. <programlisting language="php"><![CDATA[
  69. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  70. $return = $ec2_ebs->createSnapshot('volumeId');
  71. ]]></programlisting>
  72. </example>
  73. </sect2>
  74. <sect2 id="zend.service.amazon.ec2.ebs.describing">
  75. <title>Describing EBS Volumes and Snapshots</title>
  76. <example id="zend.service.amazon.ec2.ebs.describing.volume">
  77. <title>Describing an EBS Volume</title>
  78. <para>
  79. <code>describeVolume</code> allows you to get information on an EBS Volume or a set
  80. of EBS Volumes. If nothing is passed in then it will return all EBS Volumes. If only
  81. one EBS Volume needs to be described a string can be passed in while an array of
  82. EBS Volume Id's can be passed in to describe them.
  83. </para>
  84. <para>
  85. <code>describeVolume</code> will return an array with information about each Volume
  86. which includes the volumeId, size, status and createTime. If the volume is attached
  87. to an instance, an addition value of attachmentSet will be returned. The attachment
  88. set contains information about the instance that the EBS Volume is attached to,
  89. which includes volumeId, instanceId, device, status and attachTime.
  90. </para>
  91. <programlisting language="php"><![CDATA[
  92. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  93. $return = $ec2_ebs->describeVolume('volumeId');
  94. ]]></programlisting>
  95. </example>
  96. <example id="zend.service.amazon.ec2.ebs.describing.attachedvolumes">
  97. <title>Describe Attached Volumes</title>
  98. <para>
  99. To return a list of EBS Volumes currently attached to a running instance you can
  100. call this method. It will only return EBS Volumes attached to the instance with the
  101. passed in instanceId.
  102. </para>
  103. <para>
  104. <code>describeAttachedVolumes</code> returns the same information as the
  105. <code>describeVolume</code> but only for the EBS Volumes that are currently attached
  106. to the specified instanceId.
  107. </para>
  108. <programlisting language="php"><![CDATA[
  109. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  110. $return = $ec2_ebs->describeAttachedVolumes('instanceId');
  111. ]]></programlisting>
  112. </example>
  113. <example id="zend.service.amazon.ec2.ebs.describing.snapshot">
  114. <title>Describe an EBS Volume Snapshot</title>
  115. <para>
  116. <code>describeSnapshot</code> allows you to get information on an EBS Volume
  117. Snapshot or a set of EBS Volume Snapshots. If nothing is passed in then it will
  118. return information about all EBS Volume Snapshots. If only one EBS Volume Snapshot
  119. needs to be described its snapshotId can be passed in while an array of EBS Volume
  120. Snapshot Id's can be passed in to describe them.
  121. </para>
  122. <para>
  123. <code>describeSnapshot</code> will return an array containing information about each
  124. EBS Volume Snapshot which includes the snapshotId, volumeId, status, startTime and
  125. progress.
  126. </para>
  127. <programlisting language="php"><![CDATA[
  128. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  129. $return = $ec2_ebs->describeSnapshot('volumeId');
  130. ]]></programlisting>
  131. </example>
  132. </sect2>
  133. <sect2 id="zend.service.amazon.ec2.ebs.attachdetach">
  134. <title>Attach and Detaching Volumes from Instances</title>
  135. <example id="zend.service.amazon.ec2.ebs.attachdetach.attach">
  136. <title>Attaching an EBS Volume</title>
  137. <para>
  138. <code>attachVolume</code> will attach an EBS Volume to a running Instance. To
  139. attach a volume you need to specify the volumeId, the instanceId and the
  140. device <emphasis>(ex: /dev/sdh)</emphasis>.
  141. </para>
  142. <para>
  143. <code>attachVolume</code> will return an array with information about the
  144. attach status which contains volumeId, instanceId, device, status and
  145. attachTime
  146. </para>
  147. <programlisting language="php"><![CDATA[
  148. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  149. $return = $ec2_ebs->attachVolume('volumeId', 'instanceid', '/dev/sdh');
  150. ]]></programlisting>
  151. </example>
  152. <example id="zend.service.amazon.ec2.ebs.attachdetach.detach">
  153. <title>Detaching an EBS Volume</title>
  154. <para>
  155. <code>detachVolume</code> will detach an EBS Volume from a running Instance.
  156. <code>detachVolume</code> requires that you specify the volumeId with the optional
  157. instanceId and device name that was passed when attaching the volume. If you need to
  158. force the detachment you can set the fourth parameter to be
  159. <constant>TRUE</constant> and it will force the volume to detach.
  160. </para>
  161. <para>
  162. <code>detachVolume</code> returns an array containing status information about
  163. the EBS Volume which includes volumeId, instanceId, device, status and attachTime.
  164. </para>
  165. <programlisting language="php"><![CDATA[
  166. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  167. $return = $ec2_ebs->detachVolume('volumeId');
  168. ]]></programlisting>
  169. </example>
  170. <note>
  171. <title>Forced Detach</title>
  172. <para>
  173. You should only force a detach if the previous detachment attempt did not occur
  174. cleanly (logging into an instance, unmounting the volume, and detaching normally).
  175. This option can lead to data loss or a corrupted file system. Use this option
  176. only as a last resort to detach a volume from a failed instance. The instance
  177. will not have an opportunity to flush file system caches or file system meta
  178. data. If you use this option, you must perform file system check and repair
  179. procedures.
  180. </para>
  181. </note>
  182. </sect2>
  183. <sect2 id="zend.service.amazon.ec2.ebs.deleting">
  184. <title>Deleting EBS Volumes and Snapshots</title>
  185. <example id="zend.service.amazon.ec2.ebs.deleting.volume">
  186. <title>Deleting an EBS Volume</title>
  187. <para>
  188. <code>deleteVolume</code> will delete an unattached EBS Volume.
  189. </para>
  190. <para>
  191. <code>deleteVolume</code> will return boolean <constant>TRUE</constant> or
  192. <constant>FALSE</constant>.
  193. </para>
  194. <programlisting language="php"><![CDATA[
  195. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  196. $return = $ec2_ebs->deleteVolume('volumeId');
  197. ]]></programlisting>
  198. </example>
  199. <example id="zend.service.amazon.ec2.ebs.deleting.snapshot">
  200. <title>Deleting an EBS Volume Snapshot</title>
  201. <para>
  202. <code>deleteSnapshot</code> will delete an EBS Volume Snapshot.
  203. </para>
  204. <para>
  205. <code>deleteSnapshot</code> returns boolean <constant>TRUE</constant> or
  206. <constant>FALSE</constant>.
  207. </para>
  208. <programlisting language="php"><![CDATA[
  209. $ec2_ebs = new Zend_Service_Amazon_Ec2_Ebs('aws_key','aws_secret_key');
  210. $return = $ec2_ebs->deleteSnapshot('snapshotId');
  211. ]]></programlisting>
  212. </example>
  213. </sect2>
  214. </sect1>