'Invoke step function in account A from a lambda in account B using cdk

I have a lambda stack that is deployed in account A, and a stepfunction stack deployer in account B. Now How do I invoke this stepfunction from the lambda using python cdk? specifically what permissions do i need to give them?



Solution 1:[1]

If you want to trigger something when a cdk deployment happens:

Seems a bizarre use-case but I think the solution here is to define a custom resource. Both cdk and cloudformation support that:

https://docs.aws.amazon.com/cdk/api/latest/docs/custom-resources-readme.html

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-custom-resources.html

Because you are using a custom resource you would need to further handle Create, Update, Delete events by yourself. Similarly send completion responses, I would advice you to use cfnresponsemodule to send back completion responses otherwise cdk will never be able to tell when your custom resource function completed:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-lambda-function-code-cfnresponsemodule.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aye_baybae