An API Gateway referencing an already existing lambda?

Hi all!

Is it possible to create an SLS project that references an already-existing lambda? Specifically, the idea would be an API Gateway that, instead of creating its own lambda on deployment, refers to an existing lambda.

Something very roughly like this:

...
functions:
   existsElsewhere:
       handler: (some sort of ref here)
   events:
       - http: GET whatever
...

I at first thought that to do this I’d need to refer to the existing lambda in the SLS yaml’s resources section, and then invoke it somehow from the functions section… but looking into it further, it looks like it may not be possible.

Does anyone know, or have thoughts?

Thank you very much!
Daniel

1 Like