Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AppSync를 활용한 리얼타임 서버리스 아키텍쳐
Search
Taewoo Kim
February 13, 2020
Programming
0
4.4k
AppSync를 활용한 리얼타임 서버리스 아키텍쳐
제21차 AWSKRUG 서버리스 소모임에서 발표한 내용입니다.
Taewoo Kim
February 13, 2020
Tweet
Share
More Decks by Taewoo Kim
See All by Taewoo Kim
AWS Lambda 내부동작 파헤치기
twkiiim
1
2.6k
Amazon VPC Deep Dive: ENI 를 알면 VPC 가 보인다
twkiiim
2
5.3k
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기
twkiiim
0
380
Amplify Meetup #01
twkiiim
1
6.3k
Amazon EventBridge vs Amazon SNS
twkiiim
0
2.1k
活用パターンで学ぶGraphQL
twkiiim
0
1.3k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
0
2k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
1
2.9k
[LINE API × Tech API Vol. 2 Powered by AWS] サーバーレスでの分散トランザクション
twkiiim
0
2.3k
Other Decks in Programming
See All in Programming
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Remix on Hono on Cloudflare Workers
yusukebe
1
280
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
290
Contemporary Test Cases
maaretp
0
130
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
610
CSC509 Lecture 09
javiergs
PRO
0
140
ヤプリ新卒SREの オンボーディング
masaki12
0
130
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Agile that works and the tools we love
rasmusluckow
327
21k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
For a Future-Friendly Web
brad_frost
175
9.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
Statistics for Hackers
jakevdp
796
220k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Visualization
eitanlees
145
15k
Producing Creativity
orderedlist
PRO
341
39k
Transcript
ӣక AppSync ܳ ഝਊೠ ܻఋ ࢲߡܻझ ইఃఫ
ߊ ࣗѐ • Solutions Architect, Classmethod (ੌࠄ) • Front-end, Back-end,
Android, iOS, Machine Learning, Computer Vision, etc • ୭Ӕ 1֙р AWS ࠙ঠীࢲ ޙࢿਸ ऺӝਤ೧ Ҋҵ࠙ై • Serverless on AWS, ؊ աইоࢲ Builder on AWS ܳ ೱೞݴ ழܻযܳ ऺח • য়ט ੑפ!!!! AWSKRUG ٜ࠙җ ݆݆ ҮܨೞҊ रणפ!!!!ƃƃ https://dev.classmethod.jp/author/kim-taewoo/ ೠҴয & ੌࠄয ӝࣿ࠶۽Ӓ
ࢲߡܻझ ইఃఫ ౠী ೧ рױ غযࠇद
ࢲߡܻझ ইఃఫ ౠ • ҙܻೡ ࢲߡо হ (NoOps) • ਃೡ
ٸ݃ ਃೠ ࠗ࠙݅ ਃೠ ݅ఀ ࢎਊೡ ࣻ • ஹೊ ܻࣗझח Lambda ( Fargate) • Lambda ҃ ਵ۽ connection ਸ ਬೡ ࣻ হ
Ӓۢ ࢲߡܻझ ইఃఫ۽ח ܻఋ ӝמ ޅ ݅٘աਃ?
ٜ݅ ࣻ ભ!
How? API Gateway ীࢲ ਢࣗ ਗ API Gateway websocket
How? PubSub ழ֏࣌ ӝ߈ ࣛܖ࣌ ইפ݅ PubSub ࣛܖ࣌ب (ੌױ) оמ
It’s possible, but … • ۿূ٘৬ ߔূ٘ р ాनਸ ਤೠ
Data structure ܳ ೧ঠೞҊ • োೞ݅ ؘఠܳ Ҋ ߉ਸ ٸ Validation ب ਃೞҊ • োೞ݅ ߔূ٘৬ ۿূ٘ নஏীࢲ ѐߊ ܖযઉঠೞҊ • ౠ ߔূ٘ ஏ ֢۱ (࢚) ݆ ٜযцפ High Availability .. Reliability .. Scalability ..
AppSync ܳ ࢎਊೞݶ ݽٚѪ рױ೧פ!!
AWS AppSync • Strong typing ਵ۽ ੋ೧ Validation ٘ (Ѣ)
ࢤۚ оמ (GraphQL ౠ) • ܻఋ ాनਸ ਤ೧ࢲ ߔূ٘ীࢲ ೧ঠೡ Ѫ Subscription ਸ झః݃ী ࢶ೧ فח Ѫ ߆ী হ • ۿূ٘ ஏীࢲח AppSync SDK ա Amplify ܳ ࢎਊೞݶ рױ Subscription оמ
ܻఋ ؘఠ ాनਸ ਤೠ AppSync ইఃఫ
AppSync ܻఋ ইఃఫ Micro services Subscription Data Streaming Mutation Trigger
݃۽ ࢲ࠺झ Stream ਵ۽ࠗఠ Lambda ܻѢ Subscription Micro services Subscription
Data Streaming Mutation Trigger AppSync ܻఋ ইఃఫ ࠗ࠙ য়ט ߊ ೨ब
ࢲߡܻझ झܻ߁ ইఃఫ
DynamoDB Streams → Lambda
DynamoDB Streams → Lambda • ഋੋ ࢲߡܻझ ؘఠ झܻ߁ ಁఢ
ೞա • Eventual Consistency Event-driven processing ١ਸ ܻೞӝী • ScalableɾReliableɾCost Effective • ߽۳بо ݒ ֫ সী ೧ࢲח पदрࢿਸ ࠁೞ ঋਵ۽ Kinesis DS о જ
RDS → DMS → Kinesis → Lambda
RDS → DMS → Kinesis → Lambda • RDS ܳ
ࢎਊೠ ҃ীب झܻ߁ ܻо оמೣ • Kinesis Data Streams ח ࢥ٘ܳ ஶ܀ ೡ ࣻ যঠ ೣ • Kinesis Data Streams ীࢲ Ҷ Lambda ۽ ো҅ೡ ਃח হ • Ӓ۞ա ࠄ ߊ ݾ (AppSync ো҅) ਸ ਤೠ ਊب۽ח Lambda ۽ ࠙ • DB (MySQL, PostgreSQL ١) ਵ۽ ࠗఠ Lambda ܳ प೯दఃח ߑߨب ઓ
ӝఋ ߮ ࣗझ
• SQS ীࢲ Lambda ۽ ো҅غח ಁఢ • Kinesis ীࢲ
Lambda ۽ ো҅غח ಁఢ • API Gateway ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Alarms ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Events ীࢲ Lambda ۽ ো҅غח ಁఢ • Ӓ ৻ীب ޖࣻ ݆ ӝఋ ߮ ࣗझ
Lambda ۽ ؘఠܳ ߉ই৳ਵݶ рױೞભ!
Lambda → AppSync
ؘݽ ۽ં ইఃఫ
ؘݽ ইఃఫ Microservice DynamoDB Subscription द۽ ࢎਊೡ AppSyncਊ DB Mutation
DynamoDB Streams
Microservice • API Gateway → Lambda → DynamoDB ҳࢿ •
о ݆ ॳח ࢲߡܻझ ইఃఫ API ߔূ٘ ಁఢ • рױೠ ੑ۱ ಬਸ ܻೞח ࢲ࠺झܳ ۽ ٜয ؘݽ٘ ࢿ
AWS AppSync • AppSync ҳ୷दীח Serverless Framework ܳ ୶ୌ •
Subscription ܳ झః݃ী ୶оೞח Ѫ݅ਵ۽ ۄ ஏীࢲ Subscription оמ ( ߔূ٘ সߊࢤ X ) • ਃೠ ӝמ Mutation җ Subscription ࡺ݅, Query ܳ झః݃ী ١۾ೞ ঋਵݶ GraphQL झః݃ ী۞о غ۽ рױೠ ௪ܻ ೞաܳ ୶о೧ঠೣ (getOrder ࢿ) • Mutation ೞӝ ਤ೧ࢲ DynamoDB ܳ ؘఠ ࣗझ۽ࢲ ࢤࢿೞҊ, TTL (Time-To-Live) ܳ ࢸೠ. (expiresAt ܳ AWSTimestamp ఋੑਵ۽ ࢶೠ)
DynamoDB Streams → Lambda • DynamoDB Streams ח ୭ 24
दр ؘఠ ࠁઓ, ؘఠ ߸҃ ࣽߣ ࠁૐоמೠ ࢲ࠺झ • Ӓ۞ա ܻఋ ࢲ࠺झীࢲח ୭ 24दр ؘఠ ࠁઓ ߹ о হӟ פ. • ߽۳بܳ ֫۰ݶ ߓ ࢎૉܳ ઑೞݶ ؽ
Lambda → AppSync • पࢲ࠺झਊਵ۽ ܾܻૉػ AppSync Client SDK ח
javascript ߡ ࡺ (Amplify ܳ ӂ) • AppSync Client SDK ܳ Lambda ࢚ীࢲ زदఃӝ ਤ೧ࢲח ݻо • ismorphic-fetch ܳ ನ ೧ঠೣ • disableOffline ܳ true ۽ ߸҃೧ঠೣ
DEMO TIMEʂ
None
٘ܳ ೠߣ ಝࠅөਃ https://github.com/twkiiim/serverless-tutorials/tree/master/realtime-stream-with-appsync
AppSync Subscription ী ೞৈ
AppSync WebSockets MQTT over WebSockets WebSockets (NEW) Payload Size 128Kb
240Kb CloudWatch Metrics X O Selection Set Filtering X O Enhanced Connection Rates X O Enhanced Broadcast Rates X O https://aws.amazon.com/jp/blogs/mobile/appsync-realtime/
re:Invent 2019 Builders Fair ীࢲ ࣗѐػ Smart Chair
42
AppSync ী ೧ ؊ ঌҊ रݶ?
AppSync ҙ۲ ࠶۽Ӓ • AWS ੑޙ ࠶۽Ӓ – AppSync ಞ
(ೠҴয) https://dev.classmethod.jp/cloud/aws/aws-appsync-re-introduction-2019-korean-ver/
AppSync ҙ۲ ࠶۽Ӓ • [AppSync ѐ֛ܻ] AWS AppSync ߂ Resolver
Mapping Template ী ೧ ѐ֛ਸ ܻ೧ࠇद! https://dev.classmethod.jp/cloud/appsync-resolver-vtl-tutorial-ko/
AppSync ҙ۲ ࠶۽Ӓ • [AWS AppSync] ΤοδσόΠεͷσʔλΛ AWS IoTܦ༝Ͱऔಘͯ͠GraphQLΛߋ৽ͯ͠Έ·ͨ͠ɻ https://dev.classmethod.jp/cloud/aws-appsync-with-awsiot/
AppSync ҙ۲ ࠶۽Ӓ • [AWS AppSync] ΤοδσόΠεͷσʔλΛ AWS IoTܦ༝Ͱऔಘͯ͠GraphQLΛߋ৽ͯ͠Έ·ͨ͠ɻ https://dev.classmethod.jp/cloud/aws-appsync-with-awsiot/
AppSync ۽ ۠Ѫب غ ঋਸө?
State Management by AppSync • ࢲߡܻझ ইఃఫ ಁఢীࢲח Rich Client
ܳ ೱ • Ӓ۞ա ۿূ٘ ٘ ࠂبо աѱ ૐоೞחѪ જ ঋ • ۿূ٘ ٘ ࠂب ࢚ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ٘ ࠂبܳ AppSync Subscription ী ઓ ೧ࢲ ೧Ѿೡ ࣻب ঋਸө? • ֎ਕ ࣘب/উࢿ ١ী ઓࢿ ࢤӣ. • Ӓ۞ա 5G दীח ޙઁח হ ঋਸө?
State Management by AppSync • ࢲߡܻझ ইఃఫ ಁఢীࢲח Rich Client
ܳ ೱ • Ӓ۞ա ۿূ٘ ٘ ࠂبо աѱ ૐоೞחѪ જ ঋ • ۿূ٘ ٘ ࠂب ࢚ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ٘ ࠂبܳ AppSync Subscription ী ઓ ೧ࢲ ೧Ѿೡ ࣻب ঋਸө? • ֎ਕ ࣘب/উࢿ ١ী ઓࢿ ࢤӣ. • Ӓ۞ա 5G दীח ޙઁח হ ঋਸө? Let’s discuss together!
хࢎפ