My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Ec2Api  
Proposed EC2 package API
Updated Jun 3, 2009 by mike.gau...@gmail.com

Introduction

The Services_Amazon_EC2 package will cover the Amazon EC2 HTTP REST API.

Example Use

/*
 * Launches three instances with custom user data then displays the
 * ids of the launched instances.
 */

$manager = new Services_Amazon_EC2_InstanceManager(
    $access_key,
    $access_secret
);

$runner = $manager->getRunner($ami);
$runner->setNumber(3);
$runner->setUserData('Hello, World!');

$instances = $runner->runInstances();

foreach ($instances as $instance) {
    echo $instance->getId(), "\n";
}
/*
 * Finds longest running instance and terminates it.
 */
$manager = new Services_Amazon_EC2_InstanceManager(
    $access_key,
    $access_secret
);

$instances = $manager->describeInstances();

$oldest = null;
foreach ($instances as $instance) {
    if (   $oldest === null
        || $instance->getLaunchTime() < $oldest->getLaunchTime()
    ) {
        $oldest = $instance;
    }
}

echo "Oldest instance is ", $oldest->getId(), "\n";

$manager->terminateInstances($oldest);

Classes

Services_Amazon_EC2_InstanceRunner

__construct()

runInstances()

setNumber()

setKeyName()

setSecurityGroups()

setUserData()

setType()

setPlacementAvailabilityZone()

setKernelId()

setRamDiskId()

setBlockDeviceMappings()

setImage()

getParameters()

Services_Amazon_EC2_InstanceManager

Services_Amazon_EC2_InstanceRunner getRunner( Services_Amazon_EC2_Image | string )

describeInstances( Services_Amazon_EC2_Instance | array | string )

terminateInstances( Services_Amazon_EC2_Instance | array | string )

Services_Amazon_EC2_Instance

__construct()

terminate()

__toString()

getId()

getType()

Services_Amazon_EC2_Image getImage()

getKernelId()

getRamDiskId()

getState()

getDnsName()

getPrivateDnsName()

getKeyName()

DateTime getLaunchTime()

getLaunchIndex()

getPlacementAvailabilityZone()

getProductCodes()

getSecurityGroups()

getOwnerId()

getReservationId()

protected initializeFromData()

protected initializeFromId()

Powered by Google Project Hosting