AWS SAM을 이용한
모놀리식 서버리스 어플리케이션 운영하기
현창훈
Modu Co.
Serverless
No Ops
너무 좋아보인다.
Api Gateway + Lambda
확장성
고가용성
저렴한 비용
인프라 관리, 운영 부담이 적음
계속 서버가 실행 돼야 하면 부적합
Cold Start
FaaS 제공사에 의존적
제한사항
● Lambda : https://docs.aws.amazon.com/lambda/latest/dg/limits.html
● API Gateway : https://docs.aws.amazon.com/ko_kr/apigateway/latest/developerguide/limits.html
Serverless == MSA?
하면 좋은것은 인정.
저도 하고싶어요 ㅠㅠ
그러나
부족한 인력
혼자 백엔드 개발 / 운영 하는 중…
혼자서 MSA로 분리해서 운영할 자신이 없음.
부족한 지식
어떻게 서비스를 분리해서 설계할지 감이 잘 안잡힘.
그래도 서버리스는 하고싶다!
운영에 대한 부담이라도 줄이자.
Express로 만든 서버를 AWS Lambda에서 실행시킨다.
기존 Express 프로젝트를 그대로 사용 가능
로컬 실행과 다른점
1. Amazon Linux
○ CodeBuild
○ Docker-Lambda
2. Node 8.10
○ Babel
3. API Gateway를 거친다.
○ Integration test
4. Lambda & API Gateway의 제약사항들
Aws Serverless Express
ASE
Express
Lambda
function
Amazon API
Gateway
Cloudformation & SAM
CloudFormation
AWS 리소스를 JSON, YAML로 프로비저닝
리소스 별 예제
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-general.html
프로비저닝된 다양한 프로젝트들
https://github.com/awslabs
SAM(Serverless Application Model)
오픈소스
CloudFormation의 서버리스 스택들을 간단하게 만들 수
있음.
AWS::Serverless::Function : Lambda
AWS::Serverless::Api: API Gateway
AWS::Serverless::SimpleTable: DynamoDB
AWS의 다른 리소스들도 SAM에서 프로비저닝 가능함.
AWS
Lambda
Amazon
DynamoDB
Amazon API
Gateway
AWS
CloudFormation
API Gateway
Lambda & Role
CloudFormation
CloudWatch Alarm
CloudWatch Dashboard
Amazon API
Gateway
AWS
Lambda
Lambda
Amazon
RDS
Amazon
S3
Amazon
Route 53
기존 모놀리식 구조에서 EC2, ELB만 Lambda로 대체된
인프라
Amazon
Athena
EC2를 개발서버로 사용해서 브라우저에서 코딩
플랫폼에 종속적인 패키지도 배포 가능
IDE에서 SAM Deploy 지원
Lambda와 API Gateway에 Local test, Remote test 지원
탭 끄려고 Command + W를 자꾸 누름
IDE에서 Git을 위한 기능이 없음
CloudFormation과 함께라면 쉽게 만들수 있어요
VPC 먼저 만들고
CloudFormation과 함께라면 쉽게 만들수 있어요
Cloud9 만들면 끝!
CI / CD
AWS
CodeDeploy
AWS
CodeBuild
AWS
CodePipeline
GitHub
Code
Build
Code
Deploy
Manual
Approval
SNS
Code
Build
Code
Deploy
Reject
Approve
CloudFormation으로 프로비저닝
SPA & Static website hosting
references:
https://docs.aws.amazon.com/ko_kr/AmazonS3/latest/dev/hosting-websites-on-s3-examples.html
https://johnlouros.com/blog/using-CloudFront-to-serve-an-SPA-from-S3
Web
Amazon
S3
Amazon
CloudFront
Amazon
Route 53

AWS SAM을 이용한 모놀리식 서버리스 어플리케이션 운영하기