我有一个应用程序,它有两个堆栈,都在同一个区域/帐户内。其中一个堆栈需要另一个堆栈中存在的 lambda 的 ARN。我如何参考这个?
// within stackA constructor
public StackA(Construct scope, String id, StackProps props) {
SingletonFunction myLambda = SingletonFunction.Builder.create(this, "myLambda")
// some code here
.build()
CfnOutput myLambdaArn = CfnOutput.Builder.create(this, "myLambdaArn")
.exportName("myLambdaArn")
.description("ARN of the lambda that I want to use in StackB")
.value(myLambda.getFunctionArn())
.build();
}
App app = new App();
Stack stackA = new StackA(app, "stackA", someAProps);
Stack stackB = new StackB(app, "stackB", someBProps);
stackB.dependsOn(stackA);
Run Code Online (Sandbox Code Playgroud)
如何将 ARN 传入 StackB?