An Amazon EC2 interface to create, describe, attach, detach and delete Elastic Block Storage Volumes and Snaphsots.

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

Attaches an Amazon EBS volume to an instance

attachVolume(string $volumeId, string $instanceId, string $device) : array

Parameters

$volumeId

string

The ID of the Amazon EBS volume

$instanceId

string

The ID of the instance to which the volume attaches

$device

string

Specifies how the device is exposed to the instance (e.g., /dev/sdh).

Returns

array

Creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.

createNewVolume(string $size, string $availabilityZone) : array

You must specify an availability zone when creating a volume. The volume and any instance to which it attaches must be in the same availability zone.

Parameters

$size

string

The size of the volume, in GiB.

$availabilityZone

string

The availability zone in which to create the new volume.

Returns

array

Creates a snapshot of an Amazon EBS volume and stores it in Amazon S3. You can use snapshots for backups, to launch instances from identical snapshots, and to save data before shutting down an instance

createSnapshot(string $volumeId) : array

Parameters

$volumeId

string

The ID of the Amazon EBS volume to snapshot

Returns

array

Creates a new Amazon EBS volume that you can mount from any Amazon EC2 instance.

createVolumeFromSnapshot(string $snapshotId, string $availabilityZone) : array

You must specify an availability zone when creating a volume. The volume and any instance to which it attaches must be in the same availability zone.

Parameters

$snapshotId

string

The snapshot from which to create the new volume.

$availabilityZone

string

The availability zone in which to create the new volume.

Returns

array

Deletes a snapshot of an Amazon EBS volume that is stored in Amazon S3

deleteSnapshot(string $snapshotId) : boolean

Parameters

$snapshotId

string

The ID of the Amazon EBS snapshot to delete

Returns

boolean

Deletes an Amazon EBS volume

deleteVolume(string $volumeId) : boolean

Parameters

$volumeId

string

The ID of the volume to delete

Returns

boolean

describeAttachedVolumes()

describeAttachedVolumes($instanceId) 

Parameters

$instanceId

Describes the status of Amazon EBS snapshots

describeSnapshot(string|array $snapshotId = null) : array

Parameters

$snapshotId

stringarray

The ID or arry of ID's of the Amazon EBS snapshot

Returns

array

Lists one or more Amazon EBS volumes that you own, If you do not specify any volumes, Amazon EBS returns all volumes that you own.

describeVolume(string|array $volumeId = null) : array

Parameters

$volumeId

stringarray

The ID or array of ID's of the volume(s) to list

Returns

array

Detaches an Amazon EBS volume from an instance

detachVolume(string $volumeId, string $instanceId = null, string $device = null, boolean $force = false) : array

Parameters

$volumeId

string

The ID of the Amazon EBS volume

$instanceId

string

The ID of the instance from which the volume will detach

$device

string

The device name

$force

boolean

Forces detachment if the previous detachment attempt did not occur cleanly (logging into an instance, unmounting the volume, and detaching normally). This option can lead to data loss or a corrupted file system. Use this option only as a last resort to detach an instance from a failed instance. The instance will not have an opportunity to flush file system caches nor file system meta data.

Returns

array

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

Method to fetch the Secret AWS Key

_getSecretKey() : string
Inherited

Returns

string

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