개발학습일지

[Serverless] AWS에 배포하기 위한, Serverless framework 설치 (Node.js) 본문

AWS/Serverless

[Serverless] AWS에 배포하기 위한, Serverless framework 설치 (Node.js)

처카푸 2024. 5. 23. 13:19

AWS에 배포하기 위한, Serverless framework 설치

 

Node.js 서버리스 소프트웨어 설치하기

https://nodejs.org/en/

 

Node.js — Run JavaScript Everywhere

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

nodejs.org

처음에 체크하고 다 넥스트한다음 인스톨!

 

Serverless 프레임워크 설치하기

- cmd에서 설치 / 깃허브 경로로 이동해서 설치한다.

$ cd 깃허브 폴더 경로 복사해서 경로 이동

$ npm install -g serverless

npm install -g serverless

 

AWS IAM에서 생성한 유저로 서버리스에 엑세스 권한을 설정해 준다.

1. Serverless 회원가입 해주자


https://www.serverless.com/

 

Serverless: Zero-Friction Serverless Apps On AWS Lambda & Beyond.

Easily build auto-scaling, low-overhead applications on AWS Lambda, API Gateway, DynamoDB, and other managed services with the Serverless Framework.

www.serverless.com

 

2. CMD 에서 서버 리스 세팅 하자

    : 서버리스 메뉴얼   https://www.serverless.com/framework/docs/getting-started

2-1. 깃허브 폴더 안으로 경로 이동

$ cd 내 깃허브 경로 (C:\Users\405\Documents\GitHub)

2-2. 서버리스 프레임워크에 접속

$ serverless

선택 : AWS / Python / Flask API _ 방향키 누르면 움직인다.

2-3.

작성 : Name Your Service : 내 서비스 이름

선택 : Login/Register

2-4. 로그인 완료되었다. [You have successfully signed in.]

선택 : Skip Adding An App / 내가 만든 앱 선택 / APP 이름 만들기 중 선택해서 만들어주기

선택 : Save AWS Credentials in a Local Profile

2-5. AWS IAM에서 생성한 엑세스 키를 이용해 작성하면 서비스 준비가 완료된다.

작성 : Enter AWS Access Key ID: · 사용자 엑세스키

작성 : Enter AWS Secret Access Key: · 사용자 비밀엑세스키

 

 

 


* serverless 와 Node.js 를 사용하는 이유

aws가 알아서 scale-up을 진행하기 때문에 api 호출이 급작스럽게 늘어나도 aws에서 알아서 서버를 지원하기 때문에,

개발자가 서버를 관리해야 하는 비중이 줄어든다는 장점이 있다.

참조. https://velog.io/@alli-eunbi/Node-JS-Serverless-%EB%B0%B0%ED%8F%AC

 

Node JS & Serverless 배포

Serverless를 사용하는 이유 Serverless FrameWork 활용 serverless 프레임워크를 install 해준다. serverless.yml은 아래와 같이 입력해준다. service 이름은 project 이름으로 주었다. plugins는 다양하

velog.io