Menu
Amazon DynamoDB
Developer Guide (API Version 2012-08-10)

02-write-data.js

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 <= 10; 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"); } }); } }