SlideShare a Scribd company logo
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda 내부 동작 방식
및 활용 방법 자세히 살펴 보기
김일호 솔루션즈 아키텍트 매니저, AWS
발표자료 바로 공개
발표자료는 발표 종료 후 해당
사이트에서 바로 보실 수
있습니다
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda 주요 장점
• 주요 제품 기능
• 사용자 지정 로직으로 다른 AWS 서비스 확장
• 사용자 지정 백엔드 서비스 구축
• 기존 보유 코드 사용
• 완전히 자동화된 관리
• 내장된 내결함성
• 자동 규모 조정
• Amazon CloudFront 요청에 대한 응답으로 코드 실행
• 여러 함수 오케스트레이션
• 통합된 보안 모델
• 사용량에 따라 지불
• 유연한 리소스 모델
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
여러분,
AWS Lambda 를 직접 만들어 본다고 가정해 봅시다.
고민거리
Load Balancing | Auto Scaling | Handling Failures | Security Isolation | Managing Utilization
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Front End Invoke
동기, 비동기 호출을 모두 관장
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Counting Service
사용자가 얼마나 많은 API 요청을 하는지
모니터링하고 제한기능 제공
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Worker Manager
실제 Container의 상태를 관리하고 API 요청을
가용 가능한 Container 로 중계
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Worker
고객 함수(코드)가 안전하게 실행되는 실제
Container 환경
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Placement Service
Worker에 Sandbox 구성을 자원 활용률이 높고,
고객 서비스 영향이 없도록 관리
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
가용 영역으로 트래픽 분산 (Routing) 기능
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Lambda
customer
(Existing
Worker, New
Sandbox)
Availability zone 2
Availability zone 1
Invoke
Front End
Invoke
Front End
Worker Mgr
Worker Mgr
Reserve
Sandbox
Invoke
Worker
Worker
Worker
Init
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Lambda
customer
(Existing
Worker, Existing
Sandbox)
Availability zone 2
Availability zone 1
Invoke
Front End
Invoke
Front End
Worker Mgr
Worker Mgr
Reserve
Sandbox
Invoke
Worker
Worker
Worker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
컴퓨팅 자원의 효율적으로 자동화된
확장 또는 축소
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Lambda
customer
(New Function
or
Scaling Up)
Availability zone 2
Availability zone 1
Invoke
Front End
Invoke
Front End
Worker Mgr
Worker Mgr
Reserve
Sandbox
Invoke
Init
Placement
Claim
Worker
Worker
Worker
Worker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Availability zone 2Availability zone 1
Placement
Claim Worker
Worker Worker Worker Worker Worker
Placement
Claim Worker
Worker Worker Worker Worker Worker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Availability zone 2Availability zone 1
Placement
Return Worker
Worker Worker Worker Worker Worker
Placement
Return Worker
Worker Worker Worker Worker Worker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Cloud
Region
Lambda
customer
Availability zone 2
Availability zone 1
Front End
Front End
Worker Mgr
Worker Mgr
Placement
Return
Worker
Worker
Worker
Worker
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
호스트뿐만이 아니라 가용역역 수준의 가용성 확보
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
With Lambda:
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
With Lambda:
항상 가용한 호스트 사용
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Instance Instance Instance InstanceInstance Instance
AWS Cloud
Region
Availability zone 2Availability zone 1
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Instance Instance Instance InstanceInstance Instance
AWS Cloud
Region
Availability zone 2Availability zone 1
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Sandbox
Lambda Runtime
Your Code
One Function
Many
Accounts
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Virtual Devices
Device Emulation
Physical
Devices
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
virtio drivers
virtio host in Firecracker
Physical
Devices
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hardware
Host OS
Hypervisor
Guest OS
Virtual Devices
Device Emulation
Physical
Devices
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
With Lambda:
정확히 필요할 때 사용한 만큼의 Cost
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inside Lambda:
시스템을 최대한 바쁘게 (busy) 돌리기 위한
최적화
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Bad:
60% 60% 60% 60% 60% 60% 60%
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Good:
99% 99% 99% 99% 0% 0% 0%
Cache Locality
Ability to Autoscale
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Server
Bad: 동일 Workload를 한 곳에 다 담기
Workload
Workload
Workload
Workload
Workload
Workload
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Server
Better: 다양한 Workload를 담기
Workload
Workload
Workload
Workload
Workload
Workload
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Server
Best: 최적화된 Workload 배치
Workload
Workload
Workload
Workload
Workload
Workload
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Worker
Lambda
Function
ENI in
your VPC
Your VPC
Local
NAT
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Worker
Lambda
Function
ENI in
your VPC
Your VPC
Remote
NAT
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
전형적인 Lambda의 DB 접근 아키텍처
AWS Cloud
VPC
Availability zone 1
Availability zone 2
Private subnet
Private subnet
Private subnet
Private subnet
DB Instance
DB instance
standby
Elastic
network
interface
Elastic
network
interface
Lambda
Functions
Security group Security group
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda에서 DB 접근 시 유의할 점
• 여러 가용 역역 내 Subnet 에 ENI 사용
• 가용 역영 레벨의 이벤트 또는 IP 소모 문제를 피할 수 있음
• Lambda 는 VPC 내 ENI로 접근
• 따라서 가용 IP 에 따른 확장성의 제약을 고려 해야함
• ENI 신규 구성은 시간이 소모됨
• 기본적으로 VPC의 Lambda는 인터넷 접근이 불가능함
• NAT Gateway (or NAT instance) 를 추가하고 Routing Table
구성으로 사용이 가능함
• Public host name DNS 쿼리를 피할 수록 좋음
• 비용과 시간 소모
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
고려사항: DB 컨넥션 관리
…
Lambda는 쉽게 확장 가능함, 그렇다면 DB 접근은?
Connection
pooling을 쓰면 될까?
일반 Database
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Time
Container A
Container B
Container C
Container D
Lambda 의 시간에 따른 사용/확장 개요
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
그렇다면 Connection pooling관의 관계는?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connection Pooling 과 Lambda 설정
Container 당 하나의 connection 만 사용
Connection Pool Size = 1 로 설정
또는
Handler 밖에 Global section에 DB connect 객체를 생성 재활용
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
DB connection 선언
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Connection Pooling 과 Lambda - 고려사항
• Lambda container가 사라지는 지 인지할 수 없음
• Connection 를 명시적으로 닫을 수 없음
• Connection 삭제는 Database TTL에 의지
• Lambda container 의 생성 삭제를 조정할 수 없음
• Idle connection이 많이 생성될 수 있음
• 여러 Lambda 함수 실행은 여러 다른 Container에서 실행
될 수 있음
• Connection 재사용을 보장할 수 없음
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
방법 1a: 계정 Concurrency 제한
AWS Account
Lambda can help
with retries of
throttled
invocations*
* - Only for asynchronous and stream based event sources.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
방법 1b: 함수 Concurrency 제한
Lambda can help
with retries of
throttled
invocations*
* - Only for asynchronous and stream based event sources.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Concurrency 제한의 장점
• Lambda의 동시 실행은 account와 function 레벨
모두 제한이 가능
• 방법
• AWS support로 Account 제한은 요청
• AWS Lambda 는 호출 제한이 있을 경우 retry
수행/관리
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Concurrency 제한 - 고려사항
• Account Level 제한:
• Account 내 모든 Lambda에 적용되어 DB 접근 함수 제한이 간
단하지는 않다
• 여러 팀이 단일 Account 사용 시 관리
• Function Level 제한:
• 어떤 Lambda 함수가 DB 접근이 필요한지 확인
• Peak 발생 하기 전에 알고 Application 레벨의 이해 필요
• Lambda 워크로드가 다양할 경우, 다이나믹한 connection
할당이 어려움
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
동적 Connection 관리 아키텍처
Helper
Maintain atomic counter
and max count
Open / close
connections
DB operations
Do something interesting
Generic database
Alarm
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
동적 관리의 장점
• 확장 가능한 구조를 구현
• Connection 수를 관리 가능, Lambda 함수 개수와 무관
• Lambda 함수 실행 시 DB connection 배분이 가능하고 병목되는 곳을
막을 수 있음
• DynamoDB 를 이용하여 Connection 수를 정확히 관리
• CloudWatch metrics를 활용하여 문제가 에러 발생 시 메시지를 받아
다른 처리 구현이 가능
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
동적 Connection 관리 - 고려사항
• 관리할 리소스 증가
• Connection 재사용 불가
• 약간의 Latency 증가
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
트레이싱이 필요한 두 가지 이유
1. 서버리스 아키텍처/어플리케이션 개발 시 Debug 편의성
2. 서버리스 아키텍처/어플리케이션 동작 시 성능 문제 해결의 편의성
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CloudWatch 를 통한 Metrics 모니터링
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
CloudWatch log를 통한 log 분석
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Log와 Metric로 부족한 두 가지 경우
1. 전체 요청 처리 시 서버리스 함수간의 관계 파악 확인
2. 요청 처리 시 다른 리소스 접근에 대한 관계 파악 확인
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS X-ray
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda 함수 간 성능/문제 점검을 위한 정보 제공
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
개발 시 지정된 환경 구성 및 공유 Library 활용
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
커스텀 런타임 만드는 순서
1. Create a Function
2. Create a Layer
3. Update the Function
4. Update the Runtime
5. Share the Layer
6. Clean Up
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda 함수에서 DocumentDB를 접근한다면?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda 함수에서 DocumentDB를 접근한다면?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
MongoDB 용 Lambda Layer 생성
$ cp /usr/bin/mongo ./bin file.
$ zip -j ./archives/mongo.zip ./bin/mongo
$ aws --region us-east-1 lambda publish-layer-version  --layer-name
mongo  --zip-file fileb://archives/mongo.zip
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Golang Lambda Layer 생성
$ go build `-o bin/getkey `src/getkey.go
$ zip -j ./archives/getkey.zip ./bin/getkey
$ aws --region us-east-1 lambda publish-layer-version  --layer-
name get_secret  --zip-file fileb://archives/getkey.zip
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Runtime layer 생성
$ zip -j ./archives/runtime.zip ./src/bootstrap
$ aws --region us-east-1 lambda publish-layer-version  --layer-name
runtime  --zip-file fileb://archives/runtime.zip
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda 함수 생성 예제
$ aws --region us-east-1 lambda create-function --function-name bash-runtime 
--zip-file fileb://archives/function.zip 
--handler function.handler --runtime provided 
--layers arn:aws:lambda:us-east-1:{AccountID}:layer:mongo:1 
arn:aws:lambda:us-east-1:{AccountID}:layer:get_secret:1 
arn:aws:lambda:us-east-1:{AccountID}:layer:runtime:1 
--role arn:aws:iam::{AccountID}:role/lambda-role 
--vpc-config SubnetIds={subnet-xxxxxx},SecurityGroupIds={sg-xxxxxx} 
--kms-key-arn arn:aws:kms:us-east-1:{AccountID}:key/{KMSKeyID} 
--timeout 180
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda 함수 실행
$ aws lambda invoke --function-name $lambda_name  --payload
"{'command’:’Shell.method()'}"  ./output/response.txt
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
여러분의 피드백을 기다립니다!
#AWSSummit 해시태그로
소셜미디어에 여러분의
행사소감을 올려주세요.
AWS Summit Seoul 2019
모바일 앱과 QR코드를 통해
강연평가 및 설문조사에
참여하시고 재미있는 기념품을
받아가세요.
내년 Summit을 만들 여러분의
소중한 의견 부탁 드립니다.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
감사합니다!
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.

More Related Content

PDF
AWS 클라우드 비용 최적화를 위한 TIP - 임성은 AWS 매니저
PDF
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
PDF
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
PDF
AWS Lambda를 기반으로한 실시간 빅테이터 처리하기
PDF
IDC 서버 몽땅 AWS로 이전하기 위한 5가지 방법 - 윤석찬 (AWS 테크에반젤리스트)
PDF
Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나
PDF
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
PDF
실시간 스트리밍 분석 Kinesis Data Analytics Deep Dive
AWS 클라우드 비용 최적화를 위한 TIP - 임성은 AWS 매니저
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
롯데이커머스의 마이크로 서비스 아키텍처 진화와 비용 관점의 운영 노하우-나현길, 롯데이커머스 클라우드플랫폼 팀장::AWS 마이그레이션 A ...
AWS Lambda를 기반으로한 실시간 빅테이터 처리하기
IDC 서버 몽땅 AWS로 이전하기 위한 5가지 방법 - 윤석찬 (AWS 테크에반젤리스트)
Amazon RDS Proxy 집중 탐구 - 윤석찬 :: AWS Unboxing 온라인 세미나
AWS KMS 에서 제공하는 봉투암호화 방식의 암호화 및 사이닝 기능에 대한 소개와 실습 - 신은수, AWS 솔루션즈 아키텍트 :: AWS...
실시간 스트리밍 분석 Kinesis Data Analytics Deep Dive

What's hot (20)

PDF
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
PDF
대용량 데이터베이스의 클라우드 네이티브 DB로 전환 시 확인해야 하는 체크 포인트-김지훈, AWS Database Specialist SA...
PDF
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
PDF
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
PDF
Serverless Framework (2018)
PDF
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
PDF
천만사용자를 위한 AWS 클라우드 아키텍처 진화하기 – 문종민, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020
PDF
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
PDF
Amazon SageMaker 모델 배포 방법 소개::김대근, AI/ML 스페셜리스트 솔루션즈 아키텍트, AWS::AWS AIML 스페셜 웨비나
PDF
[2017 AWS Startup Day] AWS 비용 최대 90% 절감하기: 스팟 인스턴스 Deep-Dive
PDF
[AWS Builders] AWS상의 보안 위협 탐지 및 대응
PDF
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
PDF
AWS Direct Connect 및 VPN을 이용한 클라우드 아키텍쳐 설계:: Steve Seymour :: AWS Summit Seou...
PDF
Amazon EC2 서비스 살펴보기 (박철수) - AWS 웨비나 시리즈
PDF
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
PDF
20191002 AWS Black Belt Online Seminar Amazon EC2 Auto Scaling and AWS Auto S...
PDF
복잡한 권한신청문제 ConsoleMe로 해결하기 - 손건 (AB180) :: AWS Community Day Online 2021
PPTX
AWS 기반 대규모 트래픽 견디기 - 장준엽 (구로디지털 모임) :: AWS Community Day 2017
PDF
대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션 - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
PDF
비즈니스 혁신 가속화와 효과적 규정 준수를 위한 AWS ISMS 소개::신종회::AWS Summit Seoul 2018
마이크로서비스 기반 클라우드 아키텍처 구성 모범 사례 - 윤석찬 (AWS 테크에반젤리스트)
대용량 데이터베이스의 클라우드 네이티브 DB로 전환 시 확인해야 하는 체크 포인트-김지훈, AWS Database Specialist SA...
AWS Transit Gateway를 통한 Multi-VPC 아키텍처 패턴 - 강동환 솔루션즈 아키텍트, AWS :: AWS Summit ...
Amazon EKS로 간단한 웹 애플리케이션 구축하기 - 김주영 (AWS) :: AWS Community Day Online 2021
Serverless Framework (2018)
AWS Summit Seoul 2023 | 다중 계정 및 하이브리드 환경에서 안전한 IAM 체계 만들기
천만사용자를 위한 AWS 클라우드 아키텍처 진화하기 – 문종민, AWS솔루션즈 아키텍트:: AWS Summit Online Korea 2020
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
Amazon SageMaker 모델 배포 방법 소개::김대근, AI/ML 스페셜리스트 솔루션즈 아키텍트, AWS::AWS AIML 스페셜 웨비나
[2017 AWS Startup Day] AWS 비용 최대 90% 절감하기: 스팟 인스턴스 Deep-Dive
[AWS Builders] AWS상의 보안 위협 탐지 및 대응
[Spring Camp 2018] 11번가 Spring Cloud 기반 MSA로의 전환 : 지난 1년간의 이야기
AWS Direct Connect 및 VPN을 이용한 클라우드 아키텍쳐 설계:: Steve Seymour :: AWS Summit Seou...
Amazon EC2 서비스 살펴보기 (박철수) - AWS 웨비나 시리즈
AWS 기반의 마이크로 서비스 아키텍쳐 구현 방안 :: 김필중 :: AWS Summit Seoul 20
20191002 AWS Black Belt Online Seminar Amazon EC2 Auto Scaling and AWS Auto S...
복잡한 권한신청문제 ConsoleMe로 해결하기 - 손건 (AB180) :: AWS Community Day Online 2021
AWS 기반 대규모 트래픽 견디기 - 장준엽 (구로디지털 모임) :: AWS Community Day 2017
대용량 트래픽을 처리하는 최적의 서버리스 애플리케이션 - 안효빈, 구성완 AWS 솔루션즈 아키텍트 :: AWS Summit Seoul 2021
비즈니스 혁신 가속화와 효과적 규정 준수를 위한 AWS ISMS 소개::신종회::AWS Summit Seoul 2018
Ad

Similar to AWS Lambda 내부 동작 방식 및 활용 방법 자세히 살펴 보기 - 김일호 솔루션즈 아키텍트 매니저, AWS :: AWS Summit Seoul 2019 (20)

PDF
컴퓨팅 서비스 업데이트 - EC2, ECS, Lambda (김상필) :: re:Invent re:Cap Webinar 2015
PDF
Firecracker, 서버리스 컴퓨팅을 위한 오픈소스 microVM 기술
PDF
Firecracker, 서버리스 컴퓨팅을 위한 오픈소스 microVM 기술 :: 류한진 - AWS ...
PDF
아름답고 유연한 데이터 파이프라인 구축을 위한 Amazon Managed Workflow for Apache Airflow - 유다니엘 A...
PPTX
MSA를 넘어 Function의 로의 진화::주경호 수석::AWS Summit Seoul 2018
PDF
교육, 연구 개발자가 직접 전하는 AWS를 선택한 이유 Part.3 - 김재동 교사, IndiSchool (NPO) :: AWS Summi...
PDF
AWS 클라우드를 통해 최소기능제품(MVP) 빠르게 개발하기 - 윤석찬, AWS 테크에반젤리스트
PDF
Service Mesh, 좀 더 쉽게 - AWS App Mesh :: 안주은 - AWS Community Day 2019
PDF
Lambda@Edge를통한멀티리전기반글로벌트래픽길들이기::이상현::AWS Summit Seoul 2018
PDF
AWS Cloud Development Kit (CDK)를 이용한 코드 기반 인프라 개발 및 배포 - 공찬호(리얼리티매직) :: AWS C...
PDF
프론트엔드 개발자를 위한 서버리스 - 윤석찬 (AWS 테크에반젤리스트)
PDF
AWSKRUG 콘퍼런스 - re:Invent 신규 서비스 (박상욱) - 보안, 인프라 관련 서비스 소개
PDF
AWS Builders Online Series | 컨테이너, AWS에서 날개를 달다 - 유재석, AWS 솔루션즈 아키텍트
PPTX
[AWSKRUG 아키텍처 모임] 세일즈부스트 인프라스트럭처 사례 공유
PDF
AWS re:Invent re:Cap - 자동화된 반응형 코드 구동: Amazon Lambda - 정윤진
PDF
백오피스 워크로드 클라우드 이전하기 - 박동국 매니저, AWS / 유승국 차장, 하림그룹 :: AWS Summit Seoul 2019
PDF
AWS의 블록체인 서비스 활용 방법 - 박혜영 솔루션즈 아키텍트, AWS / 박선준 솔루션즈 아키텍트, AWS :: AWS Summit S...
PDF
Amazon AI/ML Overview
PDF
Telus의 AWS활용 사례: AWS 서버리스 기반 3GPP 코어 및 BSS 구축 – 조경준 AWS 솔루션즈 아키텍트:: AWS Cloud...
PDF
Amazon Polly와 Cloud9을 활용한 서버리스 웹 애플리케이션 및 CI/CD 배포 프로세스 구축 (김현수, AWS 솔루션즈 아키텍...
컴퓨팅 서비스 업데이트 - EC2, ECS, Lambda (김상필) :: re:Invent re:Cap Webinar 2015
Firecracker, 서버리스 컴퓨팅을 위한 오픈소스 microVM 기술
Firecracker, 서버리스 컴퓨팅을 위한 오픈소스 microVM 기술 :: 류한진 - AWS ...
아름답고 유연한 데이터 파이프라인 구축을 위한 Amazon Managed Workflow for Apache Airflow - 유다니엘 A...
MSA를 넘어 Function의 로의 진화::주경호 수석::AWS Summit Seoul 2018
교육, 연구 개발자가 직접 전하는 AWS를 선택한 이유 Part.3 - 김재동 교사, IndiSchool (NPO) :: AWS Summi...
AWS 클라우드를 통해 최소기능제품(MVP) 빠르게 개발하기 - 윤석찬, AWS 테크에반젤리스트
Service Mesh, 좀 더 쉽게 - AWS App Mesh :: 안주은 - AWS Community Day 2019
Lambda@Edge를통한멀티리전기반글로벌트래픽길들이기::이상현::AWS Summit Seoul 2018
AWS Cloud Development Kit (CDK)를 이용한 코드 기반 인프라 개발 및 배포 - 공찬호(리얼리티매직) :: AWS C...
프론트엔드 개발자를 위한 서버리스 - 윤석찬 (AWS 테크에반젤리스트)
AWSKRUG 콘퍼런스 - re:Invent 신규 서비스 (박상욱) - 보안, 인프라 관련 서비스 소개
AWS Builders Online Series | 컨테이너, AWS에서 날개를 달다 - 유재석, AWS 솔루션즈 아키텍트
[AWSKRUG 아키텍처 모임] 세일즈부스트 인프라스트럭처 사례 공유
AWS re:Invent re:Cap - 자동화된 반응형 코드 구동: Amazon Lambda - 정윤진
백오피스 워크로드 클라우드 이전하기 - 박동국 매니저, AWS / 유승국 차장, 하림그룹 :: AWS Summit Seoul 2019
AWS의 블록체인 서비스 활용 방법 - 박혜영 솔루션즈 아키텍트, AWS / 박선준 솔루션즈 아키텍트, AWS :: AWS Summit S...
Amazon AI/ML Overview
Telus의 AWS활용 사례: AWS 서버리스 기반 3GPP 코어 및 BSS 구축 – 조경준 AWS 솔루션즈 아키텍트:: AWS Cloud...
Amazon Polly와 Cloud9을 활용한 서버리스 웹 애플리케이션 및 CI/CD 배포 프로세스 구축 (김현수, AWS 솔루션즈 아키텍...
Ad

More from Amazon Web Services Korea (20)

PDF
[D3T1S01] Gen AI를 위한 Amazon Aurora 활용 사례 방법
PDF
[D3T1S06] Neptune Analytics with Vector Similarity Search
PDF
[D3T1S03] Amazon DynamoDB design puzzlers
PDF
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
PDF
[D3T1S07] AWS S3 - 클라우드 환경에서 데이터베이스 보호하기
PDF
[D3T1S05] Aurora 혼합 구성 아키텍처를 사용하여 예상치 못한 트래픽 급증 대응하기
PDF
[D3T1S02] Aurora Limitless Database Introduction
PDF
[D3T2S01] Amazon Aurora MySQL 메이저 버전 업그레이드 및 Amazon B/G Deployments 실습
PDF
[D3T2S03] Data&AI Roadshow 2024 - Amazon DocumentDB 실습
PDF
AWS Modern Infra with Storage Roadshow 2023 - Day 2
PDF
AWS Modern Infra with Storage Roadshow 2023 - Day 1
PDF
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
PDF
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
PDF
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
PDF
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
PDF
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
PDF
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
PDF
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
PDF
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
PDF
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...
[D3T1S01] Gen AI를 위한 Amazon Aurora 활용 사례 방법
[D3T1S06] Neptune Analytics with Vector Similarity Search
[D3T1S03] Amazon DynamoDB design puzzlers
[D3T1S04] Aurora PostgreSQL performance monitoring and troubleshooting by use...
[D3T1S07] AWS S3 - 클라우드 환경에서 데이터베이스 보호하기
[D3T1S05] Aurora 혼합 구성 아키텍처를 사용하여 예상치 못한 트래픽 급증 대응하기
[D3T1S02] Aurora Limitless Database Introduction
[D3T2S01] Amazon Aurora MySQL 메이저 버전 업그레이드 및 Amazon B/G Deployments 실습
[D3T2S03] Data&AI Roadshow 2024 - Amazon DocumentDB 실습
AWS Modern Infra with Storage Roadshow 2023 - Day 2
AWS Modern Infra with Storage Roadshow 2023 - Day 1
사례로 알아보는 Database Migration Service : 데이터베이스 및 데이터 이관, 통합, 분리, 분석의 도구 - 발표자: ...
Amazon DocumentDB - Architecture 및 Best Practice (Level 200) - 발표자: 장동훈, Sr. ...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Internal Architecture of Amazon Aurora (Level 400) - 발표자: 정달영, APAC RDS Speci...
[Keynote] 슬기로운 AWS 데이터베이스 선택하기 - 발표자: 강민석, Korea Database SA Manager, WWSO, A...
Demystify Streaming on AWS - 발표자: 이종혁, Sr Analytics Specialist, WWSO, AWS :::...
Amazon EMR - Enhancements on Cost/Performance, Serverless - 발표자: 김기영, Sr Anal...
Amazon OpenSearch - Use Cases, Security/Observability, Serverless and Enhance...
Enabling Agility with Data Governance - 발표자: 김성연, Analytics Specialist, WWSO,...

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
cuic standard and advanced reporting.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Electronic commerce courselecture one. Pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
“AI and Expert System Decision Support & Business Intelligence Systems”
Chapter 3 Spatial Domain Image Processing.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
cuic standard and advanced reporting.pdf
Spectral efficient network and resource selection model in 5G networks
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The AUB Centre for AI in Media Proposal.docx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
20250228 LYD VKU AI Blended-Learning.pptx
sap open course for s4hana steps from ECC to s4
Electronic commerce courselecture one. Pdf
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Advanced methodologies resolving dimensionality complications for autism neur...

AWS Lambda 내부 동작 방식 및 활용 방법 자세히 살펴 보기 - 김일호 솔루션즈 아키텍트 매니저, AWS :: AWS Summit Seoul 2019

  • 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Lambda 내부 동작 방식 및 활용 방법 자세히 살펴 보기 김일호 솔루션즈 아키텍트 매니저, AWS
  • 2. 발표자료 바로 공개 발표자료는 발표 종료 후 해당 사이트에서 바로 보실 수 있습니다 © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Lambda 주요 장점 • 주요 제품 기능 • 사용자 지정 로직으로 다른 AWS 서비스 확장 • 사용자 지정 백엔드 서비스 구축 • 기존 보유 코드 사용 • 완전히 자동화된 관리 • 내장된 내결함성 • 자동 규모 조정 • Amazon CloudFront 요청에 대한 응답으로 코드 실행 • 여러 함수 오케스트레이션 • 통합된 보안 모델 • 사용량에 따라 지불 • 유연한 리소스 모델
  • 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 여러분, AWS Lambda 를 직접 만들어 본다고 가정해 봅시다. 고민거리 Load Balancing | Auto Scaling | Handling Failures | Security Isolation | Managing Utilization
  • 6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 7. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Front End Invoke 동기, 비동기 호출을 모두 관장
  • 8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Counting Service 사용자가 얼마나 많은 API 요청을 하는지 모니터링하고 제한기능 제공
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Worker Manager 실제 Container의 상태를 관리하고 API 요청을 가용 가능한 Container 로 중계
  • 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Worker 고객 함수(코드)가 안전하게 실행되는 실제 Container 환경
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Placement Service Worker에 Sandbox 구성을 자원 활용률이 높고, 고객 서비스 영향이 없도록 관리
  • 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 가용 영역으로 트래픽 분산 (Routing) 기능
  • 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Lambda customer (Existing Worker, New Sandbox) Availability zone 2 Availability zone 1 Invoke Front End Invoke Front End Worker Mgr Worker Mgr Reserve Sandbox Invoke Worker Worker Worker Init
  • 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Lambda customer (Existing Worker, Existing Sandbox) Availability zone 2 Availability zone 1 Invoke Front End Invoke Front End Worker Mgr Worker Mgr Reserve Sandbox Invoke Worker Worker Worker
  • 15. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 컴퓨팅 자원의 효율적으로 자동화된 확장 또는 축소
  • 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Lambda customer (New Function or Scaling Up) Availability zone 2 Availability zone 1 Invoke Front End Invoke Front End Worker Mgr Worker Mgr Reserve Sandbox Invoke Init Placement Claim Worker Worker Worker Worker
  • 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Availability zone 2Availability zone 1 Placement Claim Worker Worker Worker Worker Worker Worker Placement Claim Worker Worker Worker Worker Worker Worker
  • 18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Availability zone 2Availability zone 1 Placement Return Worker Worker Worker Worker Worker Worker Placement Return Worker Worker Worker Worker Worker Worker
  • 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Cloud Region Lambda customer Availability zone 2 Availability zone 1 Front End Front End Worker Mgr Worker Mgr Placement Return Worker Worker Worker Worker
  • 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 호스트뿐만이 아니라 가용역역 수준의 가용성 확보
  • 21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. With Lambda:
  • 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. With Lambda: 항상 가용한 호스트 사용
  • 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Instance Instance Instance InstanceInstance Instance AWS Cloud Region Availability zone 2Availability zone 1
  • 24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Instance Instance Instance InstanceInstance Instance AWS Cloud Region Availability zone 2Availability zone 1
  • 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code
  • 32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 33. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Sandbox Lambda Runtime Your Code One Function Many Accounts
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Virtual Devices Device Emulation Physical Devices
  • 35. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS virtio drivers virtio host in Firecracker Physical Devices
  • 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hardware Host OS Hypervisor Guest OS Virtual Devices Device Emulation Physical Devices
  • 37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. With Lambda: 정확히 필요할 때 사용한 만큼의 Cost
  • 39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Inside Lambda: 시스템을 최대한 바쁘게 (busy) 돌리기 위한 최적화
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Bad: 60% 60% 60% 60% 60% 60% 60%
  • 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Good: 99% 99% 99% 99% 0% 0% 0% Cache Locality Ability to Autoscale
  • 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Server Bad: 동일 Workload를 한 곳에 다 담기 Workload Workload Workload Workload Workload Workload
  • 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Server Better: 다양한 Workload를 담기 Workload Workload Workload Workload Workload Workload
  • 45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Server Best: 최적화된 Workload 배치 Workload Workload Workload Workload Workload Workload
  • 46. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Worker Lambda Function ENI in your VPC Your VPC Local NAT
  • 47. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Worker Lambda Function ENI in your VPC Your VPC Remote NAT
  • 48. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 49. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 50. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 전형적인 Lambda의 DB 접근 아키텍처 AWS Cloud VPC Availability zone 1 Availability zone 2 Private subnet Private subnet Private subnet Private subnet DB Instance DB instance standby Elastic network interface Elastic network interface Lambda Functions Security group Security group
  • 51. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS Lambda에서 DB 접근 시 유의할 점 • 여러 가용 역역 내 Subnet 에 ENI 사용 • 가용 역영 레벨의 이벤트 또는 IP 소모 문제를 피할 수 있음 • Lambda 는 VPC 내 ENI로 접근 • 따라서 가용 IP 에 따른 확장성의 제약을 고려 해야함 • ENI 신규 구성은 시간이 소모됨 • 기본적으로 VPC의 Lambda는 인터넷 접근이 불가능함 • NAT Gateway (or NAT instance) 를 추가하고 Routing Table 구성으로 사용이 가능함 • Public host name DNS 쿼리를 피할 수록 좋음 • 비용과 시간 소모
  • 52. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 고려사항: DB 컨넥션 관리 … Lambda는 쉽게 확장 가능함, 그렇다면 DB 접근은? Connection pooling을 쓰면 될까? 일반 Database
  • 53. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 54. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Time Container A Container B Container C Container D Lambda 의 시간에 따른 사용/확장 개요
  • 55. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 그렇다면 Connection pooling관의 관계는?
  • 56. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Connection Pooling 과 Lambda 설정 Container 당 하나의 connection 만 사용 Connection Pool Size = 1 로 설정 또는 Handler 밖에 Global section에 DB connect 객체를 생성 재활용
  • 57. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. DB connection 선언
  • 58. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Connection Pooling 과 Lambda - 고려사항 • Lambda container가 사라지는 지 인지할 수 없음 • Connection 를 명시적으로 닫을 수 없음 • Connection 삭제는 Database TTL에 의지 • Lambda container 의 생성 삭제를 조정할 수 없음 • Idle connection이 많이 생성될 수 있음 • 여러 Lambda 함수 실행은 여러 다른 Container에서 실행 될 수 있음 • Connection 재사용을 보장할 수 없음
  • 59. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 60. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 61. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 방법 1a: 계정 Concurrency 제한 AWS Account Lambda can help with retries of throttled invocations* * - Only for asynchronous and stream based event sources.
  • 62. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 방법 1b: 함수 Concurrency 제한 Lambda can help with retries of throttled invocations* * - Only for asynchronous and stream based event sources.
  • 63. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Concurrency 제한의 장점 • Lambda의 동시 실행은 account와 function 레벨 모두 제한이 가능 • 방법 • AWS support로 Account 제한은 요청 • AWS Lambda 는 호출 제한이 있을 경우 retry 수행/관리
  • 64. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Concurrency 제한 - 고려사항 • Account Level 제한: • Account 내 모든 Lambda에 적용되어 DB 접근 함수 제한이 간 단하지는 않다 • 여러 팀이 단일 Account 사용 시 관리 • Function Level 제한: • 어떤 Lambda 함수가 DB 접근이 필요한지 확인 • Peak 발생 하기 전에 알고 Application 레벨의 이해 필요 • Lambda 워크로드가 다양할 경우, 다이나믹한 connection 할당이 어려움
  • 65. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 66. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 동적 Connection 관리 아키텍처 Helper Maintain atomic counter and max count Open / close connections DB operations Do something interesting Generic database Alarm
  • 67. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 동적 관리의 장점 • 확장 가능한 구조를 구현 • Connection 수를 관리 가능, Lambda 함수 개수와 무관 • Lambda 함수 실행 시 DB connection 배분이 가능하고 병목되는 곳을 막을 수 있음 • DynamoDB 를 이용하여 Connection 수를 정확히 관리 • CloudWatch metrics를 활용하여 문제가 에러 발생 시 메시지를 받아 다른 처리 구현이 가능
  • 68. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 동적 Connection 관리 - 고려사항 • 관리할 리소스 증가 • Connection 재사용 불가 • 약간의 Latency 증가
  • 69. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 70. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 트레이싱이 필요한 두 가지 이유 1. 서버리스 아키텍처/어플리케이션 개발 시 Debug 편의성 2. 서버리스 아키텍처/어플리케이션 동작 시 성능 문제 해결의 편의성
  • 71. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. CloudWatch 를 통한 Metrics 모니터링
  • 72. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. CloudWatch log를 통한 log 분석
  • 73. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Log와 Metric로 부족한 두 가지 경우 1. 전체 요청 처리 시 서버리스 함수간의 관계 파악 확인 2. 요청 처리 시 다른 리소스 접근에 대한 관계 파악 확인
  • 74. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS X-ray
  • 75. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda 함수 간 성능/문제 점검을 위한 정보 제공
  • 76. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 77. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 개발 시 지정된 환경 구성 및 공유 Library 활용
  • 78. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. 커스텀 런타임 만드는 순서 1. Create a Function 2. Create a Layer 3. Update the Function 4. Update the Runtime 5. Share the Layer 6. Clean Up
  • 79. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda 함수에서 DocumentDB를 접근한다면?
  • 80. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda 함수에서 DocumentDB를 접근한다면?
  • 81. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. MongoDB 용 Lambda Layer 생성 $ cp /usr/bin/mongo ./bin file. $ zip -j ./archives/mongo.zip ./bin/mongo $ aws --region us-east-1 lambda publish-layer-version --layer-name mongo --zip-file fileb://archives/mongo.zip
  • 82. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Golang Lambda Layer 생성 $ go build `-o bin/getkey `src/getkey.go $ zip -j ./archives/getkey.zip ./bin/getkey $ aws --region us-east-1 lambda publish-layer-version --layer- name get_secret --zip-file fileb://archives/getkey.zip
  • 83. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Runtime layer 생성 $ zip -j ./archives/runtime.zip ./src/bootstrap $ aws --region us-east-1 lambda publish-layer-version --layer-name runtime --zip-file fileb://archives/runtime.zip
  • 84. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda 함수 생성 예제 $ aws --region us-east-1 lambda create-function --function-name bash-runtime --zip-file fileb://archives/function.zip --handler function.handler --runtime provided --layers arn:aws:lambda:us-east-1:{AccountID}:layer:mongo:1 arn:aws:lambda:us-east-1:{AccountID}:layer:get_secret:1 arn:aws:lambda:us-east-1:{AccountID}:layer:runtime:1 --role arn:aws:iam::{AccountID}:role/lambda-role --vpc-config SubnetIds={subnet-xxxxxx},SecurityGroupIds={sg-xxxxxx} --kms-key-arn arn:aws:kms:us-east-1:{AccountID}:key/{KMSKeyID} --timeout 180
  • 85. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda 함수 실행 $ aws lambda invoke --function-name $lambda_name --payload "{'command’:’Shell.method()'}" ./output/response.txt
  • 86. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 87. 여러분의 피드백을 기다립니다! #AWSSummit 해시태그로 소셜미디어에 여러분의 행사소감을 올려주세요. AWS Summit Seoul 2019 모바일 앱과 QR코드를 통해 강연평가 및 설문조사에 참여하시고 재미있는 기념품을 받아가세요. 내년 Summit을 만들 여러분의 소중한 의견 부탁 드립니다. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 88. 감사합니다! © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.