About this Library
- Based on the 2009-11-30 API version.
What's New?
- 2009-12-14:
- Support for EC2 Spot Instances in 2009-11-30 API version (new operations: RequestSpotInstances, DescribeSpotInstanceRequests, CancelSpotInstanceRequests, CreateSpotDatafeedSubscription, DescribeSpotDatafeedSubscription, DeleteSpotDatafeedSubscription, DescribeSpotPriceHistory)
- 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
- 2009-02-11:
- Update 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-09-23:
- 2008-08-26:
- Fix issue with wrong definition of IpPermission element in SecurityGroup. It is now correctly defined as list.
- 2008-08-20: Initial release, support for Amazon Elastic Block Store
Prerequisites
Package Content
| Path |
Overview |
|
dist
|
Binary distribution of library
|
|
src
|
Source distribution of library.
|
|
third-party
|
Binary distribution of library dependencies.
|
|
build.xml
|
Ant build file to build the 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-2009-11-30-java-library.zip file into a working directory.
- Add all sources under "src" directory to your compilation path.
- Add all jars files under "third-party/*" directory to your classpath
- Edit desired sample. For example: DescribeImagesSample.java
- Set AWS Access Key ID and AWS Secret Access Key
String accessKeyId = "Your Access Key ID";
String secretAccessKey = "Your Secret Access Key";
- Set request parameters. For example, find following pre-generated snippet:
DescribeImagesRequest request = new DescribeImagesRequest();
// @TODO: set request parameters here
// invokeDescribeImages(service, request);
- And uncomment third line and add:
DescribeImagesRequest request = new DescribeImagesRequest()
.withImageId("ami-be3adfd7");
invokeDescribeImages(service, request);
- Compile and run DescribeImagesSample. 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
...
Note, to see additional debugging output, adjust level of debugging in log4j.properties available in the root of the source tree.
- Experiment with samples. When ready, add library binary distribution to your application classpath, 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:
AmazonEC2Config ec2Config = new AmazonEC2Config()
.withServiceURL("https://eu-west-1.ec2.amazonaws.com"));
AmazonSimpleDB service = new AmazonEC2Client(accessKeyId, secretAccessKey, ec2Config);
Please see the Amazon EC2 Developer Guide for a complete list of region endpoints.
Comments, Questions or Feedback
If you have any comments, questions or feedback on the library, please start discussion here.