Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
deleteAccount
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB();
exports.handler = function(event, context) {
var tableName = "accounts";
var datetime = new Date().getTime().toString();
dynamodb.deleteItem({
"TableName": tableName,
"Key": {
"account_id": {
"S": event.account_id
}
},
"ReturnValues": "ALL_OLD",
}, function(err, data) {
if (err) {
context.fail('ERROR: Dynamo failed: ' + err);
} else {
console.log('Dynamo Success: ' + JSON.stringify(data, null, ' '));
context.succeed('SUCCESS');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment