Skip to content

Instantly share code, notes, and snippets.

@anik0054
Created September 9, 2019 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anik0054/01bbc413dcef15f03283cef6f1501c77 to your computer and use it in GitHub Desktop.
Save anik0054/01bbc413dcef15f03283cef6f1501c77 to your computer and use it in GitHub Desktop.
AWS Lambda hanlder for DynamoDB Stream
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