| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
- 최댓값
- string
- dendrogram
- pandas
- len()
- append()
- numpy
- sklearn
- elbow method
- nan
- IN
- wcss
- DataFrame
- Python
- matplotlib
- Dictionary
- 덴드로그램
- analizer
- 분류 결과표
- function
- data
- 최솟값
- Machine Learning
- del
- DataAccess
- count()
- 반복문
- hierarchical_clustering
- insert()
- list
- Today
- Total
개발공부
AWS Lambda를 이용한 Serverless Applications 본문
1. AWS IAM 사용자 생성
IAM 사용자 추가
aws 사이트에 로그인 한 후 IAM으로 간다. 왼쪽 메뉴의 사용자를 누른다. 사용자 추가를 누른다. 사용자 명을 적는다. 다음을 누른다. 이 사용자에게 줄 권한을 정해준다. 태그는 선택사항이다. 본
mscha.tistory.com
2. 파이썬 3.8로 가상환경 만든다 .
$ conda create -n flask python=3.8
pip install pillow flask flask-restful mysql-connector-python psycopg2-binary passlib flask-jwt-extended email-validator flask-uploads uuid numpy pandas scikit-learn==0.23.2
3. AWS 에 배포하기 위한 Serverless famework 설치
- npm 설치
Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org

- serverless framework 를 이용해 서버 만들기
아래사이트로 가서 회원가입, 로그인 후 create app 누른다.
Serverless: Develop & Monitor Apps On AWS Lambda
Easily develop and monitor auto-scaling applications on AWS Lambda, API Gateway, DynamoDB, etc., with the Serverless Framework and Serverless Monitoring Dashboard.
www.serverless.com

python flask API 선택

application 이름 생성후 create

아래와 같이 나오는데 복사를 누른다.

깃허브에 올릴것이기 때문에 깃허브 폴더에다가 복사한것을 붙여넣는다.
윈도우에서는 \를 빼고 한줄에 적어야 에러가 나지 않는다.

아래와 같이 뜨면 skip을 선택, 엔터한다.

visual studio code를 새창열기, open folder하여 방금 생성한 폴더를 선택한다.

아래와 같이 나오면 잘 만들어진 것이다.

requirements.txt
배포할 api server에 사용된 라이브러리명을 입력해준다.

app.py
아래와같이 main부분을 추가해준다.

다시 serverless framework 홈페이지로가 org의 providers로 가서 add를 누른다.

next를 누른다.

본인의 AWS Access Key와 Secret Key를 입력한다.


다시 visual studio code로 돌아와 conda 프롬프트 창에
아래 명령어를 입력한다
serverless deploy

아래처럼 나오면 잘 된 것이다.

이제 포스트맨에서 위에 나온 endpoint 주소를 url로 놓고 테스트를 하면 아래와 같이 나온다.

이제 이렇게 만들어진 serverless framework 틀에 api를 생성하면 된다.
'Python > Flask' 카테고리의 다른 글
| Serverless Framework를 이용해 AWS에 배포 자동화 (Github 연결) CI/CD (0) | 2022.06.29 |
|---|---|
| 네이버 파파고 API 사용법 (0) | 2022.06.27 |
| boto3로 이미지 인식하는 Rekognition 사용법 (0) | 2022.06.27 |
| boto3로 S3 파일 업로드 (0) | 2022.06.24 |
| [Flask 에서 JWT 사용] Logout 기능 구현 (0) | 2022.06.21 |