|
Resources
Sample Code and Libraries
Java Library for Amazon EC2
 |
Java Library for Amazon EC2
| Submitted By: |
Jason@AWS
|
| AWS Products Used: |
Amazon EC2 |
| Language(s): |
Java |
| License: |
Apache License 2.0 |
|
|
 |
What's New?
- 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
- 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
Reference Documentation
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 download 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 a service call to a different region, instantiate the client with a configuration object, and pass the region-specific endpoint. For example:
AmazonEC2Config ec2Config = new AmazonEC2Config()
.withServiceURL("https://eu-west-1.ec2.amazonaws.com"));
AmazonEC2 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.
|
Posts:
11
Registered:
9/5/09
|
|
|
|
Static code/name values?
Posted:
Sep 5, 2009 4:46 PM PDT
in response to: Elena@AWS
|
|
|
I have been searching in vain for what all the defined codes/names are for Amazon response data types, for example, all the values getCode() and getName() can return in the InstanceState class. Has Amazon frozen these yet, and, if so, where can I find a complete list of them?
|
|
Posts:
57
Registered:
8/10/09
|
|
|
|
Re: Service Error. Response Status: 200
Posted:
Oct 5, 2009 2:03 PM PDT
in response to: Elena@AWS
|
|
|
Are there plans to support the Load Balancing API?
|
|
Posts:
2,716
Registered:
5/25/06
|
|
|
Posts:
1
Registered:
1/11/09
|
|
|
|
Re: Java Library for Amazon EC2 in M2 repo?
Posted:
Nov 1, 2009 7:28 PM PST
in response to: Jayachandran Ar...
|
|
|
Hi Jayachandran,
You can access the private IP address of an instance through the method
getPrivateDns()
in an object of type
Instance
.
|
|
Posts:
1
Registered:
1/12/10
|
|
|
|
|
Find for svn access, Nov 26, 2009 6:30 PM
Reviewer: leniks
Hi,
I'm living at bleeding edge, is there any SVN/CVS access to this library, or maven2 repository? So I don't have to check new version and updates days and days.
|
|
SDK is a great resource for Java developers, Jan 12, 2010 8:18 AM
Reviewer: Peco K
So far it has been a great experience working with the SDK. Getting it installed even without a maven public repo was a breeze with not external dependencies to keep track of and configure. It is easy to understand and the samples provide a quick path to get started. The fact that the AWS dev staff keeps it rev-ed closed to the API release dates is really encouraging!
keep up the great work!
Cheers
|
|
|
|
 |
|
|