从 cloudformation 堆栈中检索 lambda 函数的 arn

Retrieve the arn of a lambda function from a cloudformation stack

我想知道是否有办法在 cloudformation 堆栈创建期间检索 lambda 函数元数据?我们希望使用 lambda 函数 ARN 通过将其存储在环境变量中来进一步构建 cloudformation 模板的其他部分。

这可能吗?在堆栈创建之前,其他人如何引用 arn?

编辑

您可以使用 intrinsic functions,特别是 Fn::GetAtt 来获取 lambda 函数的 arn。

参见:Fn::GetAtt - AWS CloudFormation

根据 this cheatsheet,您将使用以下内容:

json

"MyFieldName": "Fn::GetAtt": ["MyLambdaFunc","Arn"]

yaml

MyFieldName: !GetAtt MyLambdaFunc.Arn