Created
January 11, 2019 13:51
-
-
Save TrueGeek/e813e986ed8d237b5c8ab70efd0f9a7a to your computer and use it in GitHub Desktop.
AWS Lambda DynamoDB PUT
This file contains 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 dynamodb = new AWS.DynamoDB.DocumentClient(); | |
exports.handler = (event, context, callback) => { | |
dynamodb.scan({ | |
TableName: 'ggmug' | |
}, (err, data) => { | |
if (err) { | |
console.log('Error putting item into dynamodb failed: ' + err); | |
callback('500'); | |
} | |
else { | |
console.log('saved'); | |
callback(null, data.Items); | |
} | |
}); | |
console.log('done'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment