The official version of amazon-dax-client does not work with AWS's javascript sdk-v3.
As of 2025/03/18 AWS released a DAX client that does work with AWS's JS SDK v3, available here with official example usage here.
However the official client has some limitations, namely the inability to support the bare-bones client.
This repo holds a port of the v2 DAX library (which supports the bare-bones client as well).
- aws/aws-sdk#232
- aws/aws-sdk-js-v3#3687
- https://repost.aws/questions/QUW2_4tPQMRritkjQkytT_cA/how-to-use-js-sdk-v3-to-getitem-from-dax-aws-sdk-client-dax-instead-of-amazon-dax-client
- aws/aws-sdk-js-v3#4263
- https://stackoverflow.com/questions/71319371/amazon-dynamodb-dax-support-for-aws-sdk-for-javascript-v3
This is a port of the library that works with sdk-v3.
The Amazon DAX client only runs from NodeJS, and can be installed using npm:
npm install amazon-dax-client-sdkv3
https://www.npmjs.com/package/amazon-dax-client-sdkv3
import AmazonDaxClient from "amazon-dax-client-sdkv3";
import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb";
const documentDaxClient = new AmazonDaxClient({
client: DynamoDBDocumentClient.from(new DynamoDBClient({
endpoint: process.env.dax,
region: 'us-east-2'
}))
});
const putItem = new PutCommand({
TableName: 'test',
Item: {
CommonName: `${id}`
}
});
await documentDaxClient.send(putItem);
import AmazonDaxClient from "amazon-dax-client-sdkv3";
import { GetItemCommand } from "@aws-sdk/client-dynamodb";
const daxEndpoint = process.env.dax;
const lowLevelDaxClient = new AmazonDaxClient({
client: new DynamoDBClient({
region: 'us-east-1',
endpoint: daxEndpoint
})
});
const params = {
TableName: 'test',
Key: {
CommonName: { S: 'example-id' }
}
};
const getItemCommand = new GetItemCommand(params);
const response = await daxClient.send(getItemCommand);
console.log(response.Item);
You can see more examples under the test folder