'AWS API Gateway Proxy with many lambdas
I´ve been using AWS API Gateway for quite a long time, and last month I started using it by calling my C# ASPNET inside a Lambda function throught a proxy integration. And that was fine. Then I needed another lambda function with a different ASPNET API, and for this one, I had to create another API Gateway with another proxy integration. I´m reaching the fourth lambda.
MyFirstApi, with resources:
/{proxy+} ..... pointing to lambda 1
MySecondApi, with resources:
/{proxy+} ..... pointing to lambda 2
MyThirdApi, with resources:
/{proxy+} ..... pointing to lambda 3
MyFourthApi, with resources:
/{proxy+} ..... pointing to lambda 4
I´m trying to guess if there is a way to have one single API Gateway, with multiple resources, one for each lambda function, each one a proxy integration. Example:
MySingleApi, with resources:
/function1/{proxy+} ..... pointing to lambda 1
/function2/{proxy+} ..... pointing to lambda 2
/function3/{proxy+} ..... pointing to lambda 3
/function4/{proxy+} ..... pointing to lambda 4
I can create them, and point each one to a different lambda function, but the APIGatewayRequest object carries that "functionN" string as part of the path parameter, which is not mapped inside the ASPNET API controller/method routing, causing a 404 error.
Am I missing something here ?
Solution 1:[1]
Create multiple resources from the root path without proxy settings.
Register a resource with proxy settings under each resource.
The settings I worked on are as follows. enter image description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | devsong |