| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.service.amazon.ec2.instance">
- <title>Zend_Service_Amazon_Ec2: Instances</title>
- <sect2 id="zend.service.amazon.ec2.instance.types">
- <title>Instance Types</title>
- <para>
- Amazon EC2 instances are grouped into two families: standard and
- High-CPU. Standard instances have memory to <acronym>CPU</acronym> ratios suitable
- for most general purpose applications; High-CPU instances have
- proportionally more <acronym>CPU</acronym> resources than memory (RAM) and are well
- suited for compute-intensive applications. When selecting instance
- types, you might want to use less powerful instance types for your
- web server instances and more powerful instance types for your
- database instances. Additionally, you might want to run <acronym>CPU</acronym> instance
- types for <acronym>CPU</acronym>-intensive data processing tasks.
- </para>
- <para>
- One of the advantages of EC2 is that you pay by the instance hour,
- which makes it convenient and inexpensive to test the performance of
- your application on different instance families and types. One good
- way to determine the most appropriate instance family and instance
- type is to launch test instances and benchmark your application.
- </para>
- <note>
- <title>Instance Types</title>
- <para>
- The instance types are defined as constants in the code. Column eight
- in the table is the defined constant name
- </para>
- </note>
- <table id="zend.service.amazon.ec2.instance.types-table">
- <title>Available Instance Types</title>
- <tgroup cols="8">
- <thead>
- <row>
- <entry>Type</entry>
- <entry><acronym>CPU</acronym></entry>
- <entry>Memory</entry>
- <entry>Storage</entry>
- <entry>Platform</entry>
- <entry>I/O</entry>
- <entry>Name</entry>
- <entry>Constant Name</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><code>Small</code></entry>
- <entry>
- <para>
- 1 <constant>EC2</constant> Compute Unit (1 virtual core with 1
- <constant>EC2</constant> Compute Unit)
- </para>
- </entry>
- <entry><para>1.7 GB</para></entry>
- <entry>
- <para>160 GB instance storage (150 GB plus 10 GB root partition)</para>
- </entry>
- <entry><para>32-bit</para></entry>
- <entry><para>Moderate</para></entry>
- <entry><para>m1.small</para></entry>
- <entry><constant>Zend_Service_Amazon_Ec2_Instance::SMALL</constant></entry>
- </row>
- <row>
- <entry><code>Large</code></entry>
- <entry>
- <para>
- 4 <constant>EC2</constant> Compute Units (2 virtual cores with 2
- <constant>EC2</constant> Compute Units each)
- </para>
- </entry>
- <entry><para>7.5 GB</para></entry>
- <entry>
- <para>
- 850 GB instance storage (2 x 420 GB plus 10 GB root partition)
- </para>
- </entry>
- <entry><para>64-bit</para></entry>
- <entry><para>High</para></entry>
- <entry><para>m1.large</para></entry>
- <entry><constant>Zend_Service_Amazon_Ec2_Instance::LARGE</constant></entry>
- </row>
- <row>
- <entry><code>Extra Large</code></entry>
- <entry>
- <para>
- 8 <constant>EC2</constant> Compute Units (4 virtual cores with 2
- <constant>EC2</constant> Compute Units each)
- </para>
- </entry>
- <entry><para>15 GB</para></entry>
- <entry>
- <para>
- 1,690 GB instance storage (4 x 420 GB plus 10 GB root partition)
- </para>
- </entry>
- <entry><para>64-bit</para></entry>
- <entry><para>High</para></entry>
- <entry><para>m1.xlarge</para></entry>
- <entry><constant>Zend_Service_Amazon_Ec2_Instance::XLARGE</constant></entry>
- </row>
- <row>
- <entry><code>High-CPU Medium</code></entry>
- <entry>
- <para>
- 5 <constant>EC2</constant> Compute Units (2 virtual cores with 2.5
- <constant>EC2</constant> Compute Units each)
- </para>
- </entry>
- <entry><para>1.7 GB</para></entry>
- <entry>
- <para>350 GB instance storage (340 GB plus 10 GB root partition)</para>
- </entry>
- <entry><para>32-bit</para></entry>
- <entry><para>Moderate</para></entry>
- <entry><para>c1.medium</para></entry>
- <entry>
- <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_MEDIUM</constant>
- </entry>
- </row>
- <row>
- <entry><code>High-CPU Extra Large</code></entry>
- <entry>
- <para>
- 20 <constant>EC2</constant> Compute Units (8 virtual cores with 2.5
- <constant>EC2</constant> Compute Units each)
- </para>
- </entry>
- <entry><para>7 GB</para></entry>
- <entry>
- <para>
- 1,690 GB instance storage (4 x 420 GB plus 10 GB root partition)
- </para>
- </entry>
- <entry><para>64-bit</para></entry>
- <entry><para>High</para></entry>
- <entry><para>c1.xlarge</para></entry>
- <entry>
- <constant>Zend_Service_Amazon_Ec2_Instance::HCPU_XLARGE</constant>
- </entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </sect2>
- <sect2 id="zend.service.amazon.ec2.instance.operations">
- <title>Running Amazon EC2 Instances</title>
- <para>
- This section describes the operation methods for maintaining Amazon EC2 Instances.
- </para>
- <example id="zend.service.amazon.ec2.instance.operations.run">
- <title>Starting New Ec2 Instances</title>
- <para>
- <code>run</code> will launch a specified number of EC2 Instances.
- <code>run</code> takes an array of parameters to start, below is a table
- containing the valid values.
- </para>
- <para>
- <table id="zend.service.amazon.ec2.instance.operations.run-table">
- <title>Valid Run Options</title>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>Name</entry>
- <entry>Description</entry>
- <entry>Required</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><code>imageId</code></entry>
- <entry>
- <para>
- ID of the <acronym>AMI</acronym> with which to launch
- instances.
- </para>
- </entry>
- <entry><para>Yes</para></entry>
- </row>
- <row>
- <entry><code>minCount</code></entry>
- <entry>
- <para>Minimum number of instances to launch. Default: 1</para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>maxCount</code></entry>
- <entry>
- <para>Maximum number of instances to launch. Default: 1</para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>keyName</code></entry>
- <entry>
- <para>
- Name of the key pair with which to launch instances.
- If you do not provide a key, all instances will
- be inaccessible.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>securityGroup</code></entry>
- <entry>
- <para>
- Names of the security groups with which to associate
- the instances.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>userData</code></entry>
- <entry>
- <para>
- The user data available to the launched instances.
- This should not be Base64 encoded.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>instanceType</code></entry>
- <entry>
- <para>
- Specifies the instance type. Default: m1.small
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>placement</code></entry>
- <entry>
- <para>
- Specifies the availability zone in which to
- launch the instance(s). By default, Amazon
- <constant>EC2</constant> selects an availability zone for
- you.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>kernelId</code></entry>
- <entry>
- <para>
- The ID of the kernel with which to launch
- the instance.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>ramdiskId</code></entry>
- <entry>
- <para>
- The ID of the <acronym>RAM</acronym> disk with which to
- launch the instance.
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>blockDeviceVirtualName</code></entry>
- <entry>
- <para>
- Specifies the virtual name to map to the
- corresponding device name. For example:
- instancestore0
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>blockDeviceName</code></entry>
- <entry>
- <para>
- Specifies the device to which you are
- mapping a virtual name. For example: sdb
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- <row>
- <entry><code>monitor</code></entry>
- <entry>
- <para>
- Turn on <acronym>AWS</acronym> CloudWatch Instance
- Monitoring
- </para>
- </entry>
- <entry><para>No</para></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </para>
- <para>
- <code>run</code> will return information about each instance
- that is starting up.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->run(array('imageId' => 'ami-509320',
- 'keyName' => 'myKey',
- 'securityGroup' => array('web',
- 'default')));
- ]]></programlisting>
- </example>
- <example id="zend.service.amazon.ec2.instance.operations.reboot">
- <title>Rebooting an Ec2 Instances</title>
- <para>
- <code>reboot</code> will reboot one or more instances.
- </para>
- <para>
- This operation is asynchronous; it only queues a request to
- reboot the specified instance(s). The operation will succeed
- if the instances are valid and belong to the user. Requests
- to reboot terminated instances are ignored.
- </para>
- <para>
- <code>reboot</code> returns boolean <constant>TRUE</constant> or
- <constant>FALSE</constant>
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->reboot('instanceId');
- ]]></programlisting>
- </example>
- <example id="zend.service.amazon.ec2.instance.operations.terminate">
- <title>Terminating an Ec2 Instances</title>
- <para>
- <code>terminate</code> shuts down one or more instances. This
- operation is idempotent; if you terminate an instance more
- than once, each call will succeed.
- </para>
- <para>
- <code>terminate</code> returns boolean <constant>TRUE</constant> or
- <constant>FALSE</constant>
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->terminate('instanceId');
- ]]></programlisting>
- </example>
- <note>
- <title>Terminated Instances</title>
- <para>Terminated instances will remain visible after termination
- (approximately one hour).</para>
- </note>
- </sect2>
- <sect2 id="zend.service.amazon.ec2.instance.utility">
- <title>Amazon Instance Utilities</title>
- <para>
- In this section you will find out how to retreive information, the console
- output and see if an instance contains a product code.
- </para>
- <example id="zend.service.amazon.ec2.instance.utility.describe">
- <title>Describing Instances</title>
- <para>
- <code>describe</code> returns information about instances that you own.
- </para>
- <para>
- If you specify one or more instance IDs, Amazon EC2 returns information
- for those instances. If you do not specify instance IDs, Amazon EC2
- returns information for all relevant instances. If you specify an invalid
- instance ID, a fault is returned. If you specify an instance that you do
- not own, it will not be included in the returned results.
- </para>
- <para>
- <code>describe</code> will return an array containing information on the
- instance.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->describe('instanceId');
- ]]></programlisting>
- </example>
- <note>
- <title>Terminated Instances</title>
- <para>
- Recently terminated instances might appear in the returned results. This interval is
- usually less than one hour. If you do not want terminated instances to be returned,
- pass in a second variable of boolean <constant>TRUE</constant> to
- <code>describe</code> and the terminated instances will be ignored.
- </para>
- </note>
- <example id="zend.service.amazon.ec2.instance.utility.describebyimageid">
- <title>Describing Instances By Image Id</title>
- <para>
- <code>describeByImageId</code> is functionally the same as <code>describe</code>
- but it will only return the instances that are using the provided imageId.
- </para>
- <para>
- <code>describeByImageId</code> will return an array containing information on the
- instances thare were started by the passed in imageId
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->describeByImageId('imageId');
- ]]></programlisting>
- </example>
- <note>
- <title>Terminated Instances</title>
- <para>
- Recently terminated instances might appear in the returned results. This
- interval is usually less than one hour. If you do not want terminated
- instances to be returned, pass in a second variable of boolean
- <constant>TRUE</constant> to <code>describe</code> and the terminated instances
- will be ignored.
- </para>
- </note>
- <example id="zend.service.amazon.ec2.instance.utility.consoleOutput">
- <title>Retreiving Console Output</title>
- <para>
- <code>consoleOutput</code> retrieves console output for the specified
- instance.
- </para>
- <para>
- Instance console output is buffered and posted shortly after instance
- boot, reboot, and termination. Amazon EC2 preserves the most recent
- 64 KB output which will be available for at least one hour after the
- most recent post.
- </para>
- <para>
- <code>consoleOutput</code> returns an array containing the
- <code>instanceId</code>, <code>timestamp</code> from the last output
- and the <code>output</code> from the console.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->consoleOutput('instanceId');
- ]]></programlisting>
- </example>
- <example id="zend.service.amazon.ec2.instance.utility.confirmproduct">
- <title>Confirm Product Code on an Instance</title>
- <para>
- <code>confirmProduct</code> returns <constant>TRUE</constant> if the specified
- product code is attached to the specified instance. The operation returns
- <constant>FALSE</constant> if the product code is not attached to the instance.
- </para>
- <para>
- The <code>confirmProduct</code> operation can only be executed by the owner of the
- <acronym>AMI</acronym>. This feature is useful when an <acronym>AMI</acronym> owner
- is providing support and wants to verify whether a user's instance is eligible.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->confirmProduct('productCode', 'instanceId');
- ]]></programlisting>
- </example>
- <example id="zend.service.amazon.ec2.instance.utility.monitor">
- <title>Turn on CloudWatch Monitoring on an Instance(s)</title>
- <para>
- <code>monitor</code> returns the list of instances and their
- current state of the CloudWatch Monitoring. If the instance
- does not currently have Monitoring enabled it will be turned on.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->monitor('instanceId');
- ]]></programlisting>
- </example>
- <example id="zend.service.amazon.ec2.instance.utility.unmonitor">
- <title>Turn off CloudWatch Monitoring on an Instance(s)</title>
- <para>
- <code>monitor</code> returns the list of instances and their
- current state of the CloudWatch Monitoring. If the instance
- currently has Monitoring enabled it will be turned off.
- </para>
- <programlisting language="php"><![CDATA[
- $ec2_instance = new Zend_Service_Amazon_Ec2_Instance('aws_key',
- 'aws_secret_key');
- $return = $ec2_instance->unmonitor('instanceId');
- ]]></programlisting>
- </example>
- </sect2>
- </sect1>
|