amazon-web-servicesaws-cloudformationaws-sam

How a lambda can use an API gateway in a different stack


I'm using AWS SAM and I have one problem.

I have one API Gateway resource that is in stack 1 and I have a lambda function in stack 2. I need to reference the API Gateway to create an event to fire. Cloudformation does not allow you to reference an API Gateway in another stack.

How can I solve this problem


Solution

  • There is no way to reference API resource defined in another template. Decided to create separate API's and use Custom Domain Names to have 1 endpoint