Created
August 12, 2015 18:08
-
-
Save anubhavsinha/23bf9cb0a6bce033c2eb to your computer and use it in GitHub Desktop.
Amazon DynamoDB NodeJS example script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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