AWS Code Sample

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

/** * Copyright 2010-2019, Inc. or its affiliates. All Rights Reserved. * * This file is licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. A copy of * the License is located at * * * * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ import; public class TryDax { public static void main(String[] args) throws Exception { TryDaxHelper helper = new TryDaxHelper(); TryDaxTests tests = new TryDaxTests(); DynamoDB ddbClient = helper.getDynamoDBClient(); DynamoDB daxClient = null; if (args.length >= 1) { daxClient = helper.getDaxClient(args[0]); } String tableName = "TryDaxTable"; System.out.println("Creating table..."); helper.createTable(tableName, ddbClient); System.out.println("Populating table..."); helper.writeData(tableName, ddbClient, 10, 10); DynamoDB testClient = null; if (daxClient != null) { testClient = daxClient; } else { testClient = ddbClient; } System.out.println("Running GetItem, Scan, and Query tests..."); System.out.println("First iteration of each test will result in cache misses"); System.out.println("Next iterations are cache hits\n"); // GetItem tests.getItemTest(tableName, testClient, 1, 10, 5); // Query tests.queryTest(tableName, testClient, 5, 2, 9, 5); // Scan tests.scanTest(tableName, testClient, 5); helper.deleteTable(tableName, ddbClient); } }

Sample Details

Service: dynamodb

Last tested:

Author: AWS

Type: full-example

On this page: