'RDS Service Triggering Lambda
I am new to AWS and I was looking for a way to trigger Lambda from RDS Service in particular MYSql. Is there any way possible to achieve it? If not is there any other way to achieve the same?
Solution 1:[1]
There are now multiple ways to trigger Lambda from both AWS RDS and AWS MySQL, but support varies between DB engines. Please see below edited section of this answer if you are actually curious about RDS Event messages processed by AWS Lambda.
EDIT: If you are looking for a way for AWS Lambda to respond to Event messages emitted by AWS RDS (about the state of the cluster and not DB data events), please read these docs. NOTE: Again, this has nothing to do with AWS Lambda invocation & responding to data manipulation events on DB tables/records.
Solution 2:[2]
If you're using AWS Aurora, you can invoke an AWS Lambda function from by calling the mysql.lambda_async
procedure.
Example:
CALL mysql.lambda_async (
lambda_function_ARN,
lambda_function_input
)
lambda_function_ARN
The Amazon Resource Name (ARN) of the Lambda function to invoke.
lambda_function_input
The input string, in JSON format, for the invoked Lambda function.
EDIT: More details available here: Invoking a Lambda function from an Amazon Aurora MySQL DB cluster
Solution 3:[3]
As of March 15th 2022, you can invoke an AWS Lambda function only from PostgreSQL engine in RDS but not from MySQL engine. The documentation is provided below:
You can also invoke an AWS Lambda function from either MySQL or PostgreSQL engines in Aurora (NOTE: Aurora is different AWS service from RDS). The documentation for both is provided below:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | azec-pdx |
Solution 2 | azec-pdx |
Solution 3 | azec-pdx |