About this Library
- Based on the 2010-06-15 API version.
What's New?
- 2010-07-21:
- Support for EC2 2010-06-15 API version - High Performance Computing (HPC), VPC user specified private IP addresses, Bring Your Own License (BYOL)
- 2009-12-02:
- Support for EC2 Boot from EBS in 2009-10-31 API version (new operations: StopInstances, StartInstances, CreateImage, DescribeInstanceAttribute, ModifyInstanceAttribute, ResetInstanceAttribute)
- 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-26:
- Url and utf8 encoding fix for signature version 2
- 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-20:
- Initial release, support for Amazon Elastic Block Store
Prerequisites
- Amazon EC2 account (http://aws.amazon.com/ec2).
- Perl 5.6.0 or newer (http://www.perl.org/)
- Depending on the version of PERL you are using, you may need to install additional packages.
To install additional packages, run following command:
- perl -MCPAN -e 'install Digest::SHA'
- perl -MCPAN -e 'install XML::Simple'
- perl -MCPAN -e 'install Bundle::LWP'
- perl -MCPAN -e 'install XML::LibXSLT'
- perl -MCPAN -e 'install Crypt::SSLeay'
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 amazon-ec2-2010-06-15-perl-library.zip file into a working directory.
- Edit desired sample. For example: src/Amazon/EC2/Samples/DescribeImagesSample.pl
- Set AWS Access Key ID and AWS Secret Access Key
my $AWS_ACCESS_KEY_ID = "<Your Access Key ID>";
my $AWS_SECRET_ACCESS_KEY = "<Your Secret Access Key>";
- Set request parameters. For example, find following pre-generated snippet:
use Amazon::EC2::Model::DescribeImagesRequest;
# @TODO: set action. Action can be passed as Amazon::EC2::Model::DescribeImagesRequest
# object or hash of parameters
# invokeDescribeImages($service, $request);
- And set action with ImageId parameter:
use Amazon::EC2::Model::DescribeImages;
my $request = Amazon::EC2::Model::DescribeImagesRequest->new;
invokeDescribeImages($service, $request->withImageId("ami-be3adfd7"));
- Run DescribeImages sample:
perl src/Amazon/EC2/Samples/DescribeImagesSample.pl
- 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 the perl include path and use it.
Making Requests to a Different Region
To make the service call to a different region, instantiate the client with the configuration object, and pass the region-specific endpoint. For example:
my $ec2Config = {ServiceURL => "https://eu-west-1.ec2.amazonaws.com"};
my $ec2 = Amazon::EC2::Client->new($accessKeyId, $secretAccessKey, $ec2Config);
Please see the Amazon EC2 Developer Guide for a complete list of region endpoints.
Notes
You can use alternative hash-based interface with the library. For example, instead of:
my $request = Amazon::EC2::Model::DescribeImagesRequest->new;
$request->setImageId("ami-be3adfd7");
my $response = $service->describeImages($request);
You can write:
my $response = $service->describeImages({ImageId => "ami-be3adfd7"});
Happy coding!
Comments, Questions or Feedback
If you have any comments, questions or feedback on the library, please start discussion here.