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

サーバーレスアーキテクチャで Twilioを安全に運用しよう!

サーバーレスアーキテクチャで Twilioを安全に運用しよう!

Kiminari Homma

December 08, 2015
Tweet

More Decks by Kiminari Homma

Other Decks in Technology

Transcript

  1. 5XJMJP"1*ษڧձ7PM
    αʔόʔϨεΞʔΩςΫνϟ
    Ͱ5XJMJPΛ҆શʹӡ༻͠Α͏ʂ
    TFMGSFF MMD
    ,JNJOBSJ)PNNB

    View full-size slide

  2. ຊؒ ߖ੒ @kimihom
    ϘΫίί ӡӦऀ
    http://www.bokukoko.info/
    CTO at selfree,llc
    Ruby on Rails, AWS, Heroku, Android, iOS
    TwilioJP-UG ϝϯόʔ

    View full-size slide

  3. ίʔϧίωΫτ
    as a Service
    ސ٬৘ใͱ࿈ಈͨ͠ίʔϧηϯλʔΛߏங
    Webϒϥ΢β͕ి࿩୅ΘΓ
    ֨҆ɾຊ֨ػೳɾଈ೔ಋೖ
    ̎िؒແྉτϥΠΞϧ࣮ࢪத
    αʔϏε঺հ
    https://www.callconnect.jp/

    View full-size slide

  4. $POUFOUT
    w 5XJMJPͷ෮श
    w ϑΥʔϧόοΫ63-
    w αʔόʔϨεΞʔΩςΫνϟ
    w ٳܜ
    w ϋϯζΦϯ

    View full-size slide

  5. Voice
    Client
    ి࿩ͷड৴
    Ի੠ϑΝΠϧ࠶ੜ΍௨࿩࿥Ի
    μΠϠϧૢ࡞ʹԠͨ͡ಈ࡞੾ସ
    ௨࿩தͷి࿩ͷ੍ޚ
    ి࿩ͷൃ৴
    ϒϥ΢βɾεϚϗͰి࿩
    Voice ͱ࿈ಈͯ͋͠ΒΏΔ௨࿩Λૢ࡞
    and More..
    →ࣗ༝ʹ૊Έ߹ΘͤՄʂ

    View full-size slide

  6. TwiML
    Twilio Ͱి࿩Λड৴ɾൃ৴͢Δͱ͖ͳͲɺ
    Twilio ΁ಈ࡞໋ྩΛग़ͨ͢ΊͷXML
    Ͳ͏͢Ε͹͍͍ʁ
    ͜͏͠Ζ(TwiML)
    Webαʔόʔ



    https://www.myasset.com/voice.wav


    αϯϓϧ

    View full-size slide

  7. REST API
    HTTP ௨৴Ͱ Twilio ͷ৘ใͷऔಘɾ࡞੒ɾߋ৽ɾ࡟আͳͲΛߦ͏
    ֤ݴޠʹରԠ (PHP, Ruby, Python, Node.js etc)
    Webαʔόʔ
    ͜Ε΍ͬͯ
    ͜͏ͳΓ·ͨ͠
    ྫ͑͹
    ɾి࿩൪߸ͷऔಘɺߪೖɺ࡟আ
    ɾి࿩Λ͔͚Δɺ௨࿩ͷߋ৽
    ɾSMS ૹ৴
    ɾͦͷଞɺTwilio ϚΠϖʔδʹ͋Δૢ࡞ΛࣗલͰ࣮૷

    View full-size slide

  8. ϑΥʔϧόοΫ63-

    View full-size slide

  9. ϦΫΤετURL ͱ ϑΥʔϧόοΫURL
    ి࿩͕͔͔͖ͬͯͨͱ͖ʹɺ࠷ॳʹ Twilo ͕ฉ͖ʹߦ͘ URL
    Ͳ͏͢Ε͹͍͍ʁ
    Error! Webαʔόʔ
    ϦΫΤετURL
    ϦΫΤετ URL ͰTwiMLΛղੳͰ͖ͳ͔ͬͨ৔߹ʹฉ͖ʹߦ͘URL
    ϑΥʔϧόοΫ URL
    ϦΫΤετ URL
    Ͳ͏͢Ε͹͍͍ʁ
    ϑΥʔϧόοΫ URL
    ͜͏͠Ζ(TwiML)

    View full-size slide

  10. ʮΞϓϦέʔγϣϯͷΤϥʔ͕ൃੜ͠·ͨ͠ɻʯ
    4BZ

    View full-size slide

  11. 1SPCMFN
    w ి࿩Λ͔͚ͨਓ͔͠໰୊͕͙͢ʹΘ͔Βͳ͍
    w ΞϥʔττϦΨʔ͸࠷΋୹ͯ͘೔
    w 5XJMJPμογϡϘʔυͷϩάΛຖճݟΔͷ͸େม
    w ΞϓϦέʔγϣϯͷ͍ͤʹͳͬͯ͠·͏ ͦͷ௨Γ͕ͩ

    View full-size slide

  12. ϦΫΤετURL ͱ ϑΥʔϧόοΫURL
    ి࿩͕͔͔͖ͬͯͨͱ͖ʹɺ࠷ॳʹ Twilo ͕ฉ͖ʹߦ͘ URL
    Ͳ͏͢Ε͹͍͍ʁ
    Error! Webαʔόʔ
    ϦΫΤετURL
    ϦΫΤετ URL ͰTwiMLΛղੳͰ͖ͳ͔ͬͨ৔߹ʹฉ͖ʹߦ͘URL
    ϑΥʔϧόοΫ URL
    ϦΫΤετ URL
    Ͳ͏͢Ε͹͍͍ʁ
    ϑΥʔϧόοΫ URL
    ͜͏͠Ζ(TwiML)
    ?

    View full-size slide

  13. ϑΥʔϧόοΫ63-ઌͷ৚݅
    w ϦΫΤετ63-ͱ͸ҧ͏αʔόʔͰ͋Δ
    w ·ͣམͪΔ͜ͱ͕ͳ͍
    w ΤϥʔΛݕ஌Ͱ͖ΔΑ͏ʹ͢ΔͨΊɺ੩తͳϑΝΠ
    ϧͰͳ͘ɺϓϩάϥϜΛಈ͔͍ͨ͠

    View full-size slide

  14. ͦ͜Ͱ
    lαʔόʔϨεΞʔΩςΫνϟz
    1)1ͳͲͷαʔόʔΛ͜ͷͨΊʹΘ͟Θ
    ͟ݐͯΔͷ͸࡞Δͷ΋؅ཧ͢Δͷ΋໘౗ɻ
    ͓ͦͯۚ͠΋͔͔Δɻ

    View full-size slide

  15. "84-BNCEB "NB[PO"1*(BUFXBZ
    lαʔόʔϨεΞʔΩςΫνϟz

    View full-size slide

  16. ɾ"84಺ͷΠϕϯτΛτϦΨʹɺ೚ҙͷ
    ίʔυΛ࣮ߦ
    ɾ/PEFKT+BWB1ZUIPO
    ɾ-JOVY؀ڥʹ"844%, *NBHF.BHJDL
    ͕಺ଂ
    ɾOPEF@NPEVMFTͳͲΛ;JQʹݻΊͯΞοϓ
    ϩʔυՄ
    ɾ͔݄ʹສ݅ͷϦΫΤετ͓Αͼ
    (#ඵͷίϯϐϡʔςΟϯά࣌ؒ
    ͕ແྉ
    ɾϩά͸$MPVE8BUDIͰӾཡ
    "84-BNCEB

    View full-size slide

  17. w "NB[PO4ʹը૾͕Ξοϓϩʔυ͞ΕͨλΠϛϯά
    Ͱɺը૾ΛϦαΠζ
    w "NB[PO%ZOBNP%#ʹσʔλ͕౤ೖ͞ΕͨλΠϛϯά
    ͰɺσʔλΛ੔ܗ
    w $SPOͷΑ͏ʹ೔ҰճͷλΠϛϯάͰɺόονॲཧΛ
    ࣮ߦ
    w όοΫάϥ΢ϯυδϣϒΛ"84-BNCEBԽ
    &YBNQMFTPG"84-BNCEB

    View full-size slide

  18. "NB[PO"1*(BUFXBZ
    ɾ֎෦"1*Λެ։͢Δͷʹ໾ཱͭ
    ɾ"84-BNCEBΛΤϯυϙΠϯτͱ
    ͯ͠ࢦఆՄೳ
    ɾಠࣗ63-ͷൃߦ
    ɾ"1*ͷόʔδϣϯ؅ཧɾ࣮ߦ੍ݶ
    ɾJ04"OESPJE޲͚4%,ൃߦ
    ɾ4XBHHFSରԠ
    ࠓ೥ͷ݄ϦϦʔεʂ
    ݄ʹ౦ژϦʔδϣϯ։ઃ

    View full-size slide

  19. ͣͬͱಈ͍͍ͯΔzαʔόʔzͷ֓೦͕ͳ͘ͳΓɺ
    ඞཁʹͳͬͨͱ͖ʹىಈͯ͠αʔόʔͷΑ͏ʹৼΔ෣͏
    ௿ίετɺߴՄ༻ੑΛ࣮ݱ

    View full-size slide

  20. :PVS
    4FSWFS
    Ϧ
    Ϋ
    Τ
    ε
    τ
    6
    3-
    Τ
    ϥ
    ʔ
    ʂ
    ి࿩

    ᶄ ᶅ
    "1*
    (BUFXBZ
    -BNCEB
    ϑ
    Υ
    ʔ
    ϧ
    ό
    ο
    Ϋ
    6
    3
    -
    5X
    J.
    -

    View full-size slide

  21. 5XJMJPϦΫΤετ63-Λ
    αʔόʔϨεΞʔΩςΫνϟԽʁ
    ͦΕ΋
    (PPE4PMVUJPO

    View full-size slide

  22. ࠓճͷϋϯζΦϯ
    w "84-BNCEBͷίʔυ࡞੒
    w "NB[PO"1*(BUFXBZͷઃఆͱσϓϩΠ
    w ϑΥʔϧόοΫ63-Λ"NB[PO"1*(BUFXBZ΁
    w 5XJMJPͷϦΫΤετ63-Λଘࡏ͠ͳ͍63-΁
    w ಈ࡞֬ೝ

    View full-size slide

  23. ϋϯζΦϯखॱ͸݄೔ͷ
    5XJMJP"EWFOU$BMFOEBSʹͯ

    View full-size slide