Zend_Service_Amazon_Ec2-Securitygroups.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect1 id="zend.service.amazon.ec2.securitygroups">
  4. <title>Zend_Service_Amazon_Ec2: Security Groups</title>
  5. <para>
  6. A security group is a named collection of access rules. These access
  7. rules specify which ingress (i.e., incoming) network traffic should
  8. be delivered to your instance. All other ingress traffic will be
  9. discarded.
  10. </para>
  11. <para>
  12. You can modify rules for a group at any time. The new rules are
  13. automatically enforced for all running instances and instances
  14. launched in the future.
  15. </para>
  16. <note>
  17. <title>Maximum Security Groups</title>
  18. <para>You can create up to 100 security groups.</para>
  19. </note>
  20. <sect2 id="zend.service.amazon.ec2.securitygroups.maintenance">
  21. <title>Security Group Maintenance</title>
  22. <example id="zend.service.amazon.ec2.securitygroups.maintenance.create">
  23. <title>Create a new Security Group</title>
  24. <para>
  25. <code>create</code> a new security group. Every instance is
  26. launched in a security group. If no security group is specified
  27. during launch, the instances are launched in the default security
  28. group. Instances within the same security group have unrestricted
  29. network access to each other. Instances will reject network access
  30. attempts from other instances in a different security group.
  31. </para>
  32. <para>
  33. <code>create</code> returns boolean true or false
  34. </para>
  35. <programlisting language="php"><![CDATA[
  36. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  37. 'aws_secret_key');
  38. $return = $ec2_sg->create('mygroup', 'my group description');
  39. ]]></programlisting>
  40. </example>
  41. <example id="zend.service.amazon.ec2.securitygroups.maintenance.describe">
  42. <title>Describe a Security Group</title>
  43. <para>
  44. <code>describe</code> returns information about security groups that
  45. you own.
  46. </para>
  47. <para>
  48. If you specify security group names, information about those security
  49. groups is returned. Otherwise, information for all security groups is
  50. returned. If you specify a group that does not exist, a fault is returned.
  51. </para>
  52. <para>
  53. <code>describe</code> will return an array containing information
  54. about security groups which includes the ownerId, groupName,
  55. groupDescription and an array containing all the rules for that security
  56. group.
  57. </para>
  58. <programlisting language="php"><![CDATA[
  59. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  60. 'aws_secret_key');
  61. $return = $ec2_sg->describe('mygroup');
  62. ]]></programlisting>
  63. </example>
  64. <example id="zend.service.amazon.ec2.securitygroups.maintenance.delete">
  65. <title>Delete a Security Group</title>
  66. <para>
  67. <code>delete</code> will remove the security group. If you attempt to
  68. delete a security group that contains instances, a fault is returned.
  69. If you attempt to delete a security group that is referenced by another
  70. security group, a fault is returned. For example, if security group B
  71. has a rule that allows access from security group A, security group A
  72. cannot be deleted until the allow rule is removed.
  73. </para>
  74. <para>
  75. <code>delete</code> returns boolean true or false.
  76. </para>
  77. <programlisting language="php"><![CDATA[
  78. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  79. 'aws_secret_key');
  80. $return = $ec2_sg->delete('mygroup');
  81. ]]></programlisting>
  82. </example>
  83. </sect2>
  84. <sect2 id="zend.service.amazon.ec2.securitygroups.authorize">
  85. <title>Authorizing Access</title>
  86. <example id="zend.service.amazon.ec2.securitygroups.authorize.ip">
  87. <title>Authorizing by IP</title>
  88. <para>
  89. <code>authorizeIp</code> Adds permissions to a security group based on
  90. an IP address, protocol type and port range.
  91. </para>
  92. <para>
  93. Permissions are specified by the IP protocol (TCP, UDP or ICMP), the
  94. source of the request (by IP range or an Amazon EC2 user-group pair),
  95. the source and destination port ranges (for TCP and UDP), and the
  96. ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used
  97. as a wildcard in the type and code fields.
  98. </para>
  99. <para>
  100. Permission changes are propagated to instances within the security group
  101. as quickly as possible. However, depending on the number of instances, a
  102. small delay might occur.
  103. </para>
  104. <para>
  105. <code>authorizeIp</code> returns boolean true or false
  106. </para>
  107. <programlisting language="php"><![CDATA[
  108. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  109. 'aws_secret_key');
  110. $return = $ec2_sg->authorizeIp('mygroup',
  111. 'protocol',
  112. 'fromPort',
  113. 'toPort',
  114. 'ipRange');
  115. ]]></programlisting>
  116. </example>
  117. <example id="zend.service.amazon.ec2.securitygroups.authorize.group">
  118. <title>Authorize By Group</title>
  119. <para>
  120. <code>authorizeGroup</code> Adds permissions to a security group.
  121. </para>
  122. <para>
  123. Permission changes are propagated to instances within the security group
  124. as quickly as possible. However, depending on the number of instances, a
  125. small delay might occur.
  126. </para>
  127. <para>
  128. <code>authorizeGroup</code> returns boolean true or false.
  129. </para>
  130. <programlisting language="php"><![CDATA[
  131. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  132. 'aws_secret_key');
  133. $return = $ec2_sg->authorizeGroup('mygroup', 'securityGroupName', 'ownerId');
  134. ]]></programlisting>
  135. </example>
  136. </sect2>
  137. <sect2 id="zend.service.amazon.ec2.securitygroups.revoke">
  138. <title>Revoking Access</title>
  139. <example id="zend.service.amazon.ec2.securitygroups.revoke.ip">
  140. <title>Revoke by IP</title>
  141. <para>
  142. <code>revokeIp</code> Revokes permissions to a security group based on
  143. an IP address, protocol type and port range. The permissions used to revoke
  144. must be specified using the same values used to grant the permissions.
  145. </para>
  146. <para>
  147. Permissions are specified by the IP protocol (TCP, UDP or ICMP), the
  148. source of the request (by IP range or an Amazon EC2 user-group pair),
  149. the source and destination port ranges (for TCP and UDP), and the
  150. ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used
  151. as a wildcard in the type and code fields.
  152. </para>
  153. <para>
  154. Permission changes are propagated to instances within the security group
  155. as quickly as possible. However, depending on the number of instances, a
  156. small delay might occur.
  157. </para>
  158. <para>
  159. <code>revokeIp</code> returns boolean true or false
  160. </para>
  161. <programlisting language="php"><![CDATA[
  162. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  163. 'aws_secret_key');
  164. $return = $ec2_sg->revokeIp('mygroup',
  165. 'protocol',
  166. 'fromPort',
  167. 'toPort',
  168. 'ipRange');
  169. ]]></programlisting>
  170. </example>
  171. <example id="zend.service.amazon.ec2.securitygroups.revoke.group">
  172. <title>Revoke By Group</title>
  173. <para>
  174. <code>revokeGroup</code> Adds permissions to a security group. The permissions
  175. to revoke must be specified using the same values used to grant the
  176. permissions.
  177. </para>
  178. <para>
  179. Permission changes are propagated to instances within the security group
  180. as quickly as possible. However, depending on the number of instances, a
  181. small delay might occur.
  182. </para>
  183. <para>
  184. <code>revokeGroup</code> returns boolean true or false.
  185. </para>
  186. <programlisting language="php"><![CDATA[
  187. $ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups('aws_key',
  188. 'aws_secret_key');
  189. $return = $ec2_sg->revokeGroup('mygroup', 'securityGroupName', 'ownerId');
  190. ]]></programlisting>
  191. </example>
  192. </sect2>
  193. </sect1>