dynamoDB
v0.1.4
Published
A node js module for accessing Amazon DynamoDB
Downloads
42
Readme
dynamoDB.js - a node.js module for accessing Amazon DynamoDB.
Under development
DynamoDB uses JSON for communication. That means both the request body and the response are in JSON format. This module wraps up the request and takes care of authentication. The user will be responsible for crafting the request and parsing the result(both in JSON).
Usage:
// You can read your credentials from a local file.
var credentials = {AccessKeyId : "Your_AWS_Access_Key_Id",
SecretKey : "Your_Secret_Key"};
var dynamoDB = require('./lib/dynamoDB').DynamoDB(credentials);
Implemented features
CreateTable reference on aws
dynamoDB.createTable(
{"TableName":"Table1",
"KeySchema":
{"HashKeyElement":{"AttributeName":"Color","AttributeType":"S"},
"RangeKeyElement":{"AttributeName":"Weight","AttributeType":"N"}},
"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10}
}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});
ListTables reference on aws
dynamoDB.listTables({}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});
DeleteTable reference on aws
dynamoDB.deleteTable({"TableName":"Table1"}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});
DescribeTable reference on aws
dynamoDB.describeTable({"TableName":"Table1"}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});
PutItem reference on aws
dynamoDB.putItem(
{"TableName":"Table1",
"Item":{
"Color":{"S":"white"},
"Name":{"S":"fancy vase"},
"Weight":{"N":"2"}
}
}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});
GetItem reference on aws
dynamoDB.getItem(
{"TableName":"Table1",
"Key":
{"HashKeyElement": {"S":"white"},
"RangeKeyElement": {"N":"2"}
},
"AttributesToGet":["Color","Weight", "Name"],
"ConsistentRead":true
}, function(result) {
result.on('data', function(chunk){
console.log(""+chunk);
});
});