python 3.9.10
- create virtual environment
python -m venv venv
- activate virtual environment
source venv/bin/activate
- install requirements
pip install -r api/requirements.txt
- create
api/.env
usingapi/.env.example
- start the api server
cd api
uvicorn main:app --reload
API docs are available when running locally: http://127.0.0.1:8000/docs
Make sure you stay in the same region!
Used to store files uploaded via the API and the lambda deployment package.
- Create an S3 bucket
Serverless deployment of our API.
- Create new lambda function with Python 3.9 runtime
- Upload deployment package from S3 (see Deployment)
- Update lambda handler to
main.handler
- Add S3_BUCKET environment variable to the lambda configuration
- Create new public REST API.
- Create a new method for ANY action.
- Select the Lambda Function integration type
- Check "on" Use Lambda Proxy Integration
- Set Lambda Function to the Lambda function name
- Confirm that you are giving API Gateway permissions to invoke the Lambda function
- Create a resource
- Check "on" the option to Configure as proxy resource
- Select the Lambda Function integration type
- Set Lambda Function to the Lambda function name
- Confirm that you are giving API Gateway permissions to invoke the Lambda function
- Deploy API
- Create new stage
It's a manual process right now
- Zip up a deployment package for AWS Lambda.
source venv/bin/activate
rm -rf api.zip
cd ./venv/lib/python3.9/site-packages
zip -r9 ../../../../api.zip .
cd ../../../../api && zip -x .env -g ../api.zip -r .
- Upload your zip file to your AWS S3 bucket.
- Update lambda source code
- containerize local dev environment
- debgging and logging tools
- review and organize code
- define branching structure
- authentication
- automate infrastructure creation
- automate deployments, CI/CD
- testing automation and tooling
- figure out how to deploy docs