 |
What's New?
- 2010-07-21:
- Support for Amazon EC2 API Version 2010-06-15.
- 2009-12-13:
- Support for Amazon EC2 API Version 2009-11-30.
- 2009-12-02:
- Support for Amazon EC2 API Version 2009-10-31.
- 2009-09-29:
- Fix typo and response transformation on VpcAttachment
- 2009-09-28:
- 2009-09-23:
- Support for Shared Snapshots API
- 2009-09-10:
- Fix for missing VPC fields on RunningInstance
- 2009-08-25:
- 2009-05-17:
- Support for monitoring API
- 2009-04-09:
- Support for reserved instances API
- 2008-12-24:
- Fix notice output (no side effects, just noise)
- 2008-12-23:
- Url encoding fix (some calls with signature version 2 were affected)
- 2008-12-17:
- Support for regions, signature version 2, https endpoint
- 2008-10-21:
- Support for Windows Bundling, new API version - 2008-08-08
- 2008-08-26:
- Fix issue with wrong definition of IpPermission element in SecurityGroup. It is now correctly defined as list.
- Update internal signing to use built-in hash_hmac
- 2008-08-20: Initial release, support for Amazon Elastic Block Store
Prerequisites
Package Content
| Directory |
Overview |
|
src
|
Source distribution of library.
|
Quick Start
Library comes with code samples for each available service API.
To get started with the library, follow these steps:
- Extract the downlaod file into a working directory.
- Go to src/Amazon/EC2/Samples subdirectopry
- Edit .config.inc.php:
- Set AWS Access Key ID and AWS Secret Access Key
define('AWS_ACCESS_KEY_ID', '<Your Access Key ID>');
define('AWS_SECRET_ACCESS_KEY', '<Your Secret Access Key>');
- Open DescribeImagesSample.php sample, and find part:
// @TODO: set request. Action can be passed as Amazon_EC2_Model_DescribeImagesRequest
// object or array of parameters
// invokeDescribeImages($service, $request);
invokeDescribeImages($service, array('ImageId' => 'ami-be3adfd7'));
- Run DescribeImages sample:
php src/Amazon/EC2/Samples/DescribeImagesSample.php
- You should see the output
similar to the following:
DescribeImagesResponse
DescribeImagesResult
Image
ImageId
ami-be3adfd7
ImageLocation
ec2-public-images/fedora-8-i386-base-v1.04.manifest.xml
ImageState
available
KernelId
aki-4438dd2d
RamdiskId
ari-4538dd2c
...
- Experiment with samples. When ready, install library in your php include path and use it
Making Requests to a Different Region
To make a service call to a different region, instantiate the client with a configuration object, and pass the region-specific endpoint. For example:
$ec2Config = array ('ServiceURL' => 'https://eu-west-1.ec2.amazonaws.com');
$ec2 = new Amazon_EC2_Client($accessKeyId, $secretAccessKey, $ec2Config);
Please see the Amazon EC2 Developer Guide for a complete list of region endpoints.
Notes
You can use alternative array-based interface with the library. For example, instead of:
$request = new Amazon_EC2_Model_DescribeImages();
$request->setImageId('ami-be3adfd7');
$response = $service->describeImages($request);
You can write:
$response = $service->describeImages(array('ImageId' => 'ami-be3adfd7'));
Happy coding!
Comments, Questions or Feedback
If you have any comments, questions or feedback on the library, please start discussion here.
|