Using the AWS SDK for Java
By: Emiley J Printer Friendly Format
Download 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.
The
SDK /samples
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.
To run a sample
- Open the AwsCredentials.properties in the sample folder. For example, the
Console sample file is located at
aws-java-sdk/samples/AwsConsoleApp/AwsCredentials.properties
. - Locate the following section and fill in your Access Key ID and Secret
Access Key:
# Fill in your AWS Access Key ID and Secret Access Key # http://aws.amazon.com/security-credentials accessKey = secretKey =
- Save the file.
- Run the .java file for your sample, located in the same directory as the
properties file. For example, run the
aws-java-sdk/samples/AwsConsoleApp/AwsConsoleApp.java
file for the Console sample. The sample prints information to the standard output, for example:
=========================================== Welcome to the AWS Java SDK! ===========================================
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 154767691 bytes.
NOTE: Each
sample also includes an Ant build.xm
l
file to run the sample. For more information on Ant, see http://ant.apache.org.
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Subscribe to Tutorials
Related Tutorials
Program using concept of byte long short and int in java
Update contents of a file within a jar file
Tomcat and httpd configured in port 8080 and 80
Count number of vowels, consonants and digits in a String in Java
Student marks calculation program in Java
Calculate gross salary in Java
Calculate average sale of the week in Java
Vector in Java - Sample Program
MultiLevel Inheritance sample in Java