Reference serverless framework generated lambda in cloudformation template



What is the easiest way to reference a serverless framework generated lambda function in CF template?

Sorry if this question has already been answered, but I haven’t been able to find an answer to this question in the docs or on this forum.



Do you want to reference a Serverless generated function in a DIFFERENT CloudFormation template? In that case you can reference resources by referencing the stack they are in:

If you want to reference in the same CloudFormation template, you can use the logicalIds.


I wanted to reference the function in the same stack.

What I actually had to do is use the logical id.
Logical id for serverless autogenerated lambda is:
the lambda function name with the “LambdaFunction” postfix, everything in PascalCase


    handler: lambda/random-name.default

The logical id is RandomNameLambdaFunction