What's new

Put item on DynamoDB table using AWS SDK for Node.js

Fever

Active member
Staff member
I'm new to javascript and node.js and was wondering if someone can help me figure out the syntax of putting a new item onto an existing table on AWS Dynamodb through their node.js SDK. Here's what I have so far. Is there an example for what I'm trying to do? If anyone could point me in the right direction, it'd be much appreciated.

var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
AWS.config.update({region: 'us-east-1'});
var dynamodb = new AWS.DynamoDB();

var item = {
// I need to put the an item with a the primary key of "id", and an attribute called "item"
// I'm new to js and node.js, so if somebody could help me understand the documentation
// http://docs.aws.amazon.com/AWSJavaS...vaScriptSDK/latest/AWS/DynamoDB_20120810.html
}

dynamodb.putItem({TableName: 'log_dev', Item: item}, function(err, data){
if (err) {
console.log(err); // an error occurred
} else {
console.log(data); // successful response
}
});

Continue reading...
 
Top