What is the difference between "amazon-dax-client" and "@aws-sdk/client-dax"?

108 views Asked by At

Can either of them be used to configure dax client and perform operations on it?

I wasn't able to use "@aws-sdk/client-dax" to configure client and perform getItem command.

const { DAXClient, GetItemCommand } = require("@aws-sdk/client-dax");
const { DynamoDBDocumentClient } = require("@aws-sdk/lib-dynamodb");

const dax = new DAXClient({
  region: 'REGION',
  endpoints: ['CLUSTER_ENDPOINT'],
});

const ddbDocClient = DynamoDBDocumentClient.from(dax);

const params = {
  TableName: 'TABLE_NAME',
  Key: {
    'Key': 'KeyValue',
  },
};

ddbDocClient.send(new GetItemCommand(params))
  .then((data) => {
    console.log("GetItem succeeded:", JSON.stringify(data, null, 2));
  })
  .catch((error) => {
    console.error("Unable to get item. Error JSON:", JSON.stringify(error, null, 2));
  });
1

There are 1 answers

0
Leeroy Hannigan On

@aws-sdk/client-dax is built into the AWS SDK and is only used for control plane operations, such as CreateCluster.

amazon-dax-client is used for dataplane operations such as GetItem or Query etc... Due to the protocols that DAX implements for dataplane operations it is not packaged with the official SDK. It is also not available for JS SDK V3 yet.