Skip to content

Commit 6d43c7c

Browse files
committed
documentation
1 parent 01f631d commit 6d43c7c

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ __azurite_db*__.json
137137

138138
# Serverless directories
139139
.serverless
140-
node_modules
140+
node_modules
141+
aws_lambda_fastapi_venv

README.md

+51-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
11
# aws-lambda-serverless-fastapi
2-
fastapi rest api aws lambda with serverless
2+
Deploy fastapi on aws lambda with serverless
3+
4+
* production ready
5+
* good project structure
6+
* cd/cd with github action
7+
8+
# local development (fastapi)
9+
10+
## env
11+
```bash
12+
# create virtual environment
13+
python3 -m venv .aws_lambda_fastapi_venv
14+
15+
# activate virtual environment
16+
source .aws_lambda_fastapi_venv/bin/activate
17+
```
18+
19+
## run fast api project
20+
21+
```bash
22+
# install packages
23+
pip3 install -r requirements.txt
24+
25+
# run project with uvicorn
26+
uvicorn "fastapi_project.main:app" --reload --port=8000
27+
```
28+
29+
# deploy on production
30+
31+
## github action
32+
33+
set secrets `SERVERLESS_ACCESS_KEY` , `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
34+
35+
## serverless
36+
* set your data
37+
38+
```bash
39+
# serverless.yml
40+
org: code4mk
41+
app: demo-app-api-fastapi
42+
service: demo-app-api-fastapi
43+
```
44+
45+
## with cli
46+
47+
```bash
48+
serverless deploy --aws-profile your_aws_profile_name
49+
```
50+
51+
52+

0 commit comments

Comments
 (0)