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?
When you use Amazon SES to receive messages, you can configure Amazon SES to call your Lambda function when messages arrive. The service can then invoke your Lambda function by passing in the incoming email event, which in reality is an Amazon SES message in an Amazon SNS event, as a parameter.
You can use AWS Lambda to process event notifications from an Amazon Relational Database Service (Amazon RDS) database. Amazon RDS sends notifications to an Amazon Simple Notification Service (Amazon SNS) topic, which you can configure to invoke a Lambda function.
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.
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
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:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With