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