简体   繁体   中英

How to invoke a Lambda Function from an Amazon Aurora MySQL DB Cluster using native synchronous function

I've created a Lambda function that will take a user's name and email and post those to an API. I then created an Aurora MySQL DB instance that will invoke that Lambda function. To invoke it, I created a trigger as such :

Time: AFTER
Event: Insert
Definition: BEGIN
CALL mysql.lambda_async("arn:aws:lambda:eu-west-2:<id-number>:function:user-to-API", CONCAT ('{"user_first_name": "', NEW.first_name, '", "user_email": "', NEW.email, '"}')); 
END
Definer: master_user@%

However, I want to do this synchronously, to trigger the lambda function only once. This is possible with an Aurora MySQL Native Function . However, I have tried without the mysql part - using lambda_sync and always receive the same error: MYSQL PROCEDURE mysql.lambda_sync does not exist OR MYSQL PROCEDURE lambda_sync does not exist . Does anyone have any experience with this?

Thank you in advance for your support.

本机函数通过SELECTDO CALL用于存储过程。

For everyone who faces the same issue as of 19 November 2018, according to AWS, the mysql.lambda_sync procedure is not supported for a DB cluster created in Aurora MySQL 5.7 (Aurora MySQL 2.* version). In Aurora MySQL 2.* version the use of native function technique as well as 'sync' lambda procedures is not supported. They have amended the documentation but it's still confusing. At the end of the day, however, I had to use calls to the mysql.lambda_async .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM