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.”

02-write-data.js

Focus mode
02-write-data.js - Amazon DynamoDB

The 02-write-data.js program writes test data to TryDaxTable.

const AmazonDaxClient = require("amazon-dax-client"); var AWS = require("aws-sdk"); var region = "us-west-2"; AWS.config.update({ region: region, }); var ddbClient = new AWS.DynamoDB.DocumentClient(); var tableName = "TryDaxTable"; var someData = "X".repeat(1000); var pkmax = 10; var skmax = 10; for (var ipk = 1; ipk <= pkmax; ipk++) { for (var isk = 1; isk <= skmax; isk++) { var params = { TableName: tableName, Item: { pk: ipk, sk: isk, someData: someData, }, }; // //put item ddbClient.put(params, function (err, data) { if (err) { console.error("Unable to write data: ", JSON.stringify(err, null, 2)); } else { console.log("PutItem succeeded"); } }); } }
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.