Created
September 9, 2019 08:17
-
-
Save anik0054/01bbc413dcef15f03283cef6f1501c77 to your computer and use it in GitHub Desktop.
AWS Lambda hanlder for DynamoDB Stream
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
exports.handler = async(event) => { | |
const eventName = event.Records[0].eventName; | |
const dynamodbRecord = event.Records[0].dynamodb; | |
if (eventName === 'REMOVE') { | |
const email = dynamodbRecord.OldImage.email.S; | |
console.log("Sending email to : " + email); | |
//code to send email | |
} | |
else { | |
console.log("Event is " + eventName + ", Skipping execution"); | |
} | |
const response = { | |
statusCode: 200, | |
body: JSON.stringify('Success'), | |
}; | |
return response; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment