Search code examples
amazon-web-servicesaws-lambdaaws-cloudformationserverless-framework

Export the Lambda ARN


I would like to export my Lambda ARN that I created using the serverless framework, as I need to use this ARN in other CF template

I defined Outputs and Export in my serverless.yml file.

resources:
  Outputs:
    ServiceLambdaFunctionQualifiedArn:
      Export:
        Name: MyServiceARN

It's working fine.

However, the export contains the lambda version ARN (i.e arn:aws:lambda:region:12345:function:servicename:2).

This is causing issue as this ARN is used by other CF thus cannot be updated.

"Export MyServiceArn cannot be updated as it is in use by xyz"

Is there a way to get the ARN without the version number ?

Thanks for your help.


Solution

  • Try

    resources:
      Outputs:
        ServiceLambdaFunctionQualifiedArn:
          Export:
            Name: MyServiceARN
          Value:
            Fn::GetAtt: ServiceLambdaFunction.Arn