© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS 실시간 데이터 처리를 위한 현대적
애플리케이션 개발 방법
김영진
솔루션즈 아키텍트
이세현
솔루션즈 아키텍트
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
모던 애플리케이션 개발이란?
Service Open
Customer
Feedback
Code Release
Service Open
빠른 개발 과정을 통한 서비스 오픈
Customer Feedback
고객 피드백 및 비즈니스에 집중
Code Release
개발로직에 피드백 재반영
1
2
3
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
데모 아키텍처 (Demo Architecture)
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
어플리케이션 영역
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
클라우드 앱을 개발하는 가장 빠른 방법
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
AWS Amplify
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Introducing AWS Amplify
클라우드 기반 앱을 개발하는 가장 빠른 방법
프론트 엔드 및 백엔드 전체 앱 구축, 테스트, 배포 및
호스팅을위한 Developer Tools
Amplify Framework, 라이브러리, CLI 툴체인 및
UI 구성 요소를 포함하는
오픈 소스 클라이언트 프레임 워크
CLI 툴체인을 통해 Amazon Cognito,
AWS AppSync 및 Amazon Pinpoint와 같은
Cloud Service 와 쉽게 통합
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
카테고리 기반
클라우드 기능 구현
AWS 서비스를 프로젝트에
신속하게 통합하기 위한
CLI 툴체인
UI 컴포넌트프론트 엔드 개발자에
초점을 맞춘 라이브러리
테스트 및 배포를
위한 DevTools
Mobile development with Amplify
End to end 개발자 경험
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Powerful toolchain built for developers
Configure Backends
$ cd <your-app>
$ amplify init
$ amplify add <category>
$ amplify push
$ amplify add hosting
$ amplify publish
Hosting for Websites Integrate with your app
$ amplify codegen add
$ amplify codegen generate
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Analytics
사용자 세션, 사용자 지정 사용자
특성 및 사용 중인 메트릭 추적
API
실시간 데이터를 지원하는 REST 및
GraphQL을 사용한 HTTP 요청
Authentication
앱용으로 사전 구축 된 UI 구성
요소가있는 인증 API
Storage
공개 또는 개인 사용자 컨텐츠를
안전하게 관리하기 위한 간단한
메커니즘
Interactions
딥러닝 기술을 활용한 대화 상자
PubSub
클라우드의 메시지 지향 미들웨어에
앱 연결
Notifications
캠페인 분석 및 타겟팅을 통한
푸시 알림
XR
앱에서 증강 현실 및 가상 현실
콘텐츠로 작업
Cache
대화 형 봇
Hub
사용자 세션, 맞춤 속성 및 인앱
측정 항목을 추적하는 분석
I18n
가벼운 솔루션
Logger
콘솔 로깅 유틸리티
Service worker
PWA와 함께 작동하는 유틸리티
클래스
Mobile development with AWS Amplify
포괄적인 클라우드 기능셋
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
애플리케이션 데이터 처리를 위한 관리형 GraphQL 서비스
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
AWS AppSync
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
AWS AppSync
관리형 서버리스
GraphQL service
계정의 데이터 소스에
연결
데이터 원본 또는 API에
데이터 동기화, 실시간 및
오프라인 기능 추가
모든 AWS 서비스에 대한
그래프QL 화면
클라우드 내
충돌 감지 및 해결
엔터프라이즈 보안 기능 (IAM,
Amazon Cognito, OIDC, API 키)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
/posts /comments /authors
REST API
posts comments authors
GraphQL API
API architectures
REST and GraphQL
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
How does AWS AppSync work?
,
,
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
• GraphQL 마이크로서비스
• 오프라인 지원이 중요한 현장 서비스 앱
• IoT 대시보드
• Data Lake의 데이터에 액세스하기 위한 통합 API
• 소매 제품 카탈로그, 매장 내 쇼핑 경험
• 쇼핑 카트 체크아웃
• 실시간 환율변동, 주가, 계좌 잔고
• 라이브 방송 내 채팅 및 화면 통신
• 라이브 TV 및 비디오 메타데이터 표시
• 수백만 명의 클라이언트에 대한 높은 처리량 실시간 Fanout
Common Use Cases
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
A query language for APIs…
Queries
query GetPost {
getPost(id: ”1”) {
id
title
}
}
mutation CreatePost {
createPost(title: “Summit”) {
id
title
}
}
subscription OnCreatePost {
onCreatePost {
id
title
}
}
Mutations Subscriptions
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
A lot of Backend Microservices & Real time subscriptions
Queries
Subscriptions
AppSync Data Sources
AWS AppSync
Amazon
DynamoDB
Amazon Elasticsearch
Service
AWS Lambda
Amazon Aurora
HTTP
Local (Pub/Sub)
Mutations
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
간단하고 안전한 사용자 가입, 로그인 및 엑세스 제어
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
AWS Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
기본UI 와 간단한 구성을 통해 쉽게..
Monitoring & Operational Intelligence
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
모바일 애플리케이션 개발 준비
Kinesis
Data Streams
LambdaDocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amplify 라이브러리 적용 위해
#npm install --save aws-amplify aws-amplify-react
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Graphql 쿼리 조회를 위해
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Cognito 모바일 인증인증위해
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
어플케이션 데이터 수신 대기
드론(Drone) 데이터 수집과 활용
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
실시간 데이터 수집
Kinesis
Data Streams
Lambda DocumentDB
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
DocumentDB는 DynamoDB로도 대체 가능
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon Kinesis Data Streams
분산 데이터 스트림의 실시간 처리를 위한 완전 관리형 클라우드 기반 서비스
스트림(Stream)은 ‘고유하게 식별 된 데이터 레코드 그룹’인 여러 Shard로 구성됨.
Kinesis
Data Streams
Shards
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
드론(Drone)을 생산자로 사용
생산자는 데이터를 생성하고 이 데이터를 Amazon Kinesis Streams에 레코드(record)로 입력
Boto는 Python 용 AWS SDK를 제공하는 Python 라이브러리
Boto는 많은 AWS 서비스에 Python API를 제공하여 코딩을 간결하게 함
boto
Kinesis
Data Streams
Shards
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Lambda를 소비자로 사용
소비자는 Amazon Kinesis Streams에서 이러한 데이터 레코드를 가져와 처리
AWS Lambda 함수를 소비자로 사용하여 Amazon Kinesis 데이터 스트림의 레코드를 처리
Lambda는 데이터를 Amazon DocumentDB에 저장
Kinesis
Data Streams
Shards
Lambda
Amazon
DocumentDB
boto
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
실시간 데이터 저장을 위한 Amazon DocumentDB 활용
Kinesis
Data Streams
Lambda DocumentDB
DocumentDB는 DynamoDB로도 대체 가능
AWS
Lambda
AWS
AppSync
AWS
Amplify
Amazon
Cognito
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Document database 란
• Document Model : 데이터 객체들이 Collection 내부에서 독립된 Document로 저장
• Document Model을 기반으로 하는 NoSQL 데이터베이스
RDBMS DocumentDB DynamoDB
table collection table
row document item
column field attribute
index index GSI, LSI
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Document database 특징
• JSON과 유사한 document에 데이터를 저장
• Document는 인간이 데이터를 모델링하는 방식에 자연스럽게 mapping됨
• 동적 schema 와 indexing
• Document를 위해 작성된 표현 쿼리 언어 (ad hoc queries 및 aggregations)
JSON document는
database의
일급 객체(first-class object)임
{
id: 1,
name: "sue",
age: 26,
email: "sue@example.com",
promotions: ["new user", "5%", "dog lover"],
memberDate: 2018-2-22
}
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon DocumentDB
빠르고 확장 가능한 완전 관리형 MongoDB 호환
초당 수백만 건의
요청 처리
컴퓨팅 및 스토리지
분리로 두 계층을
독립적으로 확장 가능;
몇 분 안에 15 개의 읽기
전용 복제본으로 확장
AWS에 의한 관리:
하드웨어 프로비저닝
불필요;
자동 패치, 빠른 설정,
보안 및 자동 백업
MongoDB 3.6과 호환;
동일한 SDK, 도구 및
애플리케이션 사용
빠르고 확장 가능한 완전 관리형 MongoDB 호환 Document 데이터베이스 서비스
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
기존 데이터베이스 아키텍처의 과제
API
Query processor
Caching
Logging
Storage
Application
클라우드에
적합한 구조가
필요함
단일 모놀리식
(monolithic )
아키텍처
모놀리식으로 확장
모놀리식 장애 발생
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
기존 데이터베이스 아키텍처의 과제 : 확장(Scaling)
Replication
읽기 용량(read capacity)을 추가하려고 할 때,
트래픽이 급증
Node 1 Node 2 Node 3 Node 4
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
기존 데이터베이스 아키텍처의 과제 : 복구(Recovery)
Replication
장애가 발생된 노드 대신,
복구를 위한 노드 추가 시 시간이 오래 걸림
Node 1 Node 2 Node 3 Node 3’
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐
API
Query processor
Caching
Logging
Storage
Scale compute
Scale storage
compute와 storage 분리1
Compute layer
Storage layer
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
분산된 스토리지 볼륨
Logging
Storage
데이터를 더 작은 partition으로 분산2
AZ1 AZ2 AZ3
Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Logging
Storage
AZ1 AZ2 AZ3
더 많은 데이터 복제 (6x)3
분산된 스토리지 볼륨
Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Kinesis
Data Streams
Lambda
Amazon
DocumentDB
put_record()
Event
boto
드론(Drone)에서 발생되는 실시간 데이터 저장
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
DocumentDB에 다양한 타입의 데이터 저장
{
"_id" : ObjectId("5d78e9de9fdb37381e5f5723"),
"timestamp" : "2019-09-11 12:34:37.015",
"name" : "heading",
"value" : 319
}
{
"_id" : ObjectId("5d78e9dd9fdb37381e5f5722"),
"timestamp" : "2019-09-11 12:34:36.944",
"name" : "channels",
"value" : {
"1" : 1500,
"3" : 1149,
"2" : 1498,
"5" : 1420,
"4" : 1500,
"7" : 1099,
"6" : 1500,
"8" : 1099
}}
{
"_id" : ObjectId("5d78e9dd9fdb37381e5f5721"),
"timestamp" : "2019-09-11 12:34:36.842",
"name" : "velocity",
"value" : [
0.02,
0.04,
0.26
]
}
{
"_id" : ObjectId("5d78e9dd9fdb37381e5f5720"),
"timestamp" : "2019-09-11 12:34:36.762",
"name" : "groundspeed",
"value" : 0.0200805403292179
}
Integer type
Array type
JSON type Double type
동적 스키마(Dynamic Schema)를 지원하므로, 어떠한 데이터 타입이라도 관계 없이 저장 가능
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
저장된 데이터 활용
Kinesis
Data Streams
Lambda DocumentDB
AWS
Lambda
DocumentDB는 DynamoDB로도 대체 가능
AWS
AppSync
AWS
Amplify
Amazon
Cognito
AWS
Amplify
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
DocumentDB에 직접 Query
db.devday.aggregate(
[
{ $sort: { "timestamp" : -1, "name": 1 } },
{ $match: { $or: [ { "name" : "velocity" }, { "name" : "groundspeed" }, {"name" : "heading"} ] }
},
{
$group:
{
_id: "$name",
name: { $first: "$name" },
value: { $first: "$value" },
timestamp: { $first: "$timestamp" }
}
},
{ $project: { '_id': 0, "name" : 1, "value" : 1, "timestamp" : 1} }
]
)
정렬
조건
그룹화
특정 필드만 가져오기
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
AppSync의 Data Source로 Amazon DocumentDB를 등록
1) DocumentDB 에 query하기 위한 Lambda를 생성
2) 생성한 Lambda를 AppSync의 Data Source로 등록
3) 생성한 Data Source로 resolver를 생성
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
AppSync를 활용하여 DocumentDB에 query/mutation
AWS
AppSync
Lambda
Amazon
DocumentDB
클러스터 엔드포인트
리더 엔드포인트
Lambda
Mutation
Query
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
데모
Kinesis
Data Streams
Lambda DocumentDB
AWS
Lambda
DocumentDB는 DynamoDB로도 대체 가능
AWS
AppSync
Amazon
Cognito
AWS
Amplify
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
비행 영상
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Community
• https://amplify.aws/community/
• https://awsappsync.dev
• https://aws-amplify.github.io/
• https://github.com/aws-amplify
여러분의 피드백을 기다립니다!
#AWSDEVDAYSEOUL

[AWS Dev Day] 앱 현대화 | 실시간 데이터 처리를 위한 현대적 애플리케이션 개발 방법 - 김영진 AWS 솔루션즈 아키텍트, 이세현 AWS 솔루션즈 아키텍트

  • 1.
    © 2019, AmazonWeb Services, Inc. or its affiliates. All rights reserved.
  • 2.
    AWS 실시간 데이터처리를 위한 현대적 애플리케이션 개발 방법 김영진 솔루션즈 아키텍트 이세현 솔루션즈 아키텍트
  • 3.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 모던 애플리케이션 개발이란? Service Open Customer Feedback Code Release Service Open 빠른 개발 과정을 통한 서비스 오픈 Customer Feedback 고객 피드백 및 비즈니스에 집중 Code Release 개발로직에 피드백 재반영 1 2 3
  • 4.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 데모 아키텍처 (Demo Architecture) Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 5.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 어플리케이션 영역 Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 6.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 클라우드 앱을 개발하는 가장 빠른 방법 Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 7.
  • 8.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Introducing AWS Amplify 클라우드 기반 앱을 개발하는 가장 빠른 방법 프론트 엔드 및 백엔드 전체 앱 구축, 테스트, 배포 및 호스팅을위한 Developer Tools Amplify Framework, 라이브러리, CLI 툴체인 및 UI 구성 요소를 포함하는 오픈 소스 클라이언트 프레임 워크 CLI 툴체인을 통해 Amazon Cognito, AWS AppSync 및 Amazon Pinpoint와 같은 Cloud Service 와 쉽게 통합
  • 9.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 카테고리 기반 클라우드 기능 구현 AWS 서비스를 프로젝트에 신속하게 통합하기 위한 CLI 툴체인 UI 컴포넌트프론트 엔드 개발자에 초점을 맞춘 라이브러리 테스트 및 배포를 위한 DevTools Mobile development with Amplify End to end 개발자 경험
  • 10.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Powerful toolchain built for developers Configure Backends $ cd <your-app> $ amplify init $ amplify add <category> $ amplify push $ amplify add hosting $ amplify publish Hosting for Websites Integrate with your app $ amplify codegen add $ amplify codegen generate
  • 11.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Analytics 사용자 세션, 사용자 지정 사용자 특성 및 사용 중인 메트릭 추적 API 실시간 데이터를 지원하는 REST 및 GraphQL을 사용한 HTTP 요청 Authentication 앱용으로 사전 구축 된 UI 구성 요소가있는 인증 API Storage 공개 또는 개인 사용자 컨텐츠를 안전하게 관리하기 위한 간단한 메커니즘 Interactions 딥러닝 기술을 활용한 대화 상자 PubSub 클라우드의 메시지 지향 미들웨어에 앱 연결 Notifications 캠페인 분석 및 타겟팅을 통한 푸시 알림 XR 앱에서 증강 현실 및 가상 현실 콘텐츠로 작업 Cache 대화 형 봇 Hub 사용자 세션, 맞춤 속성 및 인앱 측정 항목을 추적하는 분석 I18n 가벼운 솔루션 Logger 콘솔 로깅 유틸리티 Service worker PWA와 함께 작동하는 유틸리티 클래스 Mobile development with AWS Amplify 포괄적인 클라우드 기능셋
  • 12.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 애플리케이션 데이터 처리를 위한 관리형 GraphQL 서비스 Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 13.
  • 14.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark AWS AppSync 관리형 서버리스 GraphQL service 계정의 데이터 소스에 연결 데이터 원본 또는 API에 데이터 동기화, 실시간 및 오프라인 기능 추가 모든 AWS 서비스에 대한 그래프QL 화면 클라우드 내 충돌 감지 및 해결 엔터프라이즈 보안 기능 (IAM, Amazon Cognito, OIDC, API 키)
  • 15.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark /posts /comments /authors REST API posts comments authors GraphQL API API architectures REST and GraphQL
  • 16.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark How does AWS AppSync work? , ,
  • 17.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark • GraphQL 마이크로서비스 • 오프라인 지원이 중요한 현장 서비스 앱 • IoT 대시보드 • Data Lake의 데이터에 액세스하기 위한 통합 API • 소매 제품 카탈로그, 매장 내 쇼핑 경험 • 쇼핑 카트 체크아웃 • 실시간 환율변동, 주가, 계좌 잔고 • 라이브 방송 내 채팅 및 화면 통신 • 라이브 TV 및 비디오 메타데이터 표시 • 수백만 명의 클라이언트에 대한 높은 처리량 실시간 Fanout Common Use Cases
  • 18.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark A query language for APIs… Queries query GetPost { getPost(id: ”1”) { id title } } mutation CreatePost { createPost(title: “Summit”) { id title } } subscription OnCreatePost { onCreatePost { id title } } Mutations Subscriptions
  • 19.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark A lot of Backend Microservices & Real time subscriptions Queries Subscriptions AppSync Data Sources AWS AppSync Amazon DynamoDB Amazon Elasticsearch Service AWS Lambda Amazon Aurora HTTP Local (Pub/Sub) Mutations
  • 20.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 간단하고 안전한 사용자 가입, 로그인 및 엑세스 제어 Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 21.
  • 22.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 기본UI 와 간단한 구성을 통해 쉽게..
  • 23.
  • 24.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
  • 25.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
  • 26.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 모바일 애플리케이션 개발 준비 Kinesis Data Streams LambdaDocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 27.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Amplify 라이브러리 적용 위해 #npm install --save aws-amplify aws-amplify-react
  • 28.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Graphql 쿼리 조회를 위해
  • 29.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Cognito 모바일 인증인증위해
  • 30.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 어플케이션 데이터 수신 대기
  • 31.
  • 32.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 실시간 데이터 수집 Kinesis Data Streams Lambda DocumentDB AWS Lambda AWS AppSync AWS Amplify Amazon Cognito DocumentDB는 DynamoDB로도 대체 가능
  • 33.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Amazon Kinesis Data Streams 분산 데이터 스트림의 실시간 처리를 위한 완전 관리형 클라우드 기반 서비스 스트림(Stream)은 ‘고유하게 식별 된 데이터 레코드 그룹’인 여러 Shard로 구성됨. Kinesis Data Streams Shards
  • 34.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 드론(Drone)을 생산자로 사용 생산자는 데이터를 생성하고 이 데이터를 Amazon Kinesis Streams에 레코드(record)로 입력 Boto는 Python 용 AWS SDK를 제공하는 Python 라이브러리 Boto는 많은 AWS 서비스에 Python API를 제공하여 코딩을 간결하게 함 boto Kinesis Data Streams Shards
  • 35.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Lambda를 소비자로 사용 소비자는 Amazon Kinesis Streams에서 이러한 데이터 레코드를 가져와 처리 AWS Lambda 함수를 소비자로 사용하여 Amazon Kinesis 데이터 스트림의 레코드를 처리 Lambda는 데이터를 Amazon DocumentDB에 저장 Kinesis Data Streams Shards Lambda Amazon DocumentDB boto
  • 36.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 실시간 데이터 저장을 위한 Amazon DocumentDB 활용 Kinesis Data Streams Lambda DocumentDB DocumentDB는 DynamoDB로도 대체 가능 AWS Lambda AWS AppSync AWS Amplify Amazon Cognito
  • 37.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Document database 란 • Document Model : 데이터 객체들이 Collection 내부에서 독립된 Document로 저장 • Document Model을 기반으로 하는 NoSQL 데이터베이스 RDBMS DocumentDB DynamoDB table collection table row document item column field attribute index index GSI, LSI
  • 38.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Document database 특징 • JSON과 유사한 document에 데이터를 저장 • Document는 인간이 데이터를 모델링하는 방식에 자연스럽게 mapping됨 • 동적 schema 와 indexing • Document를 위해 작성된 표현 쿼리 언어 (ad hoc queries 및 aggregations) JSON document는 database의 일급 객체(first-class object)임 { id: 1, name: "sue", age: 26, email: "sue@example.com", promotions: ["new user", "5%", "dog lover"], memberDate: 2018-2-22 }
  • 39.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Amazon DocumentDB 빠르고 확장 가능한 완전 관리형 MongoDB 호환 초당 수백만 건의 요청 처리 컴퓨팅 및 스토리지 분리로 두 계층을 독립적으로 확장 가능; 몇 분 안에 15 개의 읽기 전용 복제본으로 확장 AWS에 의한 관리: 하드웨어 프로비저닝 불필요; 자동 패치, 빠른 설정, 보안 및 자동 백업 MongoDB 3.6과 호환; 동일한 SDK, 도구 및 애플리케이션 사용 빠르고 확장 가능한 완전 관리형 MongoDB 호환 Document 데이터베이스 서비스
  • 40.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 기존 데이터베이스 아키텍처의 과제 API Query processor Caching Logging Storage Application 클라우드에 적합한 구조가 필요함 단일 모놀리식 (monolithic ) 아키텍처 모놀리식으로 확장 모놀리식 장애 발생
  • 41.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 기존 데이터베이스 아키텍처의 과제 : 확장(Scaling) Replication 읽기 용량(read capacity)을 추가하려고 할 때, 트래픽이 급증 Node 1 Node 2 Node 3 Node 4
  • 42.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 기존 데이터베이스 아키텍처의 과제 : 복구(Recovery) Replication 장애가 발생된 노드 대신, 복구를 위한 노드 추가 시 시간이 오래 걸림 Node 1 Node 2 Node 3 Node 3’
  • 43.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐 API Query processor Caching Logging Storage Scale compute Scale storage compute와 storage 분리1 Compute layer Storage layer
  • 44.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 분산된 스토리지 볼륨 Logging Storage 데이터를 더 작은 partition으로 분산2 AZ1 AZ2 AZ3 Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐
  • 45.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Logging Storage AZ1 AZ2 AZ3 더 많은 데이터 복제 (6x)3 분산된 스토리지 볼륨 Amazon DocumentDB의 현대적인 클라우드 기반 아키텍쳐
  • 46.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Kinesis Data Streams Lambda Amazon DocumentDB put_record() Event boto 드론(Drone)에서 발생되는 실시간 데이터 저장
  • 47.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark DocumentDB에 다양한 타입의 데이터 저장 { "_id" : ObjectId("5d78e9de9fdb37381e5f5723"), "timestamp" : "2019-09-11 12:34:37.015", "name" : "heading", "value" : 319 } { "_id" : ObjectId("5d78e9dd9fdb37381e5f5722"), "timestamp" : "2019-09-11 12:34:36.944", "name" : "channels", "value" : { "1" : 1500, "3" : 1149, "2" : 1498, "5" : 1420, "4" : 1500, "7" : 1099, "6" : 1500, "8" : 1099 }} { "_id" : ObjectId("5d78e9dd9fdb37381e5f5721"), "timestamp" : "2019-09-11 12:34:36.842", "name" : "velocity", "value" : [ 0.02, 0.04, 0.26 ] } { "_id" : ObjectId("5d78e9dd9fdb37381e5f5720"), "timestamp" : "2019-09-11 12:34:36.762", "name" : "groundspeed", "value" : 0.0200805403292179 } Integer type Array type JSON type Double type 동적 스키마(Dynamic Schema)를 지원하므로, 어떠한 데이터 타입이라도 관계 없이 저장 가능
  • 48.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 저장된 데이터 활용 Kinesis Data Streams Lambda DocumentDB AWS Lambda DocumentDB는 DynamoDB로도 대체 가능 AWS AppSync AWS Amplify Amazon Cognito AWS Amplify
  • 49.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark DocumentDB에 직접 Query db.devday.aggregate( [ { $sort: { "timestamp" : -1, "name": 1 } }, { $match: { $or: [ { "name" : "velocity" }, { "name" : "groundspeed" }, {"name" : "heading"} ] } }, { $group: { _id: "$name", name: { $first: "$name" }, value: { $first: "$value" }, timestamp: { $first: "$timestamp" } } }, { $project: { '_id': 0, "name" : 1, "value" : 1, "timestamp" : 1} } ] ) 정렬 조건 그룹화 특정 필드만 가져오기
  • 50.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark AppSync의 Data Source로 Amazon DocumentDB를 등록 1) DocumentDB 에 query하기 위한 Lambda를 생성 2) 생성한 Lambda를 AppSync의 Data Source로 등록 3) 생성한 Data Source로 resolver를 생성
  • 51.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark AppSync를 활용하여 DocumentDB에 query/mutation AWS AppSync Lambda Amazon DocumentDB 클러스터 엔드포인트 리더 엔드포인트 Lambda Mutation Query
  • 52.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 데모 Kinesis Data Streams Lambda DocumentDB AWS Lambda DocumentDB는 DynamoDB로도 대체 가능 AWS AppSync Amazon Cognito AWS Amplify
  • 53.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark 비행 영상
  • 54.
    © 2018, AmazonWeb Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark Community • https://amplify.aws/community/ • https://awsappsync.dev • https://aws-amplify.github.io/ • https://github.com/aws-amplify
  • 56.