Start by downloading the AWS Java SDK . Amazon provides a good resource of Java programs providing examples of using their various cloud products – the two I used as reference for this project was in the samples\AmazonSimpleDB and samples\AwsConsoleApp directories.

There were four issues I ran into before being able to successfully use the product:

1. Connect to SimpleDB thru the supplied AWSCredentials API.

2. Adding the AWS jar file libraries to the ant build.xml file.

3. Add the AWS jar files to Jetty for development and testing.

4. Make sure the AWS instance had access to the jar files.

First issue, connection using a credential set. You create your credentials when you set up your Amazon Web Services account. And a blank credential file is provided in the SDK demo programs. Since this is a servlet program, the code resides as child directories of a WEB-INF folder. I placed my credentials file into the WEB-INF\resources folder.

Next thing is to bring the credential file into the various methods that need access to the SimpleDB. First I defined a String variable containing the path to the credential file:

String filename = “/WEB-INF/resources/AwsCredentials.properties”;

The file is brought in as a stream:

InputStream is = context.getResourceAsStream(filename);

An AWS credentials object is set using the data from the stream:

AWSCredentials credentials = new PropertiesCredentials(is);

And finally an AWS SimpleDB object is created, using the AWS credentials. This SimpleDB object is what you use to connect to your SimpleDB domain: