stepfunctions-tasks: Step Functions task for cross-region AWS API call #29918
Labels
@aws-cdk/aws-stepfunctions-tasks
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
It would be useful if we could call AWS API across regions from a Step Functions state machine.
Currently it is not officially supported even with AWS SDK integration tasks.
Use Case
My usecase is to automate cross-region failover in a multi-region application. This requires you to orchestrate multiple API calls for both active and standby regions (e.g. failover Aurora DB cluster, rewrite AppConfig parameter, etc), and it would be great if we can manage these operations in a single state machine.
Proposed Solution
Add a construct like
CallAwsServiceAcrossRegion
in theaws-stepfunctions-tasks
module. The API would be similar to the existingCallAwsService
task, with an additional propertyregion
.In the new construct, we create a Lambda function to proxy the API request to the target region, use
LambdaInvoke
task internally, and call AWS API from the function.I wrote an example Lambda function to proxy AWS API requests: https://gist.github.com/tmokmss/aeb85fc8c3076cbc5d9ae1c6698969d1
The alternative option would be adding a property like
region
toCallAwsService
task, but it could potentially make a breaking change when SFn would officially start to support cross-region AWS API call. That is why I think the above approach (creating a brand new construct) is better.Other Information
No response
Acknowledgements
CDK version used
2.138.0
Environment details (OS name and version, etc.)
n/a
The text was updated successfully, but these errors were encountered: