'Binding API gateway to multiple lambdas with FastAPI
I have been following this article for deploying a FastAPI app on AWS lambda and integrating that with API Gateway, and I have done with that.
Now the issue I have two different app on two different lambda, now I want to connect the both lambda to same api gateway. Is it possible, how can I do that ??
Any suggestion is helpful.
I have tried to deploy an other method /service and that has an resource for ANY with lambda proxy integration enabled. When I git the api with key/service/ it says method not
{"detail":"Not Found"}
while I have an route for this enabled in APP which looks like below.
@router.get("/", status_code=status.HTTP_200_OK)
def get_version(request: Request):
return {'version': 'v1.0.0'}
Please help
Solution 1:[1]
You can very well create several endpoints in API Gateway, and link them to different lambda functions.
For instance, let's say your two apps only have the get endpoint you describe.
Then, you could very well define 2 resources (app1 and app2), each one of them with a GET method, linking to the different lambda functions.
If this is what you did, and it didn't work, then there is probably another problem, like are you lambdas in the same VPC, with right policies etc
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 | HuguesG |
