Amazon DynamoDB
Developer Guide (API Version 2012-08-10)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Running Java Examples for DynamoDB

General Process of Creating Java Code Examples (Using Eclipse)

1

Download and install the AWS Toolkit for Eclipse. This toolkit includes the AWS SDK for Java, along with preconfigured templates for building applications.

2

Create a new AWS Java project in Eclipse.

Note that the project is pre-configured; it includes the AWS SDK for Java jar files, and also the AwsCredentials.properties file for your AWS access keys.

3

In the Create an AWS Java Project dialog box, enter project name in the Project name field and select one of the toolkit accounts from the Select Account drop-down list. To add a new account to the toolkit, click Configure AWS accounts....

Eclipse adds the AWS access keys associated with the toolkit account that you select to the AwsCredentials.properties file as shown in the following example:

#Insert your AWS Access Keys
#Wed Jan 04 19:02:08 PST 2012
secretKey=*** Your Account Secret Access Key***
accessKey=***Your Account Access Key ID***

4

Copy the code from the section that you are reading to your project.

5

Run the code.


Setting the Region

You can set the DynamoDB region explicitly, as shown in the following Java code snippet.

client = new AmazonDynamoDBClient(credentials);
client.setRegion(Region.getRegion(Regions.US_WEST_2)); 

For a current list of supported regions and endpoints, see Regions and Endpoints.