How to export the qualified ARN of lambda functions created in serverless.yml


I’d like to be able to export the qualified arn of lambda functions that I have defined in the serverless.yml file. In other words, the lambda arn plus the function version.

This is so that I can reference it as a cross-script reference in separate CloudFormation files.

I am able to export the unqualified arn using the name of my function plus ‘LambdaFunction’ as shown below:

        'Fn::GetAtt': [ MyFunctionLambdaFunction, Arn ]
        Name: 'my-function-arn'

But I’d really like to include the function version, if possible.


Serverless will already do an Output of your MyFunctionLambdaFunction qualified arn using this resource name “MyFunctionLambdaFunctionQualifiedArn” in the cloudformation template that it generates, so you can try adding this to your serverless.yml under

  Resources: ...
          Name: MyFunctionLambdaQualifiedArn

This will just add the Export property to the Outputs: in the cfn template, that is generated in the “.serverless” folder. Make sure the resource name matches the one that was generated in the cfn template. Use command serverless package to populate the .serverless folder if you don’t have one.

1 Like

I love you soooooo much!
Thanks a lot for this answer!
I was looking for a solution for 3 days and your answer saved my life!
The trick in my case was because the “.serverless” folder didn`t exists, and because of that, my stepfunctions don’t find the function!