<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect1 id="zend.service.amazon.ec2.zones">
    <title>Zend_Service_Amazon_Ec2: Regions and Availability Zones</title>

    <para>
        Amazon EC2 provides the ability to place instances in different regions
        and Availability Zones. Regions are dispersed in separate geographic
        areas or countries. Availability Zones are located within regions and
        are engineered to be insulated from failures in other Availability Zones
        and provide inexpensive low latency network connectivity to other
        Availability Zones in the same region. By launching instances in separate
        Availability Zones, you can protect your applications from the failure of
        a single Availability Zone.
    </para>

    <sect2 id="zend.service.amazon.ec2.zones.regions">
        <title>Amazon EC2 Regions</title>

        <para>
            Amazon EC2 provides multiple regions so you can launch Amazon EC2
            instances in locations that meet your requirements. For example,
            you might want to launch instances in Europe to be closer to your
            European customers or to meet legal requirements.
        </para>

        <para>
            Each Amazon EC2 region is designed to be completely isolated from
            the other Amazon EC2 regions. This achieves the greatest possible
            failure independence and stability, and it makes the locality of
            each EC2 resource unambiguous.
        </para>

        <example id="zend.service.amazon.ec2.zones.regions.example">
            <title>Viewing the available regions</title>

            <para>
                <code>describe</code> is used to find out which regions your account has access to.
            </para>

            <para>
                <code>describe</code> will return an array containing information about which
                regions are available. Each array will contain regionName and regionUrl.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_region = new Zend_Service_Amazon_Ec2_Region('aws_key','aws_secret_key');
$regions = $ec2_region->describe();

foreach($regions as $region) {
    print $region['regionName'] . ' -- ' . $region['regionUrl'] . '<br />';
}
]]></programlisting>
        </example>
    </sect2>

    <sect2 id="zend.service.amazon.ec2.zones.availability">
        <title>Amazon EC2 Availability Zones</title>

        <para>
            When you launch an instance, you can optionally specify an Availability
            Zone. If you do not specify an Availability Zone, Amazon EC2 selects one
            for you in the region that you are using. When launching your initial
            instances, we recommend accepting the default Availability Zone, which
            allows Amazon EC2 to select the best Availability Zone for you based on
            system health and available capacity. Even if you have other instances
            running, you might consider not specifying an Availability Zone if your
            new instances do not need to be close to, or separated from, your existing
            instances.
        </para>

        <example id="zend.service.amazon.ec2.zones.availability.example">
            <title>Viewing the available zones</title>

            <para>
                <code>describe</code> is used to find out which what the status is of each
                availability zone.
            </para>

            <para>
                <code>describe</code> will return an array containing information about which zones
                are available. Each array will contain zoneName and zoneState.
            </para>

            <programlisting language="php"><![CDATA[
$ec2_zones = new Zend_Service_Amazon_Ec2_Availabilityzones('aws_key',
                                                           'aws_secret_key');
$zones = $ec2_zones->describe();

foreach($zones as $zone) {
    print $zone['zoneName'] . ' -- ' . $zone['zoneState'] . '<br />';
}
]]></programlisting>
        </example>
    </sect2>
</sect1>
