2
votes

I was wondering if there is a way to retrieve lambda function metadata during the cloudformation stack creation? We are looking to use the lambda function ARN to further build out other parts of the cloudformation template by storing it in an env variable.

Is this even possible? How do others reference arn when they are unknown until stack creation?

ed

2
To clarify... you wish to create other resources in the same CloudFormation template that refer to the Lambda function. Is that correct?John Rotenstein

2 Answers

4
votes

You can use the intrinsic functions, specifically Fn::GetAtt to get the lambda function's arn.

See: Fn::GetAtt - AWS CloudFormation

1
votes

As per this cheatsheet, you would use the following:

json

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

yaml

MyFieldName: !GetAtt MyLambdaFunc.Arn