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

月額10円から作るServerless Website〜Azure編〜/serverlessfukuoka-20170825

月額10円から作るServerless Website〜Azure編〜/serverlessfukuoka-20170825

2017/8/25 Serverless Meetup Fukuoka #1 の資料です。
https://serverless.connpass.com/event/62473/

356dbe9f00ed6a1f5dafe126029497f1?s=128

Kunihiro Morita

August 25, 2017
Tweet

Transcript

  1. ֹ݄10ԁ͔Β࡞Δ Serverless Website ʙAzureฤʙ #serverlessfukuoka 2017/8/25 Serverless Meetup Fukuoka #1

    1
  2. AWSฤ(2016/3/21)1 1 https://speakerdeck.com/morita92hiro/yue-e-10yuan-karazuo-ruserverless-website 2017/8/25 Serverless Meetup Fukuoka #1 2

  3. ৿ా๜༟ גࣜձࣾΦϧλʔϒʔε ιϦϡʔγϣϯΞʔΩςΫτ @morita92hiro http://hawaku.hateblo.jp 2017/8/25 Serverless Meetup Fukuoka #1

    3
  4. ʮ1܅ɺLPαΠτ࡞ͬ ͯɻCMS͸͍Βͳ͍ɻʯ 2017/8/25 Serverless Meetup Fukuoka #1 4

  5. >>1ʮWeb Appsͷग़൪΍ʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 5

  6. Web Apps • WebαΠτɺWebΞϓϦͷϗετʹ࠷దԽͨ͠αʔϏε • ߴՄ༻ੑɺCI/CD • αΠτ٧Ί์୊ 2017/8/25 Serverless

    Meetup Fukuoka #1 6
  7. ʮ1܅ɺ͓໰͍߹Θͤϖʔδ࡞ͬͯʯ >>1ʮ͋ͬɺ͸͍ʯ 2017/8/25 Serverless Meetup Fukuoka #1 7

  8. Web Apps • ASP.NETɺNode.jsɺJavaɺPHPɺPython • on Linux(preview) • Node.jsɺPHPɺ.NET CoreɺRubyɺDocker

    2017/8/25 Serverless Meetup Fukuoka #1 8
  9. ʮ1܅ɺHTTPSԽΑΖʯ 2017/8/25 Serverless Meetup Fukuoka #1 9

  10. HTTPSԽ • SSLΛߪೖͯ͠ಋೖ • ֦ுػೳͱͯ͠Let's Encrypt͕࢖͑Δ 2017/8/25 Serverless Meetup Fukuoka

    #1 10
  11. >>1ʮWebαΠτʹ Web App͸࠷ద΍͊… ( ˘ω˘)ţźōʯ 2017/8/25 Serverless Meetup Fukuoka #1

    11
  12. ʮ1܅ɺྉ͕ۚɻ10ԁͲ ͍ͬͨ͜ʁʯ 2017/8/25 Serverless Meetup Fukuoka #1 12

  13. >>1ʮWeb App Freeϓ ϥϯʹมߋʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 13

  14. >>1ʮFreeϓϥϯ͸ΧελϜυϝΠϯ࢖͑ͳ͍ɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 14

  15. >>1ʮCDNೖΕͯΧελ ϜυϝΠϯׂΓ౰ͯʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 15

  16. Azure CDN • ίϯςϯπσϦόϦʔαʔϏε • GzipѹॖػೳͰ͞Βʹߴ଎ɺసૹίετ࡟ݮʂ 2017/8/25 Serverless Meetup Fukuoka

    #1 16
  17. >>1ʮ͋ɺSSLূ໌ॻɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 17

  18. >>1ʮങͬͯ΋Β͓͏ʯ • Let's Encryptͷূ໌ॻ͸Azure CDNͰ΋(ͨͿΜ)࢖͑Δ • Let's Encryptͷূ໌ॻ͸3ϲ݄ظݶ • ࣗಈߋ৽ͷ࢓૊ΈΛ࡞ΔΑΓങ͏΄͏͕͍҆ʢ޻਺ʼߪೖʣ

    • DVূ໌ॻͳΒ1,000ԁ/೥લޙ͔ΒߪೖՄೳ • AWS Certificate Manager(ACM)͕Azureʹ΋ɾɾɾ|дƅ)ŧŽŕ 2017/8/25 Serverless Meetup Fukuoka #1 18
  19. ొஃޙ௥هʢగਖ਼ʣ Azure CDNʹ΋HTTPS͕؆୯ʹ࢖͑Δػೳ͕͋Γ·ͨ͠ɻ • Azure CDN ΧελϜ υϝΠϯͷ HTTPS ͷ༗ޮԽ

    https://docs.microsoft.com/ja-jp/azure/cdn/cdn-custom-ssl 2017/8/25 Serverless Meetup Fukuoka #1 19
  20. தؒ·ͱΊ • 10ԁ/݄͙Β͍ʁ+SSLূ໌ॻ୅(Web Appແྉϓϥϯ) • 1,000ԁ/݄͙Β͍ʁ(Web App༗ྉϓϥϯ)ɻαΠτ٧Ί์୊ 2017/8/25 Serverless Meetup

    Fukuoka #1 20
  21. ʮ1܅ɺ͜ΕαʔόʔϨεͳͷʁʯ >>1ʮPaaSͰ͢ʯ 2017/8/25 Serverless Meetup Fukuoka #1 21

  22. αʔόʔϨεͱ͸2 ऍᷟʹઆ๏Ͱ͕͢… αʔόʔϨε͸ɺαʔόʔ͕ͳ͍͜ͱΛࣔ͢Θ͚Ͱ͸ͳ͘ɺ։ ൃऀ͕αʔόʔʹ͍ͭͯ৺഑͢Δඞཁ͕ͳ͍͜ͱΛ͍ࣔͯ͠Δ ͚ͩͰ͢ɻ ैདྷͷΞϓϦέʔγϣϯ։ൃͷେ͖ͳ෦෼͸ɺΞϓ ϦέʔγϣϯͷཁٻΛຬͨͨ͢ΊͷιϦϡʔγϣϯͷεέʔϦ ϯάɺϗεςΟϯάɺ؂ࢹʹؔ͢Δ࣭໰ʹ౴͑Δͱ͜Ζʹ͋Γ· 2 https://docs.microsoft.com/ja-jp/azure/logic-apps/logic-apps-serverless-overview

    2017/8/25 Serverless Meetup Fukuoka #1 22
  23. >>1ʮมߋʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 23

  24. >>1ʮBLOB࢖͏Αʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 24

  25. Azure Blob Storage • ΦϒδΣΫτετϨʔδ • ؆қ੩తαΠτ • ৑௕ੑ(LRS/GRS/RA-GRS) 2017/8/25

    Serverless Meetup Fukuoka #1 25
  26. >>1ʮindex.htmlະରԠɾɾɾʯ http://example.com/΁ͷΞΫηεͰindex.htmlΛදࣔͯ͘͠Εͳ͍ 2017/8/25 Serverless Meetup Fukuoka #1 26

  27. >>1ʮCDNೖΕΔʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 27

  28. Azure CDN Rules Engine3 • HTTPཁٻͷॲཧํ๏ΛΧελϚΠζՄೳ • ReWrite RuleͰindex.htmlରԠ5 5

    https://stackoverflow.com/questions/37368829/azure-cdn-rules-engine-to-rewrite-default-document-and-remove-html- extension 3 https://docs.microsoft.com/ja-jp/azure/cdn/cdn-rules-engine 2017/8/25 Serverless Meetup Fukuoka #1 28
  29. >>1ʮ͋ͬɺ͓໰͍߹Θ ͤϖʔδ!ʯ 2017/8/25 Serverless Meetup Fukuoka #1 29

  30. >>ʮJSͰBLOBʹPOST͓ͯ͠໰͍߹ Θͤσʔλஔ͍ͯɺʯ 2017/8/25 Serverless Meetup Fukuoka #1 30

  31. >>1ʮJS͕BLOB΁ͷॻ͖ࠐΈݖݶඞ ཁ΍͠ɺJSʹೝূ৘ใΛॻ͖ࠐΉͷ ͸ɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 31

  32. >>1ʮ࢖͍ࣺͯͳೝূ৘ใΛऔಘͰ͖ Ε͹ɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 32

  33. >>1ʮSASͱAzure Functionʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 33

  34. Shared Access Signatures(SAS) • ະೝূήετʹॻ͖ࠐΈݖݶ • Ұ࣌తͳೝূ৘ใΛൃߦ • SAS Token͸Azure

    Functionܦ༝Ͱऔಘ 2017/8/25 Serverless Meetup Fukuoka #1 34
  35. Azure Function • ΠϕϯττϦΨʔͰىಈ • C#ɺF#ɺNode.jsɺPythonɺPHPɺBatchɺBash౳͕࢖͑Δ • ͓໰͍߹Θ͕ͤདྷͨΒඞཁͳ௨஌ઌ΁ 2017/8/25 Serverless

    Meetup Fukuoka #1 35
  36. ิ଍ • ͓໰͍߹Θͤσʔλஔ͖৔ʹ͸CORSઃఆ • POST߈ܸ͞Εͨ͘ͳ͍ͷͰ͔ͬ͠Γ੍ݶ! 2017/8/25 Serverless Meetup Fukuoka #1

    36
  37. >>1ʮͰ΋௨஌ʹඞཁͳೝূ৘ใΛ FunctionʹຒΊࠐΈͨ͘ͳ͍ɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 37

  38. >>1ʮThe Twelve-Factor Appʯ4 4 https://12factor.net/ja/ 2017/8/25 Serverless Meetup Fukuoka #1

    38
  39. 3ষ ઃఆ4 ઃఆΛ؀ڥม਺ʹ֨ೲ͢Δ ΞϓϦέʔγϣϯ͸࣌ʹઃఆΛఆ਺ͱͯ͠ίʔυ಺ʹ֨ೲ͢ Δɻ͜Ε͸Twelve-Factorʹҧ൓͍ͯ͠ΔɻTwelve-Factor͸ ઃఆ Λίʔυ͔Βݫີʹ෼཭͢Δ͜ͱ Λཁٻ͢Δɻઃఆ͸σϓϩΠ ͝ͱʹେ͖͘ҟͳΔ͕ɺίʔυ͸ͦ͏Ͱ͸ͳ͍ɻ 4

    https://12factor.net/ja/ 2017/8/25 Serverless Meetup Fukuoka #1 39
  40. >>1ʮAzure Functionͷ؀ڥม਺Λ࢖͏Αʯ 2017/8/25 Serverless Meetup Fukuoka #1 40

  41. தؒ·ͱΊ • 10ԁ/݄͙Β͍ʁʴSSLূ໌ॻ୅ 2017/8/25 Serverless Meetup Fukuoka #1 41

  42. ʮ1܅ɺ࣌୅͸ػցֶश΍ʯ 2017/8/25 Serverless Meetup Fukuoka #1 42

  43. >>1ʮɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 43

  44. >>1ʮCognitive Services!ʯ 2017/8/25 Serverless Meetup Fukuoka #1 44

  45. Cognitive Services • REST APIͷαʔϏε܈ • ײ৘ݕग़ɺࢹ֮ೝࣝɺԻ੠ೝࣝɺݴޠཧղͳͲ୔ࢁ • ػցֶशͷ஌͕ࣝͳͯ͘΋࢖͑Δ 2017/8/25

    Serverless Meetup Fukuoka #1 45
  46. Մೳੑ͸∞ • ࠓճͷέʔεͩͱ͓໰͍߹Θͤ಺༰Ληϯνϝϯτ෼ੳͱ͔ • ը૾ΛPOSTग़དྷΔΑ͏ʹͯ͠ը૚ղੳͱ͔ 2017/8/25 Serverless Meetup Fukuoka #1

    46
  47. ͪͳΈʹ 2017/8/25 Serverless Meetup Fukuoka #1 47

  48. Azure Functionʹ௚઀POSTύλʔϯ • Funtion࣮ߦ࣌ؒ͸5෼7 • ௕͍λεΫ͸QueueΛڬΜͰϐλίϥ8 8 https://buildazure.com/2017/08/15/scaling-azure-functions-with-durable-functions/ 7 https://buildazure.com/2017/08/17/azure-functions-extend-execution-timeout-past-5-minutes/

    2017/8/25 Serverless Meetup Fukuoka #1 48
  49. தؒ·ͱΊ • SAS+Azure Funtion(10ԁ/݄͙Β͍?+SSLূ໌ॻ) • Azure Function௚઀POST(10ԁ/݄͙Β͍?+SSLূ໌ॻ) 2017/8/25 Serverless Meetup

    Fukuoka #1 49
  50. >>1ʮͦ͏ͩʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 50

  51. >>1ʮαʔόʔϨείʔυϨεʹ͠Α͏ʯ 2017/8/25 Serverless Meetup Fukuoka #1 51

  52. >>1ʮLogic Appsʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 52

  53. Logic Apps • IFTTT΍myThingsɺMS FlowΈ͍ͨͳ΍ͭ • ը໘ϙνϙνͰઃఆɻInfrastructure as CodeͰ؅ཧՄೳ •

    ߴ౓ͳ͜ͱΛ͍ͨ͠ͱ͖͸Azure Functionͱ૊Έ߹ΘͤΔ 2017/8/25 Serverless Meetup Fukuoka #1 53
  54. >>1ʮLogic AppsͷWebhookʹ CORSઃఆͰ͖ͳ͍ɾɾɾʯ 2017/8/25 Serverless Meetup Fukuoka #1 54

  55. >>1ʮAzure Function ProxyڬΉʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 55

  56. Azure Function Proxy • ΤϯυϙΠϯτڞ௨Խ • API ManagementΑΓϥΠτʹ࢖͑Δ(Β͍͠) • CORSઃఆͰ͖Δ(ࠓճ͸͜Ε͕໨త)

    2017/8/25 Serverless Meetup Fukuoka #1 56
  57. ิ଍ࢿྉ FlowɺLogic AppsɺFunctionsɺWebJobsͷൺֱ9 de:code 2017ͰAzure FunctionsͱLogic Appsͷ࿩Λ͖ͯͨ͠10 Azure App ServiceɺVirtual

    MachinesɺService FabricɺCloud Servicesͷൺֱ11 11 https://docs.microsoft.com/ja-jp/azure/app-service-web/choose-web-site-cloud-service-vm 10 http://yoshidashingo.hatenablog.com/entry/2017/06/17/112504 9 https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-compare-logic-apps-ms-flow-webjobs 2017/8/25 Serverless Meetup Fukuoka #1 57
  58. >>1ʮ৽αʔϏεʂʯ 2017/8/25 Serverless Meetup Fukuoka #1 58

  59. Event Grid6 • 8/17஀ੜ • preview • αʔόʔϨεΞϓϦέγϣϯ։ൃ • OpsࣗಈԽ

    ࠓޙAzureͷαʔόϨεΞʔΩςΫνϟ ͷத৺ʹͳ͍ͬͯ͘ʁ 6 https://docs.microsoft.com/en-us/azure/event-grid/overview 2017/8/25 Serverless Meetup Fukuoka #1 59
  60. Azure Container Instance • ίϯςφͷϑϧϚωʔδυαʔϏε • FaaSͷಈ࡞؀ڥͱͯ͠ • kubernetesͷԾ૝ϊʔυͱͯ͠΋ར༻Մ •

    preview 2017/8/25 Serverless Meetup Fukuoka #1 60
  61. ·ͱΊ • Web Appsύλʔϯ(ิ଍:Cognitive΋௥ՃͰར༻Մೳ) • Blobύλʔϯ 2017/8/25 Serverless Meetup Fukuoka

    #1 61
  62. Serverless΋PaaS΋࠷దʹ࣮ݱͰ͖ Δग़དྷΔͳΒͲͪΒͰ΋(ɾ˲ɾ)ŘŘ!! 2017/8/25 Serverless Meetup Fukuoka #1 62

  63. σϞ Logic Apps+Cognitive Services 2017/8/25 Serverless Meetup Fukuoka #1 63

  64. ͓ΘΓ 2017/8/25 Serverless Meetup Fukuoka #1 64