이창수 솔루션즈아키텍트
Amazon Web Services
Jun 2018
AWS 아키텍쳐 구축하기천만사용자를위한 AWS 클라우드아키텍쳐진화하기
AWSX인천창조경제혁신센터
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
본 강연에서 다룰 내용
몇가지 기본 지식
사용자 증가에 따른 클라우드 아키텍쳐 진화하기- 수직적 스케일 업을 통한 확장
- 멀티 AZ 기반 수평적 확장과 부하 이동하기
- 오토 스케일링
- 모니터링과 자동화
- 마이크로 서비스
10가지 체크 포인트
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
몇가지 기본 지식
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Paris
첫 5년: 4 리전
다음 5년: 7 리전
글로벌 리전확장 현황
18+1 로컬 리전54 가용 영역
2016–2018: 현재 7 리전+1 로컬 리전4 리전 추가 예정
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
서로다른 AWS 리전에있는 VPC 간의사설(Private) 네트워크연결필요고객요청사항
Inter-region Peering
서로 다른 AWS 리전에서 두 개 이상의 VPC를안전하게 연결하여 AWS 백본을 통해
인스턴스 간 통신 가능
Inter-region
Peering
서울리전 Coming Soon
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inter-region VPC Peering
10.1.0.0/16 10.3.0.0/16모든 구간 트래픽은 암호화 되고
아마존 글로벌 네트워크
구간을 이용
Inter-region VPC Peering
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon 엣지 로케이션119 PoPs (108 Edge Locations + 11 Regional Edge Caches)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon 글로벌 네트워크
• 이중화된 100GbE 네트워크
• 리전간 이중화된 전용 네트워크 구간 연결
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
웹어플리케이션에바로접근할경우
사용자의위치에따라많은네트워크경로를경유해야함
어플리케이션도달경로는매번변동가능
Local ISP Network A B C D E F
애플리케이션 접근
좋지 않은 어플리케이션 성능을 보일수 있음
Edge를 활용하면 이러한 비 효율성이 사라짐CF & Route 53을 통해 AWS 네트워크에 빠르게 도달
AWS Shield 와 AWS WAF 를 통해 위협 완화
Edge 서비스를거쳐웹어플리케이션에접근할때
AWS Network
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
광범위하고 폭넓은 AWS 클라우드 서비스
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
광범위하고 폭넓은 클라우드 서비스
비지니스 요구 사항에 맞는130여개 이상의 AWS 서비스 조립을 통해 유연한 활용 가능
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
이제 시작해볼까요?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
첫 사용자
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
첫 사용자 1명
Amazon EC2
Elastic IP
사용자Amazon Route 53
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Elastic Compute Cloud (EC2)
• AWS 클라우드 가상 서버
• 다양한 운영 체제 지원
• 손쉽게 생성, 시작, 중단, 종료
• 손쉽게 수백대, 수천대로 확장 가능
• 원하는 대로 사용한 만큼만 과금
• 다양한 비용 모델 제공
• 다양한 컴퓨팅 옵션 선택 가능
인스턴스세대
인스턴스패밀리
인스턴스사이즈
c5.xlarge
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
서버 트래픽↗ “더 높은 성능 인스턴스!”
수직적 스케일 업 (Scale-Up)• 가장 쉬운 접근 방법
• 더 높은 CPU 인스턴스
• 더 높은 메모리 인스턴스
• 더 높은 스토리지 인스턴스
• 더 높은 I/O 인스턴스
• 쉽게 인스턴스 크기 변경
• 결국에는 한계 용량에 도달
vert
ically
1 vCPU 1 GiB 메모리$0.014/시간
t2.micro
m5.xlarge
4 vCPU 16 GiB 메모리$0.236/시간
c5.4xlarge
16 vCPU 32 GiB 메모리$0.768/시간
[서울 리전 기준]
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 1명
• 이중화 없음
• 장애 시 페일 오버 불가
• 한 곳에 모든 것이 존재Elastic IP
AmazonRoute 53
사용자
Amazon EC2
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 1
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 1
EC2 DB 인스턴스
AmazonRoute 53
사용자
EC2 웹인스턴스
Elastic IP
먼저, 기능에 따라 인스턴스의역할을 나눈다!
• 웹 서버용 EC2 인스턴스
• DB용 EC2 인스턴스• 직접 EC2에 DB 운영
• DB 관리형 서비스 사용
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 100
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 100
편리한 DB 운영을 위해Amazon RDS 이용!
DB 백업, 패치 관리 대신코어 서비스 개발에 집중!
AmazonRoute 53
사용자
웹인스턴스
Elastic IP
Amazon RDS
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon RDS
6개 데이터베이스 엔진 기반의 관계형 데이터베이스 관리형 서비스
간편한 관리 뛰어난 확장성 가용성 및 내구성 성능과 낮은 비용
데이터베이스 설치,수동 패치 필요 없음
몇번의 클릭으로손쉽게 컴퓨팅 및스토리지 확장
Multi-AZ 구성 시자동 동기식 복제,
자동화 백업, 페일 오버
고성능 OLTP 최적화된볼륨과 범용 SSD 볼륨
제공
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora
• MySQL, PostgreSQL 호환
• 최대 15개 읽기 복제본
• 최대 64TB 자동 스토리지 확장
• Amazon S3 지속 증분 백업
• 3곳 가용 영역에 6벌 복제
Master Replica
AZ1
SHARED STORAGE VOLUME
AZ2 AZ3
수백 개 이상 SSD 스토리지 노드로 스트라이핑
SQL
트랜잭션
CACHING
SQL
트랜잭션
CACHING
SQL
트랜잭션
CACHING
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 1,000
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
수평적
수직
적
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 웹인스턴스
RDS DB 인스턴스Active (Multi-AZ)
가용 영역 #1 가용 영역 #2
EC2 웹인스턴스
RDS DB 인스턴스Standby (Multi-AZ)
Elastic Load
Balancing
사용자AmazonRoute 53
사용자 > 1,000
Elastic Load Balancing 확장성 높은 부하 분산 서비스
Multi-AZ 서버 구성가용 영역을 통한 고가용성 확보
데이터베이스 이중화RDS의 Active-Standby 복제본Multi-AZ로 구성
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Classic load balancer
• 고가용성• 헬스 체크• 세션 유지(stickiness)• SSL 오프로드• 모니터링, 로깅
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Application Load Balancer
• 고가용성• 헬스 체크• 세션 유지(stickiness)• SSL 오프로드• 모니터링, 로깅• HTTP/HTTPS 트래픽 최적화• 컨텐츠/컨테이너 기반 라우팅• 웹 소켓
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Network Load Balancer
• 계층 4 TCP 트래픽 처리 최적화• 초당 수백만의 높은 요청 처리량• 매우 짧은 지연 시간• 고정, 탄력적 IP 지원• 향상된 로깅과 모니터링• IP주소를 대상으로 로드 밸런싱
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 10,000+
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 : 10,000 - 100,000
ELB
사용자
Amazon Route 53
RDS DB 읽기전용 복제본
가용 영역 #1 가용 영역 #2
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
RDS DB 인스턴스Active (Multi-AZ)
RDS DB 인스턴스Standby (Multi-AZ)
RDS DB 읽기전용 복제본
RDS DB 읽기전용 복제본
RDS DB 읽기전용 복제본
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora 읽기 복제본 오토스케일링
마스터 읽기 복제본
SHARED DISTRIBUTED STORAGE VOLUME
읽기 END-POINT
읽기 복제본 읽기 복제본
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
부하를 이동하기
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
EC2 웹인스턴스
RDS DB 인스턴스Active (Multi-AZ)
가용 영역
ELB
정적, 동적 콘텐츠를Amazon S3로 이전!
• 정적 파일 (CSS/JS 파일,이미지 및 비디오 등)
• 백업 및 애플리케이션로그
사용자AmazonRoute 53
Amazon CloudFront
Amazon S3
주위로 부하 이동하기
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Simple Storage Service (S3)
• 오브젝트 기반 스토리지
• 높은 내구성
• 정적 자산에 최적
• “무한 확장성”
• 유휴 및 전송 중 데이터 암호화
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon CloudFront
• Edge에 캐시된 콘텐츠로 빠른 전달
• 오리진에 낮은 부하
• AWS 무상 오리진 패치 및 AWS 최적화
• 정적 및 동적 콘텐츠 지원
• 낮은 TTL (0초까지 지원)
• 비디오 스트리밍
• ACM를 통해 손쉽게 SSL 인증서 배포
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
주위로 부하 이동하기
Amazon DynomoDB와ElastiCache 활용• 자주 사용되는 세션/상태 정보
DynamoDB, ElastiCache에 저장
• Amazon ElastiCache(Memcached, Redis)를 이용한DB 캐싱
EC2 웹인스턴스
RDS DB 인스턴스Active (Multi-AZ)
가용 영역
ELB
사용자AmazonRoute 53
Amazon CloudFront
Amazon S3
DynamoDB
ElastiCache
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DynamoDB
• 손 쉬운 관리형 NoSQL 서비스
• 읽기 및 쓰기 용량 제어 가능
• 한자리 밀리초 수준의 일관된 응답시간
• JSON 지원
• TTL과 스트림
• 전역 테이블
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ElastiCache
• 인메모리 관리형 캐시 서비스
• 관리형 Memcached 및 Redis 지원
• 자가-치유 기능 (장애 인스턴스 교체)
• 하나에서 다수 노드로 확장
• 한 자리수 밀리초 속도
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
오토 스케일링
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
일요일 월요일 화요일 수요일 목요일 금요일 토요일
Amazon.com 전형적인 주간 트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Provisioned capacity
일요일 월요일 화요일 수요일 목요일 금요일 토요일
Amazon.com 전형적인 주간 트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
11월
Amazon.com 11월 트래픽
Provisioned capacity
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
76%
24%
Provisioned capacity
11월
Amazon.com 11월 트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
11월
Amazon.com 11월 트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
11월
Amazon.com 11월 트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
오토 스케일링컴퓨트 그룹 최소/최대 크기안에서 자동 조정
CloudWatch 메트릭 기반 스케일 인/아웃
온 디맨드와 스팟 인스턴스
대상 추적 조정 정책
단계 추가 조정 정책
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
오토 스케일링 대상 추적
ELB
오토스케일링그룹
트래픽 5
10
15
20
25
30
0%
10%
20%
30%
40%
50%
60%
70%
80%
90%
100%
Inst
ance
s
CPU
Target Utilization CPU Utilization Instances
트래픽
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
오토 스케일링 지원 서비스
클러스터
Fleet
Aurora 읽기 복제본
EMR 인스턴스 그룹
확장 가능한 타겟 확장 가능한 요소
Aurora
서비스 태스크ECS
Spot Fleet 요청 Spot 인스턴스EC2 Spot Fleet
AppStream 2.0
EMR코어 노드태스크 노드
AppStream 인스턴스
테이블, 글로벌 보조인덱스 (GSI)
읽기/쓰기 용량DynamoDB
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 50만+
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 50만+Amazon Route 53사용자
Amazon S3
ELB
DynamoDBRDS DB
인스턴스 읽기전용 복제본
웹인스턴스
웹인스턴스
웹인스턴스
ElastiCache
웹인스턴스
웹인스턴스
웹인스턴스
ElastiCacheRDS DB 인스턴스
Active (Multi-AZ) 가용 영역 #1 가용 영역 #2
Amazon CloudFront
RDS DB 인스턴스 읽기전용 복제본
RDS DB 인스턴스 Standby
(Multi-AZ)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 50만+Amazon Route 53사용자
Amazon S3
ELB
DynamoDBRDS DB
인스턴스 읽기전용 복제본
웹인스턴스
웹인스턴스
웹인스턴스
ElastiCache
웹인스턴스
웹인스턴스
웹인스턴스
ElastiCacheRDS DB 인스턴스
Active (Multi-AZ) 가용 영역 #1 가용 영역 #2
Amazon CloudFront
RDS DB 인스턴스 읽기전용 복제본
RDS DB 인스턴스 Standby
(Multi-AZ)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
모니터링과 자동화
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
모니터링
Build Measure
Learn
• 서비스 별 다양한 모니터링 지표 제공
• 지속적인 모니터링 통해 연속적인 개선
• 고객의 목소리 귀 기울이기
• 각 서비스와 구성 요소 별 성능, 비용 최적화!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
집계 수준 메트릭
로그 분석 3rd 파티 tool
호스트 수준메트릭
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS X-Ray
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
불필요한 시간 소모가 발생하는 곳!
개발과 테스트 팀변경이 우선
보안팀위험 방지가 우선
운영팀안정성이 우선
개발 테스트 보 안 운영
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
효과적인 데브옵스를 위한 AWS 개발 도구
소스 빌드 테스트 프로덕션
Third Party Tooling
AWSCodeCommit
AWSCodeBuild
AWS CodeDeployAWS Elastic Beanstalk AWS CloudFormation
AWSCodePipeline
AWSCodeStar
AWSIAM
AmazonCloudWathch
3rd Party Extensions
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
마이크로 서비스계층을 분해해서 추가로 더
개선할 수 있습니다!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
마이크로 서비스란
서비스들이 네트워크를통해 서로 통신한다.
composed of
that have
Adrian Cockcroft (VP of Cloud Architecture @ AWS, former Cloud Architect at Netflix)
서비스는 독자적으로업데이트하며 서로영향을 주지 않는다 .
“service-oriented architecture
DLoosely coupled elements
Bounded contexts” 다른 서비스의 내부 구조를 알지못해도 서비스를 업데이트할 수있다 .
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
SOA
Presentation Tier Logic Tier
Data Tier
서비스를 단독적인 계층으로 분리하기• 티어별 독립적으로 서비스 처리
• 독립적인 크기 변경 및 업데이트 가능
유연성과 확장성각 구성 요소에 대한 이해
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
서비스 재활용
다시 만들지 말자!
• 모바일 푸시 보내기
• 이메일 보내기
• 큐와 토픽
• 트랜스 코딩
• 검색
• 모니터링 및 로깅
• IoT
Amazon ES Amazon SQSAWS IoT
Amazon Elastic
Transcoder
AWS Step Function
Amazon SES
직접 개발하지 말고 AWS의 다양한 관리형 서비스 활용
Amazon Pinpoint
Amazon SES
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda를 이용한 서버리스 아키텍쳐
• 확장성 높은 완전 관리형 서버리스 서비스• Java, Node.js, Python, C#, Go 런타임 지원• 클라우드 기반 통합 개발 환경 AWS Cloud9 IDE 제공
비동기성 큐 기반동기성 푸쉬 기반 스트림 기반
AmazonAPI Gateway
Amazon SNS
Amazon S3
Amazon DynamoDB
Amazon Kinesis
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Lambda의 다양한 활용
AmazonAPI
Gateway
AmazonAlexa
AWS IoT Amazon
Kinesis
Amazon SNS
AmazonSES
AWS Step Functions 2
호출
1
함수
3
인터랙션
Amazon S3
Amazon DynamoDB
Custom endpoints
Amazon CloudWatch
Amazon Elasticsearch
EC2 instance
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 100만+
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자: 100만+
RDS DB 인스턴스Active (Multi-AZ)
가용 영역
ELB
RDS DB 인스턴스 읽기전용 복제본
RDS DB 인스턴스 읽기전용 복제본
웹인스턴스
웹인스턴스
웹인스턴스
웹인스턴스
DynamoDB
Amazon SQS
ElastiCache
작업자인스턴스
작업자인스턴스
Amazon CloudWatch
사내 앱인스턴스
사내 앱인스턴스
사용자AmazonRoute 53
AmazonCloudFront
Amazon S3
Amazon SES
Lambda
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 1,000만+
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
사용자 > 1000만
데이터베이스 쓰기 부하 병목이 잠재적으로 발생할 수있습니다.
이 문제를 해결할 수 있을까요?• 기능 기반의 데이터베이스 분리하기
• 수평적 확장을 위한 샤딩 : 다중 호스트로 하나의 데이터 집합 분리
• 다른 유형의 데이터베이스 검토
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
데이터베이스 분리하기
• 데이터베이스를 기능 및 목적에 따라 분리
• 거대한 단일 함수 및 테이블, 데이터베이스간 교차 쿼리에 어려움
포럼 DB 사용자 DB 제품 DB
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
수평적 확장 : 샤딩
CBA
사용자 ShardID
002345 A
002346 B
002347 C
002348 B
002349 A
• 함수나 키 영역에 의한 샤딩
• 확장에 실질적인 제한 없음
• 효율적인 구성을 위한 전문성 요구
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
다른 유형의 데이터베이스 검토
강력한 일관성
무결성
트랜잭션
그래프Key / Value 도큐먼트관계형
높은 처리량
빠른 데이터 처리
매우 짧은 지연 시간
속성에 대한 쿼리
인덱싱 및 문서 저장
쉽고 빠르게 데이터
간 관계 생성 및 탐색
SQL 기반 복잡한쿼리
필터 기반 간단한쿼리
필터, 집합, 프로젝션기반 간단한 쿼리
관계를 기준으로쿼리를 쉽게 표현
AmazonDynamoDB
AmazonRDS
AmazonDynamoDB
AmazonNeptune
Non-Relational
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Non-relational 데이터베이스 고객 사례
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
체크 리스트
1. Multi-AZ 아키텍처로 고가용성 확보
2. 자가 확장하는 서비스 사용– ELB, Amazon S3, Amazon SNS, Amazon SQS, Amazon Step function Amazon IoT, Amazon SES 등
3. 모든 계층 이중화
4. 인프라 내/외부 캐시 적극 활용
5. 인프라 및 배포 자동화 도구 사용
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
체크 리스트
6. 좋은 모니터링/측정/로깅 도구 확보
7. 계층을 분해한 느슨한 결합과 마이크로 서비스
8. 오토스케일링 적극 사용
9. 직접 만들지 말고 AWS 관리형 서비스 활용
10. 상황에 맞게 다양한 데이터베이스 검토
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
본 강연이 끝난 후
AWS 시작하기:
aws.amazon.com/ko/getting-started/tutorials/
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
본 강연이 끝난 후
AWS 프리 티어 체험하기:
aws.amazon.com/ko/free/
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
감사합니다
문의사항은아래 contact us를통해남겨주세요
https://aws.amazon.com/ko/contact-us