Created
October 26, 2017 13:17
-
-
Save mlabouardy/4aa00d14a257c659d4871374a01f53e1 to your computer and use it in GitHub Desktop.
Insert data to DynamoDB
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
'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