Aws-sdk-java: Using DAX client to initialize AmazonDynamoDB object

Created on 19 Jan 2018  路  26Comments  路  Source: aws/aws-sdk-java

import com.amazonaws.PredefinedClientConfigurations;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.dax.AmazonDax;
import com.amazonaws.services.dax.AmazonDaxClientBuilder;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;

AmazonDax client = AmazonDaxClientBuilder.standard().withClientConfiguration(PredefinedClientConfigurations.dynamoDefault())
.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("some endpoint", "some region"))
.withCredentials(new AWSStaticCredentialsProvider("Some AWSCredentials"))
.build();

How can I use it to instantiate AmazonDynamoDB instance?

guidance

Most helpful comment

Any word on this?

All 26 comments

Why do you need a AmazonDynamoDB instance? Dax should replace the need for an AmazonDynamoDB client. The operations should all be the same.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.client.modify-your-app.html

I have an existing code that relies on existence of AmazonDynamoDB or equivalent interface. What I get is AmazonDax object, not AmazonDaxClient. I have added this package:

<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dax</artifactId>

version 1.11.267

however I can't seem to resolve references to

com.amazon.dax.client.dynamodbv2.AmazonDaxClient;
com.amazon.dax.client.dynamodbv2.ClientConfig;
com.amazon.dax.client.dynamodbv2.ClusterDaxClient;

to mimic sample code that you're referring to.

The Dax module in this SDK is more of a control plane for configuring Dax. If you would like to use Dax to actually communicate with your tables and data in DynamoDB you need to following the instructions here:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.client.html

It is not included in the SDK.

Is there a maven artefact for DAX client API?

@uzokirov I'm not sure, I'll ask the DynamoDB team and get back to you.

Spoke with the DAX team, unfortunately there is no Maven artifact yet. The team has it on their roadmap but they don't have a tentative date yet. If I hear more information I'll let you know but in the meantime I'll close this issue.

@shorea Then what is this artifact? https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dax Anway in this artifact the package name is com.amazonaws not com.amazon as in AWS DAX documentation

@dulaja the client must be manually downloaded and included in your project. See this page: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.client.html

@shorea Is there an issue tracking the inclusion of the DAX client in the SDK, or at least, tracking its publishing in Maven? If not, should I create one?

DAX will likely be managed in a separate GitHub repository. I will check with the DAX team to see if they are tracking towards any public completion date.

DAX has confirmed that releasing it to GitHub and Maven is in their backlog, but don't have any specific date to communicate at this time.

Some news about the release date of DAX on maven? Manually download a dependency isn't the best way!

Sorry, still no date we can give from the DAX team. We definitely understand it's a pain to not be able to use maven to manage this dependency.

Any word on this?

any news on this question?

I'll follow up with the DAX team.

Yes, please!

I pushed the DAX client to Maven this morning. Documentation on how to add it is at https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DAX.client.run-application-java.html#DAXClient.Maven.

@jdhardy Thanks for that. Which repository did you upload to? It's not showing up here yet: https://mvnrepository.com/artifact/com.amazonaws/amazon-dax-client

@dsilvasc it'll sync to mvnrepository after some time. That's a mirror of Maven Central I believe.

DAX has confirmed that releasing it to GitHub and Maven is in their backlog, but don't have any specific date to communicate at this time.

any news on this question? (most interested in GitHub repository though)

@adolfoweloy No, nothing to report at this time. A GitHub release is still in our backlog.

@jdhardy any update on this? Can we use the ones given in the aws dax docs with dynamodbmapper?

@mydata The current DAX client (available from https://mvnrepository.com/artifact/com.amazonaws/amazon-dax-client) implements AmazonDynamoDB and should be usable with DynamoDBMapper. The TryDax example shows the DAX and DynamoDB clients being used interchangeably.

As for a GitHub release, that's still on the backlog.

Regarding infrastructure, Dynamo db does not associated with any security groups. When dax is created , do we need any sg to be associated with or they are accessible just with IAM policy being attached to instance where app is being deloyed? For separate cache, like redid we do maintain sg which can communicate between ec2 and redid. Trying to see any such config needed when using dax with dynamodb. @jdhardy

This isn't really the proper place for a different question - better to use StackOverflow or the AWS Forums.

That said, yes, for now DAX requires a security group, very much like how ElastiCache Redis works.

Was this page helpful?
0 / 5 - 0 ratings