title: Deploy FastAPI on AWS ApiGateway with AWS Lambda using AWS python cdk
body: <p>Is there a way to have a whole FastAPI app served as an AWS Lambda with APIGateway?</p>
  <p>I know you can create a lambda function with a single function and use it with APIGateway, but I can't seem to find a way to do this with the complete FastAPI app.</p>
  <p>I only found tutorials on how to serve a FastAPI app using a FargateService with the API bundled in a docker container (like shown <a href="https://www.eliasbrange.dev/posts/deploy-fastapi-on-aws-part-2-fargate-alb/" rel="nofollow noreferrer">here</a>)</p>
  <p>From what I understand this would create an ECS instance that always runs (and hosts the API), but due to this being a rather small thing I think the lambda approach of only running when it's called would be better.</p>