By: Emiley J Viewed: 153277 times Printer Friendly Format
the AWS SDK for Java from the SDK web page at http://aws.amazon.com/sdkforjava.
After downloading the SDK, extract the contents into a folder.
includes a number of code samples:
- Console sample –
Demonstrates how to make a request to multiple services.
- Amazon S3 sample –
Demonstrates how to use the basic features for Amazon S3, such as putting
and getting an object from Amazon S3.
- Amazon SimpleDB sample –
Demonstrates how to use the basic features for Amazon SimpleDB, including
creating and deleting domains, and selecting data from a domain.
- Amazon SQS sample – Demonstrates
how to use the basic features of Amazon SQS, including adding and getting
messages from a queue.
run a sample
- Open the AwsCredentials.properties in the sample folder. For example, the
Console sample file is located at
- Locate the following section and fill in your Access Key ID and Secret
# Fill in your AWS Access Key ID and Secret Access Key
- Save the file.
- Run the .java file for your sample, located in the same directory as the
properties file. For example, run the
for the Console sample. The sample prints information to the standard
output, for example:
Welcome to the AWS Java SDK!
You have access to 4 Availability Zones.
You have 0 Amazon EC2 instance(s) running.
You have 13 Amazon SimpleDB domain(s)containing a total of 62 items.
You have 23 Amazon S3 bucket(s), containing 44 objects with a total size of
sample also includes an Ant
file to run the sample. For more information on Ant, see http://ant.apache.org.
Comment on this tutorial