This project contains source code and supporting files for a serverless application that you can deploy with the SAM CLI. It includes the following files and folders.
- hello_world - Code for the application's Lambda function. Basically a normal FastAPI app, with a mangum wrapper.
- template.yaml - A template that defines the application's AWS resources. No security is included, if deployed as is your API will be public.
The real magic is here, this passes any request through to the lambda we've created, with mangum/FastAPI running inside. New routes just work, like we'd expect with a container or similar. Just modify the routes in app.py
to fit your usecase!
Events:
HelloWorld:
Type: Api
Properties:
Path: /{proxy+}
Method: ANY
Thanks to alexharv074 for the blog post that showed me this undocumented feature!
Then:
sam build -u
sam deploy --guided
Install the main folder requirements, and run app.py.