Created
December 5, 2014 00:10
-
-
Save lkptrzk/902fe6f1ba98cc54ff87 to your computer and use it in GitHub Desktop.
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'); | |
var DynamoClient = require('dynamodb-doc').DynamoDB; | |
// This script uses the Shared Credentials File. See reference below for more: | |
// http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html | |
Aws.config.update({ region: 'us-east-1' }); | |
var internals = {}; | |
internals.dynamoClient = new DynamoClient(); | |
internals.writeToDynamo = function () { | |
var params = { | |
TableName: 'test', | |
}; | |
params.Item = { | |
ts: Number(Date.now()), | |
name: 'test', | |
}; | |
internals.dynamoClient.putItem(params, function (err, data) { | |
if (err) { | |
console.error(err); | |
console.error(err.stack); | |
} | |
else { | |
console.log(data); | |
} | |
}); | |
}; | |
internals.dynamoClient.scan({ TableName: 'test' }, function (err, result) { | |
if (err) { | |
throw err; | |
} | |
console.log(result); | |
setInterval(internals.writeToDynamo, 2000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment