I have a use case where I manually trigger an AWS Step Function to migrate data between two different databases using the AWS DMS service. The Step Function execution creates a resource called ReplicationInstance. The problem is that the creation of the ReplicationInstance takes more than 18 minutes. Currently, I'm using an estimated wait time of 20 minutes, but this is not efficient.
I want to improve this process by pausing the creation of the replication task until the ReplicationInstance is successfully created. To achieve this, I'm using an EventBridge rule to detect when the ReplicationInstance status becomes active. My goal is to automate the process of capturing the task token from the Step Function and sending it back when the event "ReplicationInstance is active" is triggered.
The figure below illustrates the problem I'm facing. Can anyone provide guidance or examples on how to automate the task token capture and return process within AWS Step Functions?