DynamoDB has a feature called "Streams", which can automatically call a Lambda function whenever a table row is created or updated.
Is there a way to implement this with RDS (MySQL) and Lambda? I would love it if a Lambda function could be called when a row is created or updated.
I know it's possible to poll the database for table/row changes, but I'd rather have the Lambda be triggered from an external event. I also read about RDS Events and using SNS to subscribe to these events. But these RDS Events seem like operational events (Availability, Configuration, Recovery). There are no "events" for data changes.
At the time of writing there is no easy way to do this. RDS doesn't track actual SQL actions and MySQL doesn't know how to interface with Lambda.
That said, if you take a look at this relevant SO thread (Send an http request in mysql trigger after insertion in a table) it explains how to perform and HTTP request.
Now, if you have a lambda function behind API Gateway and perform an HTTP request, you might be able to accomplish what you want, but [without knowing the application], I would ask whether it would be easier to update your application to trigger the lambda functions itself.
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