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

見せてやろう…!! Serverlessの本当の力を…!! / Let’s show you...

Masashi Terui
February 23, 2019

見せてやろう…!! Serverlessの本当の力を…!! / Let’s show you the real power of serverless…!!

Masashi Terui

February 23, 2019
Tweet

More Decks by Masashi Terui

Other Decks in Technology

Transcript

  1. SERVERWORKS CO.,LTD. + FREELANCER • @marcy_terui • JAWS Days 2015,2017,2018,2019

    speaker • Serverlessconf Tokyo 2016,2017,2018 speaker • Remote worker (in Sapporo-shi, Hokkaido) • The best Serverless Architect in Japan !!(Ͱ͋Γ͍ͨʣ MASASHI TERUI ARCHITECT / DEVELOPER
  2. SERVERLESS ARCHITECTURES (MARTINFOWLER.COM) “In the original version, all flow, control,

    and security was managed by the central server application. In the Serverless version there is no central arbiter of these concerns. Instead we see a preference for choreography over orchestration, with each component playing a more architecturally aware role—an idea also common in a microservices approach.” https://martinfowler.com/articles/serverless.html
  3. • ϝοηʔδϯά • ಉظ/ඇಉظ • Interactive/PubSub • σʔλετΞ • εέʔϦϯά

    • σʔλΞΫηε • ࣮ߦํ๏ • ฒྻ/௚ྻ • ܾఆత/ඇܾఆత ໨తΛՌͨͨ͢Ίͷ࠷దղ͸ҟͳΔ
  4. • ಉظ • API Gateway • ඇಉظ • ௚ྻ •

    Kinesis Streams • ฒྻ • SNS • SQS • ͦͷଞ • Step Functions ͲͷΑ͏ʹॲཧ͢΂͖͔ʁ
  5. • Lambda͔Β࢖͍ͮΒ͍ • AmplifyͷAppSync ClientͷServer Side޲͚ʢͱଞݴޠ൛ʣ΄͍͠ • ೝূΛUser Pool΍OIDCʢͱҰԠAPI Keyʣʹͯ͠΋


    Lambda͔Β͸IAMͰೝূͤͯ͞΄͍͠ • Amplify CLI͔ΒDynamoDB Table࡞Δͱςʔϒϧ໊͕ಛఆͰ͖ͳ͍ • AppSync௨ͤͬͯ͜ͱͳΜͩΖ͏͚ͲͦΕͳΒLambda͔Βʢ͈́ • DynamoDBͷมߋΛࣗಈͰΩϟϓνϟͯ͠SubscriptionൃՐͯ͠΄͍͠ Ͱ΋AppSyncૉఢ͚ͩͲͪΐͬͱ଍Γͳ͍
  6. • ࣮ࡍʹ໰୊͕ى͖ͨ(ى͖ͦ͏)͜ͱΛ؂ࢹ͢Δ • Τϥʔͷൃੜ΍஗ԆΛ؂ࢹ͢Δ • API Gateway: Latency, 5XX Response

    • Lambda: Duration, Errors, Throttling, DeadLetterErrors • DynamoDB: Consumed Capacity, Throttling, Latency, Errors
 •Ұ൪େ੾ͳͷ͸ΞϓϦέʔγϣϯͷϩά ϞχλϦϯά
  7. • DeadLetterErrors • ͿͬͪΌ͚LambdaͷىಈError͸ى͖Δ࣌͸ͪΐ͍ͪΐ͍ى͖Δ • ࠶࣮ߦͰ্ख͘ݴͬͯΔέʔε͕΄ͱΜͲ • ࠶࣮ߦ΋ࣦഊͯ͠औΓ͜΅ͨ͠Error͸͜ΕΛݟͳ͍ͱ෼͔Βͳ͍(ཁઃఆ) • Throttling

    • SDK͸Throttlingͯ͠΋಺෦Ͱউखʹ࠶࣮ߦ͢Δ • Τϥʔ͕ى͖ͯͳ͍͔ΒThrottling͕ى͖ͯͳ͍ͱ͸ݶΒͳ͍ • ͜ΕΛݟΔͱൃੜঢ়گ͕෼͔ΔˠCapacity௥Ճ ؂ࢹ߲໨ྫ
  8. • ෼ࢄͨ͠FaaS؀ڥͰ͸͍͔ʹू໿ͯ͠ޮ཰Α͘ݟΒΕΔΑ͏ʹ͢Δ͔͕େࣄ • ·ͣू໿͢Δͷ͸େલఏ • CloudWatch Logs͸ͨͩͷόοΫΞοϓ • Kinesis Firehose

    -> Elasticsearch • Datadog LogsΦεεϝ • https://github.com/marcy-terui/ddlogs • Trace IDͷड͚౉͠ํΛܾΊͯԣ۲ͰݕࡧͰ͖ΔΑ͏ʹ͢Δ τϨʔγϯά
  9. • Serverless͸Event Drivenͱ૬ੑ͕ྑ͍ • ඇಉظओମʹઃܭ͢Δ͜ͱͰґଘੑͱಠཱੑΛߴΊΒΕΔ • ඇಉظॲཧΛ্ख͘੔ཧ͢Δͷʹ΋Event Drivenͱ͍͏ߟ͑ํ͕༗ޮ • Serverlessͳඇಉظॲཧʹ͓͚Δෆ҆ཁૉ͸෷১͞Εͨ

    • WebSocket API Gateway͸
 ͨͩͷManaged WebSocket EndpointͰ͸ͳ͍ • AppSync͸ະདྷʢ͋ͱ΋͏ͪΐͬͱɾɾɾʂʣ • ཧ૝ͷΞʔΩςΫνϟ΁ͷಓ͕ݟ͖͑ͯͨ SUMMARY