Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AppSync를 활용한 리얼타임 서버리스 아키텍쳐

Taewoo Kim
February 13, 2020

AppSync를 활용한 리얼타임 서버리스 아키텍쳐

제21차 AWSKRUG 서버리스 소모임에서 발표한 내용입니다.

Taewoo Kim

February 13, 2020
Tweet

More Decks by Taewoo Kim

Other Decks in Programming

Transcript

  1. ߊ಴੗ ࣗѐ • 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/ ೠҴয & ੌࠄয ӝࣿ࠶۽Ӓ
  2. ࢲߡܻझ ইఃఫ୛੄ ౠ૚ • ҙܻೡ ࢲߡо হ׮ (NoOps) • ೙ਃೡ

    ٸ݃׮ ೙ਃೠ ࠗ࠙݅ ೙ਃೠ ݅ఀ ࢎਊೡ ࣻ ੓׮ • ஹೊ౴ ܻࣗझח Lambda (഑਷ Fargate) • Lambda ੄ ҃਋ ੗୓੸ਵ۽ connection ਸ ਬ૑ೡ ࣻ হ׮
  3. It’s possible, but … • ೐ۿ౟ূ٘৬ ߔূ٘ р੄ ాनਸ ਤೠ

    Data structure ܳ ੿੄೧ঠೞҊ • ׼োೞ૑݅ ؘ੉ఠܳ ઱Ҋ ߉ਸ ٸ੄ Validation ب ೙ਃೞҊ • ׼োೞ૑݅ ߔূ٘৬ ೐ۿ౟ূ٘ নஏীࢲ ѐߊ੉ ੉ܖযઉঠೞҊ • ౠ൤ ߔূ٘ ஏ੄ ֢۱੉ (࢚׼൤) ݆੉ ٜযцפ׮
 High Availability .. Reliability .. Scalability ..
  4. AWS AppSync • Strong typing ਵ۽ ੋ೧ Validation ௏٘ (Ѣ੄)

    ࢤۚ оמ
 (GraphQL ੄ ౠ૚) • ܻ঴ఋ੐ ాनਸ ਤ೧ࢲ ߔূ٘ীࢲ ೧ঠೡ Ѫ਷ Subscription ਸ झః݃ী ࢶ঱೧ فח Ѫ ߆ী হ਺ • ೐ۿ౟ূ٘ ஏীࢲח AppSync SDK ա Amplify ܳ ࢎਊೞݶ рױ൤ Subscription оמ
  5. ݃੉௼۽ ࢲ࠺झ Stream ਵ۽ࠗఠ Lambda ౟ܻѢ Subscription Micro services Subscription

    Data Streaming Mutation Trigger AppSync ܻ঴ఋ੐ ইఃఫ୛ ੉ ࠗ࠙੉ য়ט ߊ಴੄ ೨ब
  6. DynamoDB Streams → Lambda • ੹ഋ੸ੋ ࢲߡܻझ ؘ੉ఠ झ౟ܻ߁ ಁఢ

    ઺ ೞա • Eventual Consistency ഑਷ Event-driven processing ١ਸ ୊ܻೞӝী ੸೤ • ScalableɾReliableɾCost Effective • ߽۳بо ݒ਋ ֫਷ ੘সী ؀೧ࢲח पदрࢿਸ ࠁ੢ೞ૑ ঋਵ޲۽ Kinesis DS о જ਺
  7. RDS → DMS → Kinesis → Lambda • RDS ܳ

    ࢎਊೠ ҃਋ীب झ౟ܻ߁ ୊ܻо оמೣ • Kinesis Data Streams ח ࢥ٘ܳ ੸੺൤ ஶ౟܀ ೡ ࣻ ੓যঠ ೣ • Kinesis Data Streams ীࢲ Ҷ੉ Lambda ۽ ো҅ೡ ೙ਃח হ਺ • Ӓ۞ա ࠄ ߊ಴੄ ݾ੸ (AppSync ো҅) ਸ ਤೠ ਊب۽ח Lambda ۽ ୽࠙ • DB (MySQL, PostgreSQL ١) ਵ۽ ࠗఠ ૒੽ Lambda ܳ प೯दఃח ߑߨب ઓ੤
  8. • SQS ীࢲ Lambda ۽ ো҅غח ಁఢ • Kinesis ীࢲ

    Lambda ۽ ো҅غח ಁఢ • API Gateway ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Alarms ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Events ীࢲ Lambda ۽ ো҅غח ಁఢ • Ӓ ৻ীب ޖࣻ൤ ݆਺ ӝఋ ੉߮౟ ࣗझ
  9. Microservice • API Gateway → Lambda → DynamoDB ҳࢿ •

    о੢ ݆੉ ॳ੉ח ࢲߡܻझ ইఃఫ୛ API ߔূ٘ ಁఢ • рױೠ ੑ۱ ಬਸ ୊ܻೞח ࢲ࠺झܳ ৘۽ ٜয ؘݽ௏٘ ੘ࢿ
  10. AWS AppSync • AppSync ҳ୷दীח Serverless Framework ܳ ୶ୌ •

    Subscription ܳ झః݃ী ୶оೞח Ѫ݅ਵ۽ ௿ۄ੉঱౟ ஏীࢲ Subscription ੉ оמ 
 ( ߔূ٘ ੘সߊࢤ X ) • ೙ਃೠ ӝמ਷ Mutation җ Subscription ࡺ੉૑݅, Query ܳ झః݃ী ١۾ೞ૑ ঋਵݶ GraphQL झః݃ ী۞о غ޲۽ рױೠ ௪ܻ ೞաܳ ୶о೧ঠೣ (getOrder ੘ࢿ) • Mutation ೞӝ ਤ೧ࢲ੄ DynamoDB ܳ ؘ੉ఠ ࣗझ۽ࢲ ࢤࢿೞҊ, TTL (Time-To-Live) ܳ ࢸ੿ೠ׮. (expiresAt ܳ AWSTimestamp ఋੑਵ۽ ࢶ঱ೠ׮)
  11. DynamoDB Streams → Lambda • DynamoDB Streams ח ୭؀ 24

    दр੄ ؘ੉ఠ ࠁઓ, ؘ੉ఠ ߸҃੄ ࣽߣ੉ ࠁૐоמೠ ࢲ࠺झ • Ӓ۞ա ܻ঴ఋ੐ ࢲ࠺झীࢲח ୭؀ 24दр੄ ؘ੉ఠ ࠁઓ਷ ߹ ੄޷о হӟ ೤פ׮. • ߽۳بܳ ֫੉۰ݶ ߓ஖ ࢎ੉ૉܳ ઑ੺ೞݶ ؽ
  12. Lambda → AppSync • पࢲ࠺झਊਵ۽ ܾܻૉػ AppSync Client SDK ח

    javascript ߡ੹ ࡺ (Amplify ܳ ӂ੢) • AppSync Client SDK ܳ Lambda ࢚ীࢲ ز੘दఃӝ ਤ೧ࢲח ݻо૑ ઱੄੼੉ ੓਺ • ismorphic-fetch ܳ ੐ನ౟ ೧ঠೣ • disableOffline ܳ true ۽ ߸҃೧ঠೣ
  13. 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/
  14. 42

  15. AppSync ҙ۲ ࠶۽Ӓ • AWS ੤ੑޙ ࠶۽Ӓ – AppSync ಞ

    (ೠҴয)
 https://dev.classmethod.jp/cloud/aws/aws-appsync-re-introduction-2019-korean-ver/
  16. AppSync ҙ۲ ࠶۽Ӓ • [AppSync ѐ֛੿ܻ] AWS AppSync ߂ Resolver

    Mapping Template ী ؀೧ ѐ֛ਸ ੿ܻ೧ࠇद׮!
 https://dev.classmethod.jp/cloud/appsync-resolver-vtl-tutorial-ko/
  17. State Management by AppSync • ࢲߡܻझ ইఃఫ୛ ಁఢীࢲח Rich Client

    ܳ ૑ೱ • Ӓ۞ա ೐ۿ౟ূ٘੄ ௏٘ ࠂ੟بо ૑ա஖ѱ ૐоೞחѪ਷ જ૑ ঋ਺ • ೐ۿ౟ূ٘੄ ௏٘ ࠂ੟ب੄ ࢚׼ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ௏٘੄ ࠂ੟بܳ AppSync Subscription ী ੄ઓ ೧ࢲ ೧Ѿೡ ࣻب ੓૑ ঋਸө? • ֎౟ਕ௼੄ ࣘب/উ੿ࢿ ١ী ੄ઓࢿ੉ ࢤӣ. • Ӓ۞ա 5G द؀ীח ௾ ޙઁח হ૑ ঋਸө?
  18. State Management by AppSync • ࢲߡܻझ ইఃఫ୛ ಁఢীࢲח Rich Client

    ܳ ૑ೱ • Ӓ۞ա ೐ۿ౟ূ٘੄ ௏٘ ࠂ੟بо ૑ա஖ѱ ૐоೞחѪ਷ જ૑ ঋ਺ • ೐ۿ౟ূ٘੄ ௏٘ ࠂ੟ب੄ ࢚׼ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ௏٘੄ ࠂ੟بܳ AppSync Subscription ী ੄ઓ ೧ࢲ ೧Ѿೡ ࣻب ੓૑ ঋਸө? • ֎౟ਕ௼੄ ࣘب/উ੿ࢿ ١ী ੄ઓࢿ੉ ࢤӣ. • Ӓ۞ա 5G द؀ীח ௾ ޙઁח হ૑ ঋਸө? Let’s discuss together!