Created
June 18, 2019 09:56
-
-
Save alexcasalboni/89954974f90e7e05c4b52cc8b0c790de to your computer and use it in GitHub Desktop.
Amazon Aurora MySQL - Trigger to invoke AWS Lambda
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
DROP TRIGGER IF EXISTS TR_contacts_on_insert; | |
DELIMITER ;; | |
CREATE TRIGGER TR_contacts_on_insert | |
AFTER INSERT ON Contacts | |
FOR EACH ROW | |
BEGIN | |
SELECT NEW.email , NEW.fullname | |
INTO @Email , @Fullname; | |
lambda_async( | |
'arn:aws:lambda:REGION:ACCOUNT_ID:function:SendEmailWithContact', | |
CONCAT('{ "email" : "', Email, '", "fullname" : "', FullName, '"}') | |
); | |
END | |
;; | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@wakeupmh Did you find the solution? I think Giving Aurora access to Lambda will help.
aws_default_lambda_role
is mentioned in step 3.Also make sure you granted
AWS_LAMBDA_ACCESS
role to the DB user. See details from here