Skip to content

Instantly share code, notes, and snippets.

@mlabouardy
Created October 26, 2017 13:17
Show Gist options
  • Save mlabouardy/4aa00d14a257c659d4871374a01f53e1 to your computer and use it in GitHub Desktop.
Save mlabouardy/4aa00d14a257c659d4871374a01f53e1 to your computer and use it in GitHub Desktop.
Insert data to DynamoDB
'use strict';
var AWS = require('aws-sdk'),
uuid = require('uuid'),
documentClient = new AWS.DynamoDB.DocumentClient();
exports.writeMovie = function(event, context, callback){
var params = {
Item : {
"Id" : uuid.v1(),
"Name" : event.name
},
TableName : process.env.TABLE_NAME
};
documentClient.put(params, function(err, data){
callback(err, data);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment