Service/Amazon/Ec2/Instance.php

Show: inherited
Table of Contents

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Service_Amazon  
Subpackage
Ec2  
Version
$Id: Instance.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Service_Amazon_Ec2_Instance

Package: Zend\Service\Amazon\Ec2

An Amazon EC2 interface that allows yout to run, terminate, reboot and describe Amazon Ec2 Instances.

Parent(s)
\Zend_Service_Amazon_Ec2_Abstract < \Zend_Service_Amazon_Abstract < \Zend_Service_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

Constant  MICRO = 't1.micro'

Constant for Micro Instance Type

Constant  SMALL = 'm1.small'

Constant for Small Instance TYpe

Constant  LARGE = 'm1.large'

Constant for Large Instance TYpe

Constant  XLARGE = 'm1.xlarge'

Constant for X-Large Instance TYpe

Constant  HCPU_MEDIUM = 'c1.medium'

Constant for High CPU Medium Instance TYpe

Constant  HCPU_XLARGE = 'c1.xlarge'

Constant for High CPU X-Large Instance TYpe

Properties

Propertyprotectedstring $_accessKey =
Propertyprotectedstring $_defaultAccessKey = null
Default valuenullDetails
Type
string
Inherited_from
\Zend_Service_Amazon_Abstract::$$_defaultAccessKey  
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_defaultAccessKey  
Propertyprotectedstring $_defaultRegion = null
staticinherited

<p>Amazon Region</p>Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_defaultRegion
Default valuenullDetails
Type
string
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_defaultRegion  
Propertyprotectedstring $_defaultSecretKey = null
Default valuenullDetails
Type
string
Inherited_from
\Zend_Service_Amazon_Abstract::$$_defaultSecretKey  
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_defaultSecretKey  
Propertyprotected$_ec2ApiVersion = '2009-04-04'
inherited

The API version to use

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_ec2ApiVersion
Default value'2009-04-04'Details
Type
n/a
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_ec2ApiVersion  
Propertyprotected$_ec2Endpoint = 'ec2.amazonaws.com'
inherited

The HTTP query server

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_ec2Endpoint
Default value'ec2.amazonaws.com'Details
Type
n/a
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_ec2Endpoint  
Propertyprotected$_ec2SignatureMethod = 'HmacSHA256'
inherited

Signature Encoding Method

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_ec2SignatureMethod
Default value'HmacSHA256'Details
Type
n/a
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_ec2SignatureMethod  
Propertyprotected$_ec2SignatureVersion = '2'
inherited

Signature Version

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_ec2SignatureVersion
Default value'2'Details
Type
n/a
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_ec2SignatureVersion  
Propertyprotected\Zend_Http_Client $_httpClient = null
Propertyprotected$_httpTimeout = 10
inherited

Period after which HTTP request will timeout in seconds

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_httpTimeout
Default value10Details
Type
n/a
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_httpTimeout  
Propertyprotectedstring $_region =
inherited

<p>Amazon Region</p>Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_region
Details
Type
string
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_region  
Propertyprotectedstring $_secretKey =
Propertyprotectedarray $_validEc2Regions = array('eu-west-1', 'us-east-1')
staticinherited

An array that contains all the valid Amazon Ec2 Regions.

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::$$_validEc2Regions
Default valuearray('eu-west-1', 'us-east-1')Details
Type
array
Inherited_from
\Zend_Service_Amazon_Ec2_Abstract::$$_validEc2Regions  

Methods

methodpublic__construct( $accessKey = null,  $secretKey = null, string $region = null) : void
inherited

Create Amazon client.

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::__construct()
Parameters
Name Type Description
$accessKey
$secretKey
$region string

Sets the AWS Region

methodprotected_getAccessKey() : string
Returns
Type Description
string
methodprotected_getRegion() : string
inherited

Method to fetch the AWS Region

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::_getRegion()
Returns
Type Description
string
methodprotected_getSecretKey() : string
Returns
Type Description
string
methodprotectedaddRequiredParameters(array $parameters) : array
inherited

Adds required authentication and version parameters to an array of parameters

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::addRequiredParameters()

The required parameters are: - AWSAccessKey - SignatureVersion - Timestamp - Version and - Signature

If a required parameter is already set in the $parameters array, it is overwritten.

Parameters
Name Type Description
$parameters array

the array to which to add the required parameters.

Returns
Type Description
array
methodprivatecheckForErrors(\Zend_Service_Amazon_Ec2_Response $response) : void
inherited

Checks for errors responses from Amazon

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::checkForErrors()
Parameters
Name Type Description
$response \Zend_Service_Amazon_Ec2_Response

the response object to check.

Throws
Exception Description
\Zend_Service_Amazon_Ec2_Exception if one or more errors are returned from Amazon.
methodpublicconfirmProduct(string $productCode, string $instanceId) : array | boolean

Returns true if the specified product code is attached to the specified instance.

The operation returns false if the product code is not attached to the instance.

The confirmProduct operation can only be executed by the owner of the AMI. This feature is useful when an AMI owner is providing support and wants to verify whether a user's instance is eligible.

Parameters
Name Type Description
$productCode string

The product code to confirm.

$instanceId string

The instance for which to confirm the product code.

Returns
Type Description
array | boolean An array if the product code is attached to the instance, false if it is not.
methodpublicconsoleOutput(string $instanceId) : array

Retrieves console output for the specified instance.

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.

Parameters
Name Type Description
$instanceId string

An instance ID

Returns
Type Description
array
methodpublicdescribe( $instanceId = null, boolean $ignoreTerminated = false) : array

Returns information about instances that you own.

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.

Recently terminated instances might appear in the returned results. This interval is usually less than one hour.

Parameters
Name Type Description
$instanceId
$ignoreTerminated boolean

Ture to ignore Terminated Instances.

Returns
Type Description
array
methodpublicdescribeByImageId(string $imageId, boolean $ignoreTerminated = false) : array

Returns information about instances that you own that were started from a specific imageId

Recently terminated instances might appear in the returned results. This interval is usually less than one hour.

Parameters
Name Type Description
$imageId string

The imageId used to start the Instance.

$ignoreTerminated boolean

Ture to ignore Terminated Instances.

Returns
Type Description
array
methodpublicmonitor(array | string $instanceId) : array

Turn on Amazon CloudWatch Monitoring for an instance or a list of instances

Parameters
Name Type Description
$instanceId array | string

The instance or list of instances you want to enable monitoring for

Returns
Type Description
array
methodpublicreboot(string | array $instanceId) : boolean

Requests a reboot of one or more instances.

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.

Parameters
Name Type Description
$instanceId string | array

One or more instance IDs.

Returns
Type Description
boolean
methodpublicrun(array $options) : array

Launches a specified number of Instances.

If Amazon EC2 cannot launch the minimum number AMIs you request, no instances launch. If there is insufficient capacity to launch the maximum number of AMIs you request, Amazon EC2 launches as many as possible to satisfy the requested maximum values.

Every instance is launched in a security group. If you do not specify a security group at launch, the instances start in your default security group. For more information on creating security groups, see CreateSecurityGroup.

An optional instance type can be specified. For information about instance types, see Instance Types.

You can provide an optional key pair ID for each image in the launch request (for more information, see CreateKeyPair). All instances that are created from images that use this key pair will have access to the associated public key at boot. You can use this key to provide secure access to an instance of an image on a per-instance basis. Amazon EC2 public images use this feature to provide secure access without passwords.

Launching public images without a key pair ID will leave them inaccessible.

Parameters
Name Type Description
$options array

An array that contins the options to start an instance. Required Values: imageId string ID of the AMI with which to launch instances. Optional Values: minCount integer Minimum number of instances to launch. maxCount integer Maximum number of instances to launch. keyName string Name of the key pair with which to launch instances. securityGruop string|array Names of the security groups with which to associate the instances. userData string The user data available to the launched instances. This should not be Base64 encoded. instanceType constant Specifies the instance type. placement string Specifies the availability zone in which to launch the instance(s). By default, Amazon EC2 selects an availability zone for you. kernelId string The ID of the kernel with which to launch the instance. ramdiskId string The ID of the RAM disk with which to launch the instance. blockDeviceVirtualName string Specifies the virtual name to map to the corresponding device name. For example: instancestore0 blockDeviceName string Specifies the device to which you are mapping a virtual name. For example: sdb monitor boolean Turn on CloudWatch Monitoring for an instance.

Returns
Type Description
array
methodprotectedsendRequest(array $params = array()) : \Zend_Service_Amazon_Ec2_Response
inherited

Sends a HTTP request to the queue service using Zend_Http_Client

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::sendRequest()
Parameters
Name Type Description
$params array

List of parameters to send with the request

Returns
Type Description
\Zend_Service_Amazon_Ec2_Response
Throws
Exception Description
\Zend_Service_Amazon_Ec2_Exception
methodpublicsetHttpClient(\Zend_Http_Client $httpClient) : void
staticfinalinherited

Sets the HTTP client object to use for retrieving the feeds.

Inherited from: \Zend_Service_Abstract::setHttpClient()\Zend_Service_Amazon_Abstract::setHttpClient()\Zend_Service_Amazon_Ec2_Abstract::setHttpClient()

If none is set, the default Zend_Http_Client will be used.

Parameters
Name Type Description
$httpClient \Zend_Http_Client
methodpublicsetKeys( $accessKey,  $secretKey) : void
staticinherited

Set the keys to use when accessing SQS.

Inherited from: \Zend_Service_Amazon_Abstract::setKeys()\Zend_Service_Amazon_Ec2_Abstract::setKeys()
Parameters
Name Type Description
$accessKey
$secretKey
methodpublicsetRegion(string $region) : void
staticinherited

Set which region you are working in.

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::setRegion()

It will append the end point automaticly

Parameters
Name Type Description
$region string
methodprotectedsignParameters( $paramaters) : string
inherited

Computes the RFC 2104-compliant HMAC signature for request parameters

Inherited from: \Zend_Service_Amazon_Ec2_Abstract::signParameters()

This implements the Amazon Web Services signature, as per the following specification:

  1. Sort all request parameters (including SignatureVersion and excluding Signature, the value of which is being created), ignoring case.

  2. Iterate over the sorted list and append the parameter name (in its original case) and then its value. Do not URL-encode the parameter values before constructing this string. Do not use any separator characters when appending strings.

Parameters
Name Type Description
$paramaters
Returns
Type Description
string the signed data.
methodpublicterminate(string | array $instanceId) : array

Shuts down one or more instances.

This operation is idempotent; if you terminate an instance more than once, each call will succeed.

Terminated instances will remain visible after termination (approximately one hour).

Parameters
Name Type Description
$instanceId string | array

One or more instance IDs returned.

Returns
Type Description
array
methodpublicunmonitor(array | string $instanceId) : array

Turn off Amazon CloudWatch Monitoring for an instance or a list of instances

Parameters
Name Type Description
$instanceId array | string

The instance or list of instances you want to disable monitoring for

Returns
Type Description
array
Documentation was generated by phpDocumentor 2.0.0a8.