Skip to content

Instantly share code, notes, and snippets.

@mako34
Created February 8, 2017 06:29
Show Gist options
  • Select an option

  • Save mako34/02a3d6bafa7fa7f8c3d0db4581df99e4 to your computer and use it in GitHub Desktop.

Select an option

Save mako34/02a3d6bafa7fa7f8c3d0db4581df99e4 to your computer and use it in GitHub Desktop.
lambda 2 dynamo
//https://www.youtube.com/watch?v=G_-aEXmluq8
console.log('emezao');
const AWS = require('aws-sdk');
const docClient = new AWS.DynamoDB.DocumentClient({region:'us-east-1'});
exports.handler = function (e, ctx, callback){
console.log('handler empezo');
//logea event!
console.log('entro e con:'+e); //como logea correcto?
console.log(e);
var params = {
Item:{
date: Date.now(),
message:"tkt"
},
TableName:'guestbook'
};
docClient.put(params, function(err, data){
if (err) {
callback(err, null);
}else{
callback(null, data);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment