-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathload.js
More file actions
32 lines (27 loc) · 823 Bytes
/
load.js
File metadata and controls
32 lines (27 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Load the AWS SDK for JS
var AWS = require("aws-sdk");
var randomstring = require("randomstring");
AWS.config.update({ region: "us-west-2" });
// -----------------------------------------
// Create the document client interface for DynamoDB
var documentClient = new AWS.DynamoDB.DocumentClient();
console.log("Loading data into DynamoDB");
for (let i = 0; i < 1000; i++) {
random = randomstring.generate(7);
var params = {
TableName: "hubert_dynamocdc",
Item: {
"userid": i,
"first_name": random,
"last_name": random,
"phone": i
}
};
documentClient.put(params, function (err, data) {
if (err) {
console.error(err);
} else {
console.log("Succeeded adding an item ");
}
});
};