Zend_Service_Amazon_Ec2-Image.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.amazon.ec2.images">
  4. <title>Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)</title>
  5. <para>
  6. Amazon Machine Images (AMIs) are preconfigured with an ever-growing list
  7. of operating systems.
  8. </para>
  9. <sect2 id="zend.service.amazon.ec2.images.info">
  10. <title>AMI Information Utilities</title>
  11. <example id="zend.service.amazon.ec2.images.register">
  12. <title>Register an AMI with EC2</title>
  13. <para>
  14. <code>register</code> Each <acronym>AMI</acronym> is associated with an unique ID which
  15. is provided by the Amazon EC2 service through the RegisterImage
  16. operation. During registration, Amazon EC2 retrieves the specified
  17. image manifest from Amazon S3 and verifies that the image is owned by
  18. the user registering the image.
  19. </para>
  20. <para>
  21. <code>register</code> returns the imageId for the registered Image.
  22. </para>
  23. <programlisting language="php"><![CDATA[
  24. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  25. $ip = $ec2_img->register('imageLocation');
  26. ]]></programlisting>
  27. </example>
  28. <example id="zend.service.amazon.ec2.images.deregister">
  29. <title>Deregister an AMI with EC2</title>
  30. <para>
  31. <code>deregister</code>, Deregisters an <acronym>AMI</acronym>. Once deregistered, instances
  32. of the <acronym>AMI</acronym> can no longer be launched.
  33. </para>
  34. <para>
  35. <code>deregister</code> returns boolean <constant>TRUE</constant> or
  36. <constant>FALSE</constant>.
  37. </para>
  38. <programlisting language="php"><![CDATA[
  39. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  40. $ip = $ec2_img->deregister('imageId');
  41. ]]></programlisting>
  42. </example>
  43. <example id="zend.service.amazon.ec2.images.describe">
  44. <title>Describe an AMI</title>
  45. <para>
  46. <code>describe</code> Returns information about <acronym>AMI</acronym>s, AKIs, and ARIs
  47. available to the user. Information returned includes image type,
  48. product codes, architecture, and kernel and <acronym>RAM</acronym> disk IDs. Images
  49. available to the user include public images available for any user
  50. to launch, private images owned by the user making the request,
  51. and private images owned by other users for which the user has
  52. explicit launch permissions.
  53. </para>
  54. <para>
  55. <table id="zend.service.amazon.ec2.images.describe-table">
  56. <title>Launch permissions fall into three categories</title>
  57. <tgroup cols="2">
  58. <thead>
  59. <row>
  60. <entry>Name</entry>
  61. <entry>Description</entry>
  62. </row>
  63. </thead>
  64. <tbody>
  65. <row>
  66. <entry><code>public</code></entry>
  67. <entry><para>
  68. The owner of the <acronym>AMI</acronym> granted launch permissions for the <acronym>AMI</acronym>
  69. to the all group. All users have launch permissions for these <constant>AMIs</constant>.
  70. </para></entry>
  71. </row>
  72. <row>
  73. <entry><code>explicit</code></entry>
  74. <entry><para>
  75. The owner of the <acronym>AMI</acronym> granted launch permissions to a specific user.
  76. </para></entry>
  77. </row>
  78. <row>
  79. <entry><code>implicit</code></entry>
  80. <entry><para>
  81. A user has implicit launch permissions for all <constant>AMIs</constant> he or she owns.
  82. </para></entry>
  83. </row>
  84. </tbody>
  85. </tgroup>
  86. </table>
  87. </para>
  88. <para>
  89. The list of <acronym>AMI</acronym>s returned can be modified by specifying <acronym>AMI</acronym> IDs, <acronym>AMI</acronym> owners,
  90. or users with launch permissions. If no options are specified, Amazon EC2 returns
  91. all <acronym>AMI</acronym>s for which the user has launch permissions.
  92. </para>
  93. <para>
  94. If you specify one or more <acronym>AMI</acronym> IDs, only <acronym>AMI</acronym>s that have the specified IDs are returned.
  95. If you specify an invalid <acronym>AMI</acronym> ID, a fault is returned. If you specify an <acronym>AMI</acronym> ID for which
  96. you do not have access, it will not be included in the returned results.
  97. </para>
  98. <para>
  99. If you specify one or more <acronym>AMI</acronym> owners, only <acronym>AMI</acronym>s from the specified owners and for
  100. which you have access are returned. The results can include the account IDs of the
  101. specified owners, amazon for <acronym>AMI</acronym>s owned by Amazon or self for <acronym>AMI</acronym>s that you own.
  102. </para>
  103. <para>
  104. If you specify a list of executable users, only users that have launch permissions
  105. for the <acronym>AMI</acronym>s are returned. You can specify account IDs (if you own the <acronym>AMI</acronym>(s)), self
  106. for <acronym>AMI</acronym>s for which you own or have explicit permissions, or all for public <acronym>AMI</acronym>s.
  107. </para>
  108. <para>
  109. <code>describe</code> returns an array for all the images that match the critera that was
  110. passed in. The array contains the imageId, imageLocation, imageState, imageOwnerId, isPublic,
  111. architecture, imageType, kernelId, ramdiskId and platform.
  112. </para>
  113. <programlisting language="php"><![CDATA[
  114. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  115. $ip = $ec2_img->describe();
  116. ]]></programlisting>
  117. </example>
  118. </sect2>
  119. <sect2 id="zend.service.amazon.ec2.images.attribute">
  120. <title>AMI Attribute Utilities</title>
  121. <example id="zend.service.amazon.ec2.images.attribute.modify">
  122. <title>Modify Image Attributes</title>
  123. <para>Modifies an attribute of an <acronym>AMI</acronym></para>
  124. <para>
  125. <table id="zend.service.amazon.ec2.images.attribute.modify-table">
  126. <title>Valid Attributes</title>
  127. <tgroup cols="2">
  128. <thead>
  129. <row>
  130. <entry>Name</entry>
  131. <entry>Description</entry>
  132. </row>
  133. </thead>
  134. <tbody>
  135. <row>
  136. <entry><code>launchPermission</code></entry>
  137. <entry><para>
  138. Controls who has permission to launch the <acronym>AMI</acronym>. Launch permissions
  139. can be granted to specific users by adding userIds.
  140. </para><para>To make the <acronym>AMI</acronym> public, add the all group.</para></entry>
  141. </row>
  142. <row>
  143. <entry><code>productCodes</code></entry>
  144. <entry><para>
  145. Associates a product code with <constant>AMIs</constant>. This allows developers to
  146. charge users for using <constant>AMIs</constant>. The user must be signed up for the
  147. product before they can launch the <acronym>AMI</acronym>.
  148. <emphasis>This is a write once attribute;
  149. after it is set, it cannot be changed or
  150. removed.</emphasis>
  151. </para></entry>
  152. </row>
  153. </tbody>
  154. </tgroup>
  155. </table>
  156. </para>
  157. <para>
  158. <code>modifyAttribute</code> returns boolean <constant>TRUE</constant> or
  159. <constant>FALSE</constant>.
  160. </para>
  161. <programlisting language="php"><![CDATA[
  162. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  163. // modify the launchPermission of an AMI
  164. $return = $ec2_img->modifyAttribute('imageId',
  165. 'launchPermission',
  166. 'add',
  167. 'userId',
  168. 'userGroup');
  169. // set the product code of the AMI.
  170. $return = $ec2_img->modifyAttribute('imageId',
  171. 'productCodes',
  172. 'add',
  173. null,
  174. null,
  175. 'productCode');
  176. ]]></programlisting>
  177. </example>
  178. <example id="zend.service.amazon.ec2.images.attribute.reset">
  179. <title>Reset an AMI Attribute</title>
  180. <para>
  181. <code>resetAttribute</code> will reset the attribute of an <acronym>AMI</acronym> to its default value.
  182. <emphasis>The productCodes attribute cannot be reset.</emphasis>
  183. </para>
  184. <programlisting language="php"><![CDATA[
  185. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  186. $return = $ec2_img->resetAttribute('imageId', 'launchPermission');
  187. ]]></programlisting>
  188. </example>
  189. <example id="zend.service.amazon.ec2.images.attribute.describe">
  190. <title>Describe AMI Attribute</title>
  191. <para>
  192. <code>describeAttribute</code> returns information about an attribute of an <acronym>AMI</acronym>.
  193. Only one attribute can be specified per call. Currently only launchPermission and
  194. productCodes are supported.
  195. </para>
  196. <para>
  197. <code>describeAttribute</code> returns an array with the value of the attribute
  198. that was requested.
  199. </para>
  200. <programlisting language="php"><![CDATA[
  201. $ec2_img = new Zend_Service_Amazon_Ec2_Image('aws_key','aws_secret_key');
  202. $return = $ec2_img->describeAttribute('imageId', 'launchPermission');
  203. ]]></programlisting>
  204. </example>
  205. </sect2>
  206. </sect1>