Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Modifying an existing application to use DAX

Focus mode
Modifying an existing application to use DAX - Amazon DynamoDB

If you already have a Java application that uses Amazon DynamoDB, you can modify it so that it can access your DynamoDB Accelerator (DAX) cluster. You don't have to rewrite the entire application because the DAX Java client is similar to the DynamoDB low-level client included in the AWS SDK for Java 2.x. See Working with items in DynamoDB for details.

Note

This example uses AWS SDK for Java 2.x. For the legacy SDK for Java 1.x version, see Modifying an existing SDK for Java 1.x application to use DAX.

To modify your program, replace the DynamoDB client with a DAX client.

Region region = Region.US_EAST_1; // Create an asynchronous DynamoDB client DynamoDbAsyncClient client = DynamoDbAsyncClient.builder() .region(region) .build(); // Create an asynchronous DAX client DynamoDbAsyncClient client = ClusterDaxAsyncClient.builder() .overrideConfiguration(Configuration.builder() .url(<cluster url>) // for example, "dax://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com" .region(region) .addMetricPublisher(cloudWatchMetricsPub) // optionally enable SDK metric collection .build()) .build();

You can also use the high-level library that is part of the AWS SDK for Java 2.x, replacing the DynamoDB client with a DAX client.

Region region = Region.US_EAST_1; DynamoDbAsyncClient dax = ClusterDaxAsyncClient.builder() .overrideConfiguration(Configuration.builder() .url(<cluster url>) // for example, "dax://my-cluster.l6fzcv.dax-clusters.us-east-1.amazonaws.com" .region(region) .build()) .build(); DynamoDbEnhancedAsyncClient enhancedClient = DynamoDbEnhancedAsyncClient.builder() .dynamoDbClient(dax) .build();

For more information, see Mapping items in DynamoDB tables.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.