© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
이상오, 솔루션아키텍트
ROUTE53 및 CLOUDFRONT를
이용한 CDN 활용기
GS네오텍
본 강연에서 다룰 내용
 CDN관련된 AWS서비스의 개요
 CDN을 활용하여 성능/보안/비용측면 개선해보기
 Lambda@Edge를 활용한 기능 구현해보기
- 원본 스토리지 이전 문제
- 전처리 광고 구현해 보기
- Adaptive Contents Delivery 구현해보기
 기타 CloudFront사용 TIP
(ROUTE53, CLOUDFRONT, SHIELD, WAF, Lambda@Edge)
What is CDN….
IT 서비스 = Computing Delivery+
서비스관점 : CDN
Contents Delivery Network (CDN)
어떻게 하면 사용자에게 가장 효율적이고, 빠르게 서비스 할것인가?
100ms
10ms CDN
(CloudFront)
 캐시기반의 데이터 저장
 Network 경로 최적화
지리적으로 가장 가까운 서버로부터 컨텐츠를 전송받음.
AWS CDN 관련 서비스의 개요
Amazon
Route 53
Amazon
CloudFront
CloudFront
정적/동적 컨텐츠 가속 서비스
HTTP/HTTPS 서비스, Custom SSL 지원
커스텀 오류 응답
쿠키/헤더 오리진 서버 전달
다양한 통계 보고서
컨텐츠 보안 : Signed URL, Signed Cookie
API 호출 감사 : CloudTrail 연계
업로드 가속
AMAZON CLOUDFRONT
CLOUDFRONT는 모든형식의 컨텐츠를 전송
Dynamic
Static
Video
User
Input
SSL
Ashburn, VA (3)
Atlanta, GA (3)
Chicago, IL
Dallas/Fort Worth, TX (2)
Hayward, CA
Jacksonville, FL
Los Angeles, CA (2)
Miami, FL
Minneapolis, MN
Montreal, QC
Newark, NJ
New York, NY (3)
Palo Alto, CA
Philadelphia, PA
San Jose, CA
Seattle, WA
South Bend, IN
St. Louis, MO
Toronto, ON
North America
Cities: 19
PoPs: 27
South America
Cities: 2
PoPs: 3
Rio de Janeiro, Brazil (2)
São Paulo, Brazil
Europe / Middle East / Africa
Cities: 15
PoPs: 24
Amsterdam, The Netherlands (2)
Berlin, Germany
Dublin, Ireland
Frankfurt, Germany (5)
London, England (4)
Madrid, Spain
Marseille, France
Milan, Italy
Munich, Germany
Paris, France (2)
Prague, Czech Republic
Stockholm, Sweden
Vienna, Austria
Warsaw, Poland
Zurich, Switzerland
Asia Pacific
Cities: 12
PoPs: 20
Chennai, India
Hong Kong, China (3)
Manila, the Philippines
Melbourne, Australia
Mumbai, India (2)
New Delhi, India
Osaka, Japan
Seoul, Korea (3)
Singapore (2)
Sydney, Australia
Taipei, Taiwan
Tokyo, Japan (3)
CloudFront Regional Edge Caches
Regional Edge Caches: 9
Oregon, N. Virginia, Frankfurt, Sao Paulo,
Mumbai, Singapore, Seoul, Tokyo, Sydney
Edge
location
AWS Region /
Regional Edge
Cache
Regional Edge
Cache
74 CloudFront Edge Locations (PoPs), 9 Regional Edge Caches (PoPs), 48 Cities, 5 Continents
Amazon
Route 53
AMAZON ROUTE53
Global Server Load Balancer(GSLB)
서버와 네트워크 장비들의 상태 및 성능 정보를
체크하며 동적으로 사용자에게 노출될 DNS 레
코드 타입과 값을 조정합니다.
글로벌 DNS
가용성과 확장성이 우수한 클라우드 DNS(도메
인 이름 시스템) 서비스입니다.
Route 53
GSLB
ROUTE53 : WEIGHTED
SYSTEMS SYSTEMS
80% 20%
ROUTE53 : LATENCY
SYSTEMS SYSTEMS
60ms 10ms
ROUTE53 : FAILOVER
SYSTEMS SYSTEMS
Health Check : OK Health Check : Fail
ROUTE53 : GEOLOCATION
SYSTEMS SYSTEMS
KOREA US
성능 개선해보기
80%
20%
일반적인 웹트래픽 비율
Static Contents Dynamic Contents
Classic ELB
(LoadBlancer)
EC2
S3
www.example.com
Dynamic Contents
Static Contents
DataBase
Classic ELB
(LoadBlancer)
EC2
S3
www.example.com
Dynamic Contents
Static Contents
DataBase
CDN
(CloudFront)
CDN
(CloudFront)
/*.* (DEFAULT)
/images/*
/*.css
ORIGIN A: web
ORIGIN B : Images
GET http://www.example.com/do?login to ORIGIN A
GET http://www.example.com/images/logo.jpg to ORIGIN B
GET http://www.example.com/css/main.css to ORIGIN C
ORIGIN C : CSS
Path Pattern Matching
CLOUDFRONT BEHAVIOR
STATIC CONTENTS 성능개선
100ms
10ms CDN
(CloudFront)
STATIC CONTENTS LATENCY 성능 개선
Gzip 압축 기능을 통한 페이지 로딩속도 개선
362KB 81ms
51.3KB 27ms
DYNAMIC CONTENTS 성능개선
Classic ELB
(LoadBlancer)
EC2
Dynamic Contents
DataBase
2번째 사용자
400ms
400ms
100ms
DYNAMIC CONTENTS 성능개선
2번째 사용자
400ms
130ms
Keep Alive
Connections
90ms10ms
Classic ELB
(LoadBlancer)
EC2
Dynamic Contents
DYNAMIC CONTENTS 성능개선
SSL 성능개선
WEB
SERVER
WEB
SERVER
Enable SSL
SSL사용으로 인한 인프라 성능 저하
CPU Load 증가
+ 가용량 60% 감소
(세션기준)
WEB
WEB
WEB
WEB
Classic ELB
(LoadBlancer)
WEB
WEB
WEB
WEB
SSL사용으로 인해 더 많은 인프라 필요
Classic ELB
(LoadBlancer)
SSL 성능개선
WEB
WEB
WEBAmazon
CloudFront
HTTP/HTTPS
비용 동일
ROUTE53을 활용하여 중국향 성능개선
ROUTE53 : GEOLOCATION
GLOBAL CHINA
Amazon
CloudFront
Local(China)
CDN
ROUTE53 : SETTING
GLOBAL(CHINA) SPEED UP
Global ABC사 CF + Local CDN
보안성 강화해보기
CLOUDFRONT를 사용하는 것만으로 보안 강화
Amazon
Sheild
Amazon
WAF
Layer 3/4 보호
 자동 탐지 및 대응
 일반적인 공격유형방어
(SYN/UDP Floods, Reflection Attacks등)
 AWS 서비스 결합
Layer 7 보호
 Layer7 Application방어
 Custom Rule기반
웹트래픽 필터링
 악의적인 요청 차단
ORIGIN SYSTEM 보안 강화
ORIGIN 보호
Classic ELB
(LoadBlancer)
EC2
S3
www.example.com
Dynamic Contents
Static Contents
DataBase
CDN
(CloudFront)
Access Control to Origin
Amazon S3 Custom Origin
Origin Access Identify(OAI) Block by IP address
 Prevents direct access to your
Amazon S3 bucket
 Ensure performance benefits to all customers
 Whitelist only the Amazon CloudFront IP Range
 Protects origin from overload
 Ensure performance benefits to all customers
Auto updated CF IP Range
CDN
(CloudFront)
Amazon
SNS
AWS
Lambda
security group
Update
IP Range
SNS
Message
Updating
IP Range
Anti-DDos 보안 강화
DDos 공격 유형
대규모 트래픽
기반
상태 소진형
Application
Layer
65%
17%
18%
자원고갈형 공격비율
82%
ORIGIN
SYSTEMS
UDP/SYN
Flooding Attack
HTTP
HTTP
AWS
CloudFront
Layer7 Traffic만이 ORIGIN SYSTEM에 전달
AWS
Shield
GLOBAL Presence and Redundancy
Invalid Protocol
valid Request
Invalid Request
Country A
Country B
Country C
Route A
Route B
Route C
Layer7 보안 강화
WAF(Web Application Firewall)
AWS
WAF
Host: www.example.com
User-Agent: Mozilla/5.0 (Macintosh; …
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referrer: http://www.example.com/
Connection: keep-alive
Check: Header “Referrer”
Match Type: Contains
Match: “example.com”
Action: ALLOW
RAW REQUEST HEADERS Rule : String match condition
Match any part of the web request
WAF(Web Application Firewall)
AWS
WAF
Host: www.example.com
User-Agent: badbot
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referrer: http://www.example.com/
Connection: keep-alive
Check: Header “Referrer”
Match Type: Contains
Match: “example.com”
Action: BLOCK
RAW REQUEST HEADERS Rule : String match condition
Use transforms to stop evasion
추가적인 보안 강화 기능
Security Enhancements
 Signed URL
 Signed Cookies
 Enforce HTTPS to origin
 Support iOS ATS
 Support for TLSv1 .1 and TLSv1.2 between edge and origin
 Add/Modify Request Headers Forwarded From CloudFront to Origin
 Integration with AWS Certificate Manager (SNI Certs from Amazon)
 Integration with AWS WAF (web application firewall)
 Geographic Restriction
 IPv6 Support
비용 절약해보기
WEB
WEB
WEB
WEB (n)EC2 비용
+ DataOut 비용
Classic ELB
(LoadBlancer)
WEB
Reduce Computing Cost
Classic ELB
(LoadBlancer)
WEB
WEB
(n)EC2 비용
+ CF Dataout비용
Reduce Computing Cost
CloudFront
Reduce Traffic Cost
ORIGIN
SYSTEMS
CloudFront
$$$
$$$
$ Free
Managed CloudFront Service
Based
3rd Party Solution
WiseN Monitoring System
AWS Cloud Watch
24x7x365
Monitoring System 전문화된 NOC 운영
(Network Operation Center)
Price
Discount
Program
Managed
CloudFront
Program
전용 CLOUDFRONT 통계 제공
Traffic BandWidth 통계
REFERENCE
게임 미디어 / 엔터인먼트
쇼핑몰 공공 / 엔터프라이즈
Lambda@Edge 활용해보기
Triggers for Lambda@Edge Functions
Viewer Request
Viewer Response
Origin Request
Origin Response
Amazon
CloudFront
Origin
(S3)
Lambda@Edge Limits
Max memory setting 128 MB
Maximum duration 50 ms
Size of code/dependencies that you can zip into a
deployment package (uncompressed zip/jar size)
1 MB
Maximum Global TPS 100
STORAGE MIGRATION
Amazon S3CUSTOM STORAGE
What the hell happened????
Amazon S3MS Windows Server
IIS
대소문자 구분 (X) 대소문자 구분 (O)
Service Flow
Amazon
S3
/20170412/Logo.jpg
HTTP STATUS :
404(File Not Found)
HTTP STATUS :
404(File Not Found)
Amazon
CloudFront
http://~/20170412/LoGo.jpg http://~/20170412/LoGo.jpg
Service Flow
Amazon
S3
/20170412/logo.jpg
HTTP STATUS :
200(OK)
HTTP STATUS :
200(OK)
Amazon
CloudFront
http://~/20170412/LoGo.jpg http://~/20170412/logo.jpg
Lambda@edge Source Code
CloudFront
+Lambda@edge
Dynamic Quality Delivery
Dynamic Quality Delivery
Amazon
S3
Amazon
CloudFront
Request Headers and Hint
URL
Adaptive Request Headers
Adaptive URL
Best-Fit ContentsCached Contents
Lambda@edge Source Code
CloudFront
+Lambda@edge
PRE-ADVERTISING CONTENTS
Service Flow
Pre-processing Ad Main Video
http://video.example.com/ad/main.mp41
2 3
AD Contents
Amazon
S3
/20170412/logo.jpg
Amazon
CloudFront
http://video.example.com/ad/
main.mp4
 /ad/ad.mp4
 /ad/main.mp4
Lambda@edge Source Code
CloudFront
+Lambda@edge
DEMO
http://demo.wisen.co.kr
기타 활용 TIP
HLS Streaming
HLS 스트리밍을 구성하였지만, 비주기적으로 화면이 멈추거나, 프레임 점프 현상이 발생합니다.
설명
ORIGIN 응답시간 제어
사용자가 월간 CSV 다운로드 요청을 하였을경우, 원본에서 해당 CSV를 생성해서 응답을 합니다.
그런데 이때 생성대상 데이터가 많아 생성하는데 약 1분의시간이 필요하다.
설명
CloudFront Edge Cache Control
CloudFront에서는 지정한 시간만큼 캐싱을 하고, 실제 사용자브라우저에는 캐싱을 하지 않도록
구성하고 싶습니다.
설명
cache-control : max-age=0, s-maxage=3600
RTMP Streaming Service
Amazon
S3
Amazon
CloudFront
rtmp://video.example.com/wisen.mp4
반드시
S3사용
HTTP기반의 스트리밍 서비스가 아닌, Flash Player기반의 RTMP 스트리밍 서비스를 하고 싶습니다.
설명
Fast Invalidations
기존 : 10분 - 15분
현재 : Edge의 90% 5초, 10%는 최대 1분내
본 강연이 끝난 후…
 blog.wisen.co.kr
 www.studyforcloud.com
을 통해 Lambda@edge Source code를 다운로드 받으실수
있습니다.
16:20 – 17:00 Track3_그랜드볼룸 103
AWS 엣지 서비스를 통한 글로벌 서비스 관리 전략
함께 해주셔서 감사합니다!
sangohlee@gmail.com
https://www.awssummit.kr
AWS Summit 모바일 앱을 통해 지금 세션 평가에
참여하시면, 행사 후 기념품을 드립니다.
#AWSSummitKR 해시태그로 소셜 미디어에
여러분의 행사 소감을 올려주세요.
발표 자료 및 녹화 동영상은 AWS Korea 공식 소셜
채널로 곧 공유될 예정입니다.
여러분의 피드백을 기다립니다!

Route53 및 CloudFront를 이용한 CDN 활용기 - AWS Summit Seoul 2017