-
Notifications
You must be signed in to change notification settings - Fork 0
/
write.js
32 lines (26 loc) · 940 Bytes
/
write.js
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
var AWS = require("aws-sdk");
let awsConfig = {
"region": "us-east-2",
"endpoint": "http://dynamodb.us-east-2.amazonaws.com",
"accessKeyId": "AKIAIDHKWRBLMX4QOONQ", "seretAccessKey": "BcUpw7gygBFTaqiKb7mFYmIACUQZB/7cYPwNnwAQ"
};
AWS.config.update(awsConfig);
let docClient = new AWS.DynamoDB.DocumentClient();
let save = function () {
var input = {
"email_id": "example3@gmail.com", "created_by": "clientUser", "created_on": new Date().toString(),
"updated_by": "clientUser", "updated_on": new Date().toString(), "is_deleted": false
};
var params = {
TableName: "users",
Item: input
};
docClient.put(params, function (err, data) {
if (err) {
console.log("users::save::error - " + JSON.stringify(err, null, 2));
} else {
console.log("users::save::success" );
}
});
}
save();