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

アクアシャッターf IoT異常通報システム開発記 〜 AWSとSORACOMとmockmock

Y_uuu
April 27, 2021

アクアシャッターf IoT異常通報システム開発記 〜 AWSとSORACOMとmockmock

2021-04-27(Tue) 19:00〜
Fusic Tech Live Vol.1:AWS 活用事例 にて発表
https://fusic.connpass.com/event/206957/

Y_uuu

April 27, 2021
Tweet

More Decks by Y_uuu

Other Decks in Programming

Transcript

  1. ΞΫΞγϟολʔ̵ IoTҟৗ௨ใγεςϜ։ൃه
    ʙ AWSͱSORACOMͱmockmock
    2021-04-27(Tue
    )

    Fusic Tech Live Vol.1ɿAWS ׆༻ࣄྫ
    ઌਐٕज़෦໳ IoTνʔϜ Ԭቌ ༤ฏ
    1

    View full-size slide

  2. ࣗݾ঺հ
    Ԭቌ ༤ฏ
    Okazaki Yuhei
    ‣ I
    D

    - @yuuu @Y_uuu
    ‣ ࣗݾ঺հ
    • FusicͷIoTΫϥ΢υΤϯδχΞ
    • ݩɾ૊ࠐΈΤϯδχΞ(2018೥͔ΒWebܥ΁
    )

    • ࠷ۙͷ͓࢓ࣄ͸ઐΒAzure
    ‣ Skil
    l

    2
    image
    ʘNewʗ

    View full-size slide

  3. IoTΫϥ΢υΤϯδχΞͷ͓࢓ࣄ
    3
    ‣ IoT=ITͷ૯߹֨ಆٕ

    View full-size slide

  4. IoTΫϥ΢υΤϯδχΞͷ͓࢓ࣄ
    4
    ‣ σόΠεҎ֎ͷ෦෼(IoTʹ͓͚ΔΫϥ΢υ)ͷ։ൃɾςετɾӡ༻Λ୲౰

    View full-size slide

  5. ໨࣍
    5
    0. ΞΠεϒϨΠΫ ʙ IoTϓϩμΫτࠓ೔ͷΠνΦγ
    1. γεςϜ֓ཁ
    2. ΞʔΩςΫνϟ ʙ SORACO
    M

    3. ΞʔΩςΫνϟ ʙ AW
    S

    4. mockmockΛ࢖ͬͨςετ
    5. ·ͱΊ

    View full-size slide

  6. ΞΠεϒϨΠΫ: IoTϓϩμΫτࠓ೔ͷΠνΦγ
    6
    ‣ εϚϗ͕ʮ伴ʯʹͳΔ
    ‣ Ոʹۙͮ͘ͱࣗಈղৣɺࣗಈࢪৣ(ΦʔτϩοΫ
    )

    ‣ API΋ެ։͞Ε͍ͯΔͷͰ͍Ζ͍Ζ༡΂Δ
    ηαϛεϚʔτϩοΫ

    View full-size slide

  7. ΞΠεϒϨΠΫ: IoTϓϩμΫτࠓ೔ͷΠνΦγ
    7
    ‣ Ո͔Β཭Ε͍ͯͯ΋Ոͷঢ়ଶ͕Θ͔Δ
    - ʮ伴ดΊ͚ͨͬʁʯͱෆ҆ʹͳΔ͜ͱ͕ͳ͘ͳͬͨ
    - Ո଒͕༧ఆ௨ΓͷߦಈΛ͍ͯ͠Δ͔ɺ΋ՄࢹԽ
    ‣ ԕִʹ͋ΔϞϊͷঢ়ଶΛՄࢹԽ
    - ҙ֎ͱخ͍͠
    - ࠓ೔͓࿩͢ΔγεςϜ΋ʮԕִ؂ࢹʯ͕ςʔϚͰ͢
    ղৣ࣌ɾࢪৣ࣌ʹεϚϗʹ௨஌͕དྷΔ

    View full-size slide

  8. ʘ͔͜͜Βຊ୊Ͱ͢ʗ
    📣


    ΞΫΞγϟολʔ̵


    IoTҟৗ௨ใγεςϜ։ൃه
    8

    View full-size slide

  9. 1. γεςϜ֓ཁ
    9

    View full-size slide

  10. લఏ: ։ൃʹ͓͚ΔεςʔΫϗϧμʔ
    10
    ɾγεςϜͷൃ஫ݩɺϢʔβʔ


    ɾSORACOM SIMͷൃ஫ɾ؅ཧ
    ɾσόΠεͷઃܭɾ։ൃɾςετ
    ɾγεςϜͷઃܭɾ։ൃɾςετ


    ɾAWSͷ੥ٻ୅ߦ
    σόΠεൃ஫
    σόΠεೲ඼
    γεςϜൃ஫
    γεςϜೲ඼
    ࿈ܞͯ͠։ൃ

    View full-size slide

  11. ຊ೔঺հ͢ΔγεςϜ
    11
    ΞΫΞγϟολʔ̵ IoTҟৗ௨ใγεςϜ

    View full-size slide

  12. ΞΫΞγϟολʔ̵ͱ͸
    12
    ‣ גࣜձࣾӉࠜమ޻ॴ͕੡଄ɾൢച
    ‣ େӍɾߑਫ࣌ʹݐ෺΍ઃඋͷਁਫΛ๷͙๷ਫ൘
    ‣ ʮ24࣌ؒɺແಈྗɾແૢ࡞ʯΛചΓʹ͍ͯ͠Δ

    View full-size slide

  13. ΞΫΞγϟολʔ̵ͱ͸
    13

    View full-size slide

  14. ΞΫΞγϟολʔ̵๊͕͑Δ՝୊
    14
    ‣ ແಈྗɾແૢ࡞ͷͨΊɺಈ࡞ϩά͕࢒Βͳ͍
    - ࣮ࡍʹਁਫ͕ൃੜͯ͠ɺ࡞ಈͨ͠ͷ͔Θ͔Βͳ͍
    - ൶ʹॏྔ෺͕৐͍ͬͯͯɺ࡞ಈෆೳʹͳ͍ͬͯͯ΋ؾ෇͔ͳ͍

    View full-size slide

  15. IoTҟৗ௨ใγεςϜͷػೳ࢓༷
    15
    ‣ ੡඼ʹσόΠε(+ηϯαʔ)Λޙ෇͢Δ͜ͱͰɺ

    ൶ىཱɾ൶౗෬ͱ͍ͬͨঢ়ଶΛγεςϜ্Ͱ֬ೝͰ͖ΔΑ͏ʹ͢Δ
    ‣ ੡඼͕࡞ಈͨ͜͠ͱΛࢦఆͨ͠Ѽઌ΁௨஌͢Δ
    ‣ σόΠεͷࢮ׆؂ࢹΛ͢Δ

    View full-size slide

  16. શମΞʔΩςΫνϟ
    16

    View full-size slide

  17. 2. ΞʔΩςΫνϟ ʙ SORACOM
    17

    View full-size slide

  18. SORACOMΛ࠾༻ͨ͠ཧ༝
    18
    ‣ SIMΛ࢖͏͜ͱͰ԰֎Ͱͷ௨৴Λ࣮ݱ
    ‣ SIMΛ1ຕ͔Βൃ஫Մೳ
    ‣ σόΠεͱΫϥ΢υ͕γʔϜϨεʹ௨৴Ͱ͖Δ

    View full-size slide

  19. IoT։ൃʹ͓͚ΔσόΠεͱΫϥ΢υͷΪϟοϓ
    19
    σόΠε Ϋϥ΢υ
    ϓϩτίϧ
    ϑΥʔϚοτ
    ೝূ
    ‣ σʔλͷૹड৴ʹؔͯ͠େ͖ͳΪϟοϓ͕͋Δ
    ϨΠϠͷ௿͍ϓϩτίϧ
    (ྫ: TCP, UDP)
    ϨΠϠͷߴ͍ϓϩτίϧ
    (ྫ: HTTPS, MQTTS)
    όΠφϦͰߏ଄Խͨ͠
    σʔλ͕ѻ͍΍͍͢
    ςΩετԽ͞Εͨσʔλ͕
    ѻ͍΍͍͢(ྫ: JSON)
    ߴ౓ͳೝূ͸ίετ͕͔͔Δ
    ෆਖ਼ͳσόΠε͔Βͷ
    ΞΫηεΛ๷͙ͨΊೝূ͕ඞཁ

    View full-size slide

  20. όΠφϦύʔαʔ+FunnelͰΪϟοϓΛຒΊΔ
    20
    ‣ ϓϩτίϧ: TCP→HTTPSʹม׵
    ‣ ϑΥʔϚοτ: όΠφϦˠJSONʹม׵
    ‣ IoT Coreͷೝূ͸FunnelͰҰݩԽ

    View full-size slide

  21. όΠφϦύʔαʔ+FunnelͰΪϟοϓΛຒΊΔ
    21
    ‣ ϓϩτίϧ: TCP→HTTPSʹม׵
    ‣ ϑΥʔϚοτ: όΠφϦˠJSONʹม׵
    ‣ IoT Coreͷೝূ͸FunnelͰҰݩԽ
    ‣ σόΠεɾΫϥ΢υͦΕͧΕ։ൃ͠΍͍͢

    View full-size slide

  22. 3. ΞʔΩςΫνϟ ʙ AWS
    22

    View full-size slide

  23. AWS
    23
    ‣ IoT Core͕ड৴ͨ͠σʔλΛSQS΁PU
    T

    View full-size slide

  24. AWS
    24
    ‣ Webଆ͸ࢸͬͯී௨ͷWebγεςϜ

    View full-size slide

  25. AWS
    25
    ‣ Worker͕SQS͔ΒGE
    T

    ‣ RDS΁֨ೲ
    ‣ ඞཁʹԠͯ͡ϝʔϧ௨஌(SES)

    View full-size slide

  26. SQSΛ࢖ͬͯσʔλΛEC2Ͱॲཧ
    26
    ‣ SQS→EC2͸Α͋͘Δઃܭ
    ‣ SQSͷલஈʹSNSΛڬΉͱ͜Ζ͕ϙΠϯτ
    - SQS͕σόοά͠ʹ͍͘ͷͰSNSΛڬΉ͜ͱͰɺσʔλͷ֬ೝΛ༰қʹ͢Δ
    - SQSҎ֎ͷૹ৴ઌ͕ඞཁʹͳͬͨͱ͖ʹରԠ͠΍͍͢

    View full-size slide

  27. SQSΛ࢖ͬͯσʔλΛEC2→RDSʹ֨ೲ
    27
    ‣ ࠓͳΒEvent BridgeΛ࢖ͬͨํ͕ྑͦ͞͏ʁ
    - IoT Core→Event Bridge͕ະରԠ
    - SNSΛڬΜͩσʔλૹ৴͸·ͩ·ͩ༗ޮ(ࠓޙʹظ଴)

    View full-size slide

  28. αʔόϨεΞʔΩςΫνϟˠIaaS͸Ξϯνύλʔϯʁ
    28
    ‣ ඞͣ͠΋ͦ͏ͱ͸ݴ͑ͳ͍ɺέʔεόΠέʔε
    - ϝϦοτ: WebγεςϜ͔ΒΞΫηεɾूܭ͠΍͍͢
    - σϝϦοτ: εέʔϧ͠ʹ͍͘
    ‣ ࠓճ͸ن໛͕ͦ͜·Ͱେ͖͘ͳ͘ɺٸܹͳεέʔϧͷՄೳੑ΋௿͍ͱ൑அ
    - σόΠεͷ઀ଓ୆਺: ͓͓Αͦ100୆
    - ௨৴ස౓: 1ճ/୆ɾ೔

    View full-size slide

  29. αʔόϨεΞʔΩςΫνϟ+IaaS͸Ξϯνύλʔϯʁ
    29
    ‣ ࠓͳΒLambda→RDS-Proxyͱ͍͏બ୒ࢶ΋ΞϦ

    View full-size slide

  30. αʔόϨεΞʔΩςΫνϟ+IaaS͸Ξϯνύλʔϯʁ
    30
    ‣ ࠓͳΒLambda→RDS-Proxyͱ͍͏બ୒ࢶ΋ΞϦ

    View full-size slide

  31. αʔόϨεΞʔΩςΫνϟ+IaaS͸Ξϯνύλʔϯʁ
    31
    ‣ ࠓͳΒLambda→RDS-Proxyͱ͍͏બ୒ࢶ΋ΞϦ

    View full-size slide

  32. 4. mockmockΛ࢖ͬͨςετ
    32

    View full-size slide

  33. IoTͷςετ͸೉͍͠
    33
    ‣ ͳΜΒ͔ͷํ๏ͰσʔλΛૹ৴͠ͳ͍ͱɺಈ࡞Λ֬ೝͰ͖ͳ͍
    σόΠε͔Βͷ
    σʔλૹ৴͕
    ͢΂ͯͷ͸͡·Γ

    View full-size slide

  34. ཧ૝ܗ: mockmock͕୅ΘΓʹσʔλΛૹ৴
    34
    ಈ࡞Λ֬ೝͰ͖Δ

    View full-size slide

  35. mockmock
    35
    ‣ ౰࣌͸SORACOM࿈ܞ͕ະϩʔϯν
    - E2EͰ֬ೝͰ͖ͳ͍ͱ͋·Γҙຯ͕ແ͍ͱߟ͑ͨ
    ‣ ༧૝͞ΕΔΫϥ΢υଆͷෛՙ͕খ͍͞
    - σόΠε਺͕গͳ͘ɺૹ৴ස౓΋௿͍ͷͰ
    ຊ։ൃͰ͸͋·Γ׆༻͕Ͱ͖ͳ͔ͬͨ

    View full-size slide

  36. ݱ࣮: ຊ։ൃͰͷςετ
    36
    ಈ࡞Λ֬ೝͰ͖Δ
    ‣ όοΫΤϯυͷςετ

    SORACOM Funnel͔Βͷ
    σʔλૹ৴Λ໛ٖ(਺ճ)

    View full-size slide

  37. ݱ࣮: ຊ։ൃͰͷςετ
    37
    ‣ όοΫΤϯυͷςετ

    SORACOM Funnel͔Βͷ
    σʔλૹ৴Λ໛ٖ(਺ճ)
    ‣ E2Eςετ

    σόΠε͔Βͷσʔλૹ৴
    ಈ࡞Λ֬ೝͰ͖Δ

    View full-size slide

  38. σόΠεͱΫϥ΢υΛ઀ଓͨ͠ࡍʹ໰୊ൃੜ
    38
    ‣ ϝοηʔδΛ࿈ଓૹ৴ͨ͠ࡍͷঢ়ଶભҠʹ໰୊͋Γ

    View full-size slide

  39. σόΠεͱΫϥ΢υΛ઀ଓͨ͠ࡍʹ໰୊ൃੜ
    39
    ‣ ϝοηʔδΛ࿈ଓૹ৴ͨ͠ࡍͷঢ়ଶભҠʹ໰୊͋Γ

    View full-size slide

  40. σόΠεͱΫϥ΢υΛ઀ଓͨ͠ࡍʹ໰୊ൃੜ
    40
    ‣ ϝοηʔδΛ࿈ଓૹ৴ͨ͠ࡍͷঢ়ଶભҠʹ໰୊͋Γ

    View full-size slide

  41. ཧ૝ܗ: mockmock͕୅ΘΓʹσʔλΛૹ৴
    41
    ಈ࡞Λ֬ೝͰ͖Δ

    View full-size slide

  42. ཧ૝ܗ: mockmock͕୅ΘΓʹσʔλΛૹ৴
    42
    ಈ࡞Λ֬ೝͰ͖Δ
    ࠓͳΒ΍ΕΔʂ

    View full-size slide

  43. ·ͱΊ
    44
    ‣ SORACOM SIMͰσόΠεͱΫϥ΢υΛγʔϜϨεʹ઀ଓͰ͖Δ
    ‣ AWSͰड৴ͨ͠σʔλΛWebΞϓϦʹड͚౉ͤΔ
    ‣ mockmockΛ࢖͑͹σόΠεͱΫϥ΢υΛඇಉظͰ։ൃɾςετͰ͖Δ

    View full-size slide

  44. 45
    ͝ਗ਼ௌ͍͖ͨͩ͋Γ͕ͱ͏͍͟͝·ͨ͠
    Thank You
    We are Hiring
    !

    https://recruit.fusic.co.jp/

    View full-size slide