Pro Yearly is on sale from $80 to $50! »

iPhoneアプリのバックエンドとしてServerless Framework使ってみた

28347314c7fc698b4ac0e01113545e25?s=47 mackato
August 28, 2016

iPhoneアプリのバックエンドとしてServerless Framework使ってみた

JAWS-UG 東海道 in 浜松 2016で発表した資料です

28347314c7fc698b4ac0e01113545e25?s=128

mackato

August 28, 2016
Tweet

Transcript

  1. iPhoneΞϓϦͷόοΫΤϯυͱͯ͠ Serverless FrameworkΛ࢖ͬͯΈͨ JAWS-UG ౦ւಓ in ඿দ 2016 Ճ౻ ڡ๜@ΤΞʔζ

  2. ࣗݾ঺հ • @mackato • ඿দग़਎ɺ౦ژࡏॅɻ౎ຽྺ2೥ • WEB։ൃྺ16೥ • Railsྺ11೥ •

    ཮ϚΠϥʔྺ4೥ • શ೔ຊιϜϦΤ࿈ໍೝఆϫΠϯφϏήʔλʔ
  3. ຊ೔ͷͰ͖͝ͱ • ே5࣌ʹ͓͖ͯ2͔͚࣌ؒͯ࢓্͛ͨϓϨθϯࢿྉΛΰϛശʹ ۭͯͯ͢ʹ͠·ͨ͠ • JAWS-UGʹ޲͔͏৽װઢʢͻ͔Γ469߸ʣͷ࠲੮ͷ෺ೖΕʹ ΧόϯΛ๨Ε·ͨ͠

  4. ΤΞʔζגࣜձࣾ • RailsͱiOSͷडୗ։ൃ • ࣗࣾΞϓϦ • ඿দຊࣾ • ౦ژΦϑΟεʢங஍ʣ •

    ϦϞʔτϫʔΫ
  5. ϚΠϧखா • ϚΠϧ΍ϙΠϯτͷ࢒ߴ֬ೝ΍ަ׵ ܭࢉ͕Ͱ͖ΔΞϓϦ • ཮ϚΠϥʔ΍ۭϚΠϥʔ • ΫϨδοτΧʔυͷϔϏʔϢʔβʔ ʢAWSͷࢧ෷͍ͱ͔ʣ •

    ։ൃऀ2໊ʢPythonɺSwiftɺRubyʣ • 2016.08.08 1.0.0ϦϦʔε • 2016.08.27 1.0.4ʢ1.0.5ਃ੥தʣ
  6. None
  7. Why Serverless Architecture? • ओͳॲཧ͸ΞϓϦଆɺόοΫΤϯυ͸ิॿతʹ࢖༻ • ߴ͍ηΩϡϦςΟ͕୲อͰ͖ͦ͏ • ػີ৘ใ͸LambdaͷϝϞϦ಺ͷΈͰऔΓѻ͏ •

    CloudTrailɺCloudWatchΛར༻ͨ͠؂ࠪɾ؂ࢹ • εϞʔϧελʔτͰ͖ͯεέʔϧͦ͠͏ • αʔόʔߏஙෆཁͰϦϦʔεָ͕ͦ͏
  8. What is Serverless Framework? Build web, mobile and IoT applications

    with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! • Manages the lifecycle of your serverless architecture (build, deploy, update, delete). • Safely deploy functions, events and their required resources. • Functions can be grouped ("serverless services") for easy management of code, resources & processes.
  9. AWSαʔϏεͷར༻ঢ়گ • API Gateway Endpoint: 5 • Lambda Function: 8

    • DynamoDB Table: 2 • CloudWatch Event: 3 • 2016೥8݄ͷ༧૝՝ֹۚ: $1ఔ౓
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. σϓϩΠ࣌ʹඞཁͳ͜ͱ • 8ݸ͋Δ͢΂ͯͷFunctionͰґଘϥΠϒϥϦΛಉࠝ • Serverless FrameworkͰॻ͍ͨϦιʔεͱAWS্ͷϦϦʔε ͷ੔߹ੑ֬ೝ • Gitͷtag΍branchͱσϓϩΠઌͷεςʔδ͕Ұக͍ͯ͠Δ͔ ֬ೝ

    • Serverless FrameworkͷCLIͰͷૢ࡞ʢϝϯυΫαΠʣ ख͕͔͔ؒΔؒ͠ҧ͑ͦ͏
  17. ղܾࡦ ϦϦʔε༻ͷεΫϦϓτΛॻ͍ͨ by @kengos $ ./release.py --help usage: release.py [-h]

    -s STAGE [-r REGION] [-t TAG] [-b BRANCH] [--tmpdir TMPDIR] [--skip-deploy] [--debug]
  18. ϦϦʔεखॱ $ git flow release start v1.0.1 $ git flow

    relaese publish v1.0.1 $ ./release.py -s beta -b v1.0.1 ~~ BetaϏϧυΛTestFlightͰ഑෍ͯ͠ಈ࡞֬ೝ ~~ $ git flow release finish v1.0.1 $ ./release.py -s prod -t v1.0.1 # ΞϓϦ1.0.0΋ࢀর ~~ v1.0.1ͷReleaseϏϧυΛAppStoreʹొ࿥ ~~
  19. Θ͔ͬͨ͜ͱ • Serverlessʹ͢ΔͱϚΠΫϩαʔϏεʹͳΔͷ͔ͱࢥͬͨ ͕ɺRails೴ͩͱϞϊϦγοΫʹͳͬͨ • খ͞ͳαʔϏεͰ͋Ε͹΄΅ແྉ࿮಺Ͱར༻Ͱ͖ɺݱঢ়ίε τతͳ৺഑͸ͳͦ͞͏ • ෼ੳπʔϧ͸Mobile Analytics

    + RedshiftΑΓFirebase + Bigqueryͷํ͕࢖͍΍͔ͬͨ͢
  20. ྑ͔ͬͨ͜ͱ • ٻΊ͍ͯͨηΩϡϦςΟ͕୲อͰ͖ͨ • αʔόʔߏஙෆཁͰϦϦʔε࡞ۀͷෛ୲͕ͳ͔ͬͨ • ؂ࢹΞϥʔτ͕ඈΜͰདྷͳ͍ͷͰྑ͘຾ΕͯΔ

  21. ൓ল఺ • DynamoDBʹ׳Εͯͳͯ͘ઃܭʹࢼߦࡨޡͨ͠ • API GatewayͷλΠϜΞ΢τ੍ݶͰϋϚͬͨ • CloudWatch Event͚ͩͰ͸ٻΊ͍ͯͨεέδϡʔϦϯά͕Ͱ ͖ͳ͔ͬͨ

  22. ࠓޙࢼ͍ͨ͜͠ͱ • VPC಺ͷRailsΞϓϦͱͷ࿈ܞ • ΞϓϦͷόʔδϣϯΞοϓΛ੍໿͠ͳ͍Α͏ͳόοΫΤϯυ ͷϦϦʔεख๏

  23. Thank you ౦ژΤϦΞ։ൃऀืूத ServerlessҊ݅ͷ͝૬ஊ΋͓଴͍ͪͯ͠·͢