Simple Serverless FastAPI with AWS Lambda
git clone https://github.com/xai1983kbu/fastapi-python.git
cd fastapi-python
cd externalDepsLayer
mkdir -p python/lib/python3.9/site-packages
pip install -r requirements.txt --target python/lib/python3.9/site-packages
cd ..
How to continuously deploy a FastAPI to AWS Lambda with AWS SAM
sam deploy -g --capabilities CAPABILITY_IAM
Note the output from the SAM deployment process - ApiUrl.
Open in browser
{ApiUrl}api/v1/users/users
You will see:
{"message":"Get Users!"}
- Delete the stacks
aws cloudformation delete-stack --stack-name STACK_NAME
- Confirm the stacks have been deleted
aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"