-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01f631d
commit 6d43c7c
Showing
2 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,4 +137,5 @@ __azurite_db*__.json | |
|
||
# Serverless directories | ||
.serverless | ||
node_modules | ||
node_modules | ||
aws_lambda_fastapi_venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
# aws-lambda-serverless-fastapi | ||
fastapi rest api aws lambda with serverless | ||
Deploy fastapi on aws lambda with serverless | ||
|
||
* production ready | ||
* good project structure | ||
* cd/cd with github action | ||
|
||
# local development (fastapi) | ||
|
||
## env | ||
```bash | ||
# create virtual environment | ||
python3 -m venv .aws_lambda_fastapi_venv | ||
|
||
# activate virtual environment | ||
source .aws_lambda_fastapi_venv/bin/activate | ||
``` | ||
|
||
## run fast api project | ||
|
||
```bash | ||
# install packages | ||
pip3 install -r requirements.txt | ||
|
||
# run project with uvicorn | ||
uvicorn "fastapi_project.main:app" --reload --port=8000 | ||
``` | ||
|
||
# deploy on production | ||
|
||
## github action | ||
|
||
set secrets `SERVERLESS_ACCESS_KEY` , `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` | ||
|
||
## serverless | ||
* set your data | ||
|
||
```bash | ||
# serverless.yml | ||
org: code4mk | ||
app: demo-app-api-fastapi | ||
service: demo-app-api-fastapi | ||
``` | ||
|
||
## with cli | ||
|
||
```bash | ||
serverless deploy --aws-profile your_aws_profile_name | ||
``` | ||
|
||
|
||
|