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

category Zend
package Zend_Service_Amazon
subpackage Ec2
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Service_Amazon_Ec2_Abstract

 Methods

Create Amazon client.

__construct($accessKey = null, $secretKey = null) : void
Inherited

Parameters

$accessKey

$secretKey

Bundles an Amazon EC2 instance running Windows

bundle(string $instanceId, string $s3Bucket, string $s3Prefix, integer $uploadExpiration = 1440) : array

Parameters

$instanceId

string

The instance you want to bundle

$s3Bucket

string

Where you want the ami to live on S3

$s3Prefix

string

The prefix you want to assign to the AMI on S3

$uploadExpiration

integer

The expiration of the upload policy. Amazon recommends 12 hours or longer. This is based in nubmer of minutes. Default is 1440 minutes (24 hours)

Returns

arraycontaining the information on the new bundle operation

Cancels an Amazon EC2 bundling operation

cancelBundle(string $bundleId) : array

Parameters

$bundleId

string

The ID of the bundle task to cancel

Returns

arrayInformation on the bundle task

Describes current bundling tasks

describeBundle(string|array $bundleId = '') : array

Parameters

$bundleId

stringarray

A single or a list of bundle tasks that you want to find information for.

Returns

arrayInformation for the task that you requested

Gets the HTTP client object.

getHttpClient() : \Zend_Http_Client
InheritedStatic

Returns

\Zend_Http_Client

Sets the HTTP client object to use for retrieving the feeds. If none is set, the default Zend_Http_Client will be used.

setHttpClient(\Zend_Http_Client $httpClient) 
InheritedStatic

Parameters

$httpClient

\Zend_Http_Client

Set the keys to use when accessing SQS.

setKeys($accessKey, $secretKey) : void
InheritedStatic

Parameters

$accessKey

$secretKey

Set which region you are working in. It will append the end point automaticly

setRegion(string $region) 
InheritedStatic

Parameters

$region

string

Method to fetch the Access Key

_getAccessKey() : string
Inherited

Returns

string

Method to fetch the AWS Region

_getRegion() : string
Inherited

Returns

string

Generates the S3 Upload Policy Information

_getS3UploadPolicy(string $bucketName, string $prefix, integer $expireInMinutes = 1440) : string

Parameters

$bucketName

string

Which bucket you want the ami to live in on S3

$prefix

string

The prefix you want to assign to the AMI on S3

$expireInMinutes

integer

The expiration of the upload policy. Amazon recommends 12 hours or longer. This is based in nubmer of minutes. Default is 1440 minutes (24 hours)

Returns

stringBase64 encoded string that is the upload policy

Method to fetch the Secret AWS Key

_getSecretKey() : string
Inherited

Returns

string

Signed S3 Upload Policy

_signS3UploadPolicy(string $policy) : string

Parameters

$policy

string

Base64 Encoded string that is the upload policy

Returns

stringSHA1 encoded S3 Upload Policy

Adds required authentication and version parameters to an array of parameters

addRequiredParameters(array $parameters) : array
Inherited

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

$parameters

array

the array to which to add the required parameters.

Returns

array

Sends a HTTP request to the queue service using Zend_Http_Client

sendRequest(array $params = array()) : \Zend_Service_Amazon_Ec2_Response
Inherited

Parameters

$params

array

List of parameters to send with the request

Exceptions

\Zend_Service_Amazon_Ec2_Exception

Returns

\Zend_Service_Amazon_Ec2_Response

Computes the RFC 2104-compliant HMAC signature for request parameters

signParameters(array $paramaters) : string
Inherited

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

$paramaters

Returns

stringthe signed data.

Checks for errors responses from Amazon

checkForErrors(\Zend_Service_Amazon_Ec2_Response $response) : void
Inherited

Parameters

$response

\Zend_Service_Amazon_Ec2_Response

the response object to check.

Exceptions

\Zend_Service_Amazon_Ec2_Exception if one or more errors are returned from Amazon.

 Properties

 

Amazon Access Key

$_accessKey : string

Default

 

Amazon Access Key

$_defaultAccessKey : string

Default

null
Static
 

Amazon Region

$_defaultRegion : string

Default

null
Static
 

Amazon Secret Key

$_defaultSecretKey : string

Default

null
Static
 

The API version to use

$_ec2ApiVersion 

Default

'2009-04-04'
 

The HTTP query server

$_ec2Endpoint 

Default

'ec2.amazonaws.com'
 

Signature Encoding Method

$_ec2SignatureMethod 

Default

'HmacSHA256'
 

Signature Version

$_ec2SignatureVersion 

Default

'2'
 

HTTP Client used to query all web services

$_httpClient : \Zend_Http_Client

Default

null
Static
 

Period after which HTTP request will timeout in seconds

$_httpTimeout 

Default

10
 

Amazon Region

$_region : string

Default

 

Amazon Secret Key

$_secretKey : string

Default

 

An array that contains all the valid Amazon Ec2 Regions.

$_validEc2Regions : array

Default

array('eu-west-1', 'us-east-1')
Static