Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[]]></ac:plain-text-body></ac:macro>
<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[

Zend Framework: Zend_Service_Amazon_Ec2 Component Proposal

Proposed Component Name Zend_Service_Amazon_Ec2
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_Service_Amazon_Ec2
Proposers Jon Whitcraft
Zend Liaison TBD
Revision 1.0 - 10 March 2009: Initial Draft.
1.1 - 11 March 2009: Completed Use Cases and make ready for community review.
1.1.1 - 23 March 2009: Updated developer docs to version 2008-12-01. (wiki revision: 20)

Table of Contents

1. Overview

Zend Service Amamzon Ec2 will hook into the Amazon Elastic Compute Cloud Query API to provide access to the methods to manage Amazon EC2.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will make use of a factory method to load the parts that you need instead of loading everything
  • This component will allow you to start, terminate, discribe instances.
  • This component will allow you to create, describe, and delete keypairs.
  • This component will allow you to make use of the Elastic IP methods.
  • This component will allow you to make sue of the Elastic Block Storage devices (EBS).
  • This component will allow you to create, modify and delete security groups.
  • This component will allow you to maintain AMIs (Amazon Machine Instances).
  • This component will allow you to statically set your access keys via static methods so you can set it once and forget it.
  • This component will allow you to specify alternate access keys when you create the object by passing them in as variables to the construct functions.

4. Dependencies on Other Framework Components

5. Theory of Operation

Create an interface to allow easy execute of the EC2 Query URL API from with-in the Zend Framework. You will be able to start and terminate instances. You will also be able to maintain your AMIs, Elastic Ips, EBS Volumes, Key Pairs and Security Groups.

6. Milestones / Tasks

  • [Done] Milestone 1: Classes Skeletons and Use Cases
  • Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, #3 and #4
  • Milestone 3: Working prototype checked into the incubator supporting use cases #5, #6 and #7.
  • Milestone 4: Unit tests exist, work, and are checked into SVN.
  • Milestone 5: Initial documentation exists.

7. Class Index

  • Zend_Service_Amazon_Ec2
  • Zend_Service_Amazon_Ec2_Abstract
  • Zend_Service_Amazon_Ec2_Availabilityzones
  • Zend_Service_Amazon_Ec2_Ebs
  • Zend_Service_Amazon_Ec2_Elasticip
  • Zend_Service_Amazon_Ec2_Exception
  • Zend_Service_Amazon_Ec2_Image
  • Zend_Service_Amazon_Ec2_Instance
  • Zend_Service_Amazon_Ec2_Keypair
  • Zend_Service_Amazon_Ec2_Securitygroups

8. Use Cases

9. Class Skeletons

]]></ac:plain-text-body></ac:macro>

]]></ac:plain-text-body></ac:macro>

Labels:
proposal proposal Delete
aws aws Delete
ec2 ec2 Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 20, 2009

    <p>I like the idea and follow the examples, but is the factory really necessary?</p>

    <p>The factory makes needed refactoring really hard cause it involves BC breaks, and to follow through you also need a private/protected __construct() etc.. And then, there are always issues with the testability of anything static in code.</p>

  2. Mar 26, 2009

    <p>Overall it seems to be good and covering most of the spec as I could see. Some notes:</p>

    <p>I'm not sure I like the factory thing too much. I understand that it may have a lot of classes and long class names suck, but I still would prefer:</p>

    <p>$instance = new Zend_Service_Amazon_Ec2_Instance();</p>

    <p>to:</p>

    <p>$instance = Zend_Service_Amazon_Ec2::factory('instance');</p>

    <p>any day. Unless of course all those refer to the same class, but then it should be explicitly said. I don't see much sense in using factory here, unless I miss something.</p>

    <p>About instance:</p>
    <ul class="alternate">
    <li>as I understand, instance is bound to AMI, if that's the case than maybe it makes sense to pass it to the ctor.</li>
    <li>I think it makes sense to have instance types as constants</li>
    <li>If the instance identified by the ID and ID is passed to all functions but run() then why aren't those functions static? In fact, why run() isn't static too - I don't see any data it needs to store in object instance. Is there any?</li>
    <li>describe($instaceId) - it says "Returns information about instances that you own" - how does it know who "you" is? I don't see any auth data being passed to it anywhere but in run() - but run() and describe() are totally different and in fact the description implies I can run describe() without parameters at all. Is there some identification step that I have missed?<br />
    Same about other classes like KeyPair - I don't see where user is identified and I don't see why you would need to create an object of this class. I suspect the answers to both are related but the spec does not explain that.</li>
    <li>I wonder if we want to support console output and reboot for instances, Amazon has APIs for that.</li>
    <li>maybe run() should have parameter array instead, 12 parameters many of each can have defaults may prove confusing to the user.</li>
    </ul>

    <p>About KeyPair:</p>
    <ul class="alternate">
    <li>I notice Windows instances have additional step of getting admin password after they have keypair. I think it'd be nice to support that too. I'm not sure where this API belongs - maybe to instances too?</li>
    </ul>

    <p>About zones:</p>
    <ul class="alternate">
    <li>I see that amazon has 2 concepts - regions and zones inside regions. I think it'd be nice if we supported both.</li>
    <li>Also I understand that working with different zones in different regions requires different service endpoints. I don't see it covered in the spec.</li>
    </ul>

    <p>About EBS:</p>
    <ul class="alternate">
    <li>I understand that volume can be created either as new or from snapshot. I think that should be 2 different methods, or if it's the same method, signature shouldn't require size for second case.</li>
    <li>API seems to be missing the case where we want to list all volumes attached to the specific instance.</li>
    </ul>

    <p>About security groups:</p>
    <ul class="alternate">
    <li>spec has copy of keypair class instead of security group class</li>
    <li>I think there should be constant or special API to deal with default group which is very frequently used as I understand (you need it to even access the instance).</li>
    <li>since detailed API is not there I can't check it but in general authorization can be done for IPs/ports and for groups, so API should cover both.</li>
    </ul>

    1. Mar 27, 2009

      <p>You can instantiate a class like:</p>

      <p>$instance = new Zend_Service_Amazon_Ec2_Instance('access_key', 'secret_access_key');</p>

      <p>or use the factory method</p>

      <p>$instance = Zend_Service_Amazon_Ec2::factory('instance', 'access_key', 'secret_access_key');</p>

      <p>Instnace:<br />
      as I understand, instance is bound to AMI, if that's the case than maybe it makes sense to pass it to the ctor.<br />
      <strong>All it required from the AMI point of view is the id of the AMI which is just a string.</strong></p>

      <p>I think it makes sense to have instance types as constants<br />
      <strong>I agree and I'll implement this.</strong></p>

      <p>If the instance identified by the ID and ID is passed to all functions but run() then why aren't those functions static? In fact, why run() isn't static too - I don't see any data it needs to store in object instance. Is there any? <br />
      <strong>No and infact most of these could be static except for the fact of the way i chose to do my request which was fashioned after the way Zend_Service_Amazon_S3 was done</strong></p>

      <p>describe($instaceId) - it says "Returns information about instances that you own" - how does it know who "you" is? I don't see any auth data being passed to it anywhere but in run() - but run() and describe() are totally different and in fact the description implies I can run describe() without parameters at all. Is there some identification step that I have missed?<br />
      <strong>Yes when you instantiate the class you have to pass it your access key and your secret access key. These can be set in the abstract class.</strong></p>

      <p>I wonder if we want to support console output and reboot for instances, Amazon has APIs for that. <strong>I think i just missed them so I'll add those in.</strong></p>

      <p>maybe run() should have parameter array instead, 12 parameters many of each can have defaults may prove confusing to the user.<br />
      <strong>Agreed. I'll look into that.</strong></p>

      <p>keypair - I have never used the windows stuff so I will look into that.</p>

      <p>zones - <strong>I will look into that</strong></p>

      <p>EBS Create Volume and Create Snapshot<br />
      <strong>Currently there is different methods for creating volumes and snapshots as lined out in the class skeleton.</strong></p>

      <p>EBS Attached Instance<br />
      <strong>I like that idea and i'll implement that.</strong></p>

      <p>Secutiry groups: <br />
      <strong>I didn't catch that i put the wrong skel in. I have the ip/ports based one in but not the groups yet as i'm still trying to figure out how that all works.</strong></p>

      <p>Here is the code:<br />
      <a href="http://github.com/sidhighwind/zend_service_amazon_ec2/tree/master">http://github.com/sidhighwind/zend_service_amazon_ec2/tree/master</a></p>

      <p>I will work on this over the weekend and report my changes back to here when I make them.</p>

      1. Mar 29, 2009

        <p><strong>$instance = new Zend_Service_Amazon_Ec2_Instance('access_key', 'secret_access_key');</strong></p>

        <p>OK, I missed that part. If the object stores the keys, than OK, it makes sense, but then the spec should explicitly say that, for clarity sake. </p>

        1. Mar 30, 2009

          <p>Stanislav,</p>

          <p>I do believe that I have implimated all the items stated above. Check out the code on <a href="http://github.com/sidhighwind/zend_service_amazon_ec2/tree/master">github</a> and let me know what you think.</p>

          <p>I'm at 96% code coverage with the unit test. I'm going to keep working till I get as close to 100% as I can.</p>

    2. Mar 27, 2009

      <p>According to the Documentation there is no query API or soap API to fetch the windows password:</p>

      <p><a href="http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?CLTRG-get-password.html">http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?CLTRG-get-password.html</a></p>

      <p>See the note at the top of the page.</p>

      1. Mar 29, 2009

        <p>That's strange - if there's no API for it how the command-line tool gets it? There should be some place it takes it from...</p>

        1. Mar 30, 2009

          <p>The command line tool is a java application and I'm not sure how it communicates back to the Amazon. I think is is an api for it but it just hasn't been exposted to the Soap and Query API interfaces.</p>

          <p>Maybe in an upcoming release there will be one.</p>