Skip to content

Instantly share code, notes, and snippets.

@anubhavsinha
Created August 12, 2015 18:08
Show Gist options
  • Save anubhavsinha/23bf9cb0a6bce033c2eb to your computer and use it in GitHub Desktop.
Save anubhavsinha/23bf9cb0a6bce033c2eb to your computer and use it in GitHub Desktop.
Amazon DynamoDB NodeJS example script
var AWS = require('aws-sdk'); // credentials can be loaded through IAM role
var dynamodb = new AWS.DynamoDB();
var item = {
"Color":{"S":"white"},
"Name":{"S":"fancy vase"},
"Weight":{"N":"2"},
"LastName":{"S":"Kumar"}
}
// To put an item to DynamoDB
dynamoDB.putItem(
{
"TableName":"Table1",
"Item": item
}, function(result)
{
result.on('data', function(chunk)
{
console.log(""+chunk);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment