The project I'm working on requires creating an DB aurora (PostgreSQL) that will invoke my step function (After every insert to X table) and gets the result from the step function to invoke a lambda function.
So the question : How can I invoke (and sent data) step function in every insert to my X table? (I am open to any solutions)
CodePudding user response:
RDS has a Lambda integration that you can use to send CRUD events from your PostreSQL database to Lambda. Your Lambda would then start execution of your Step Function with an SDK call.
Follow the steps in the AWS blog post Enable near real-time notifications from Amazon Aurora PostgreSQL by using database triggers, AWS Lambda, and Amazon SNS, but invoke Step Functions from your Lambda instead of SNS.
CodePudding user response:
This is not possible to Invoke a step function directly from Aurora DB, the step function can be invoked by:
- AWS Lambda, using the StartExecution call.
- Amazon API Gateway
- Amazon EventBridge
- AWS CodePipeline
- AWS IoT Rules Engine
- AWS Step Functions
There is a way to Invoke a lambda from an Aurora PostgreSQL DB cluster(Invoking an AWS Lambda function from an Aurora PostgreSQL DB cluster), but it is not easy, you can follow the steps in the article, and in the Lambda step, you can Invoke your step function, your solution can be:
Aurora > Lambda > Step Function > Lambda
And not:
Aurora > Step Function > Lambda
Even if you are using a DynamoDB stream, you need to Invoke a Lambda first, you can't Invoke a step function directly.