Amazon DynamoDB
开发人员指南 (API 版本 2012-08-10)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 Amazon AWS 入门

02-write-data.js

02-write-data.js 程序向 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"); } }); } }