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

平成最後なのでEC2からECS+Fargateに 置き換えた話

平成最後なのでEC2からECS+Fargateに 置き換えた話

marnie0301

May 21, 2019
Tweet

More Decks by marnie0301

Other Decks in Technology

Transcript

  1. ฏ੒࠷ޙͳͷͰEC2͔ΒECS+Fargateʹ

    ஔ͖׵͑ͨ࿩
    @marnie ɹɹɹɹɹɹɹ JAWS-UG ίϯςφࢧ෦ ೖ໳ฤ #6

    View full-size slide

  2. 43&5FBN&OHJOFFSBUFVSFLB *OD
    -JLF
    ೣɺͶ͜ɺDBUɺΩϟοτ
    ࣗసं ౦ژʙઋ୆͍ͬͨΓ

    ϩέ஍ௐ΂
    HBNFBOJNF
    ত࿨ੜ·Ε
    2
    About me
    ɹɹMasashi Yamamoto (@marnie)
    2

    View full-size slide

  3. 3
    Eureka SRE Team
    3
    5FBN.JTTJPO7JTJPO
    શγεςϜͷՄ༻ੑɺ৴པੑɺੑೳɺ։ൃޮ཰ͷ޲্
    Ϗδωεͷ࣮ݱͷ્֐ཱ֬Λ্͛ΔཁҼͷഉআ
    ࣮ۀ຿ྫ
    Πϯϑϥ؂ࢹܥͷߏஙίετϓϥϯχϯά
    ηΩϡϦςΟؔ࿈΍ԣஅࢪࡦܥͷ࣮૷ɾϦʔυ
    σʔλύΠϓϥΠϯͷߏஙઃܭɾϚΠΫϩαʔϏε։ൃͳͲ قઅʹΑΔ

    σϓϩΠ#PU΍ύΠϓϥΠϯߏஙɾࣗಈԽͳͲ։ൃޮ཰Խ΁ͷد༩
    ΞϓϦέʔγϣϯίʔυ΋ඞཁʹԠͯ͡ॻ͖·͢ɻ
    Մ༻ੑ
    B[
    minatoku-eureka-a
    minatoku-eureka-c
    minatoku-eureka-d

    View full-size slide

  4. 4
    agenda
    4
    &$͔Β&$4'BSHBUFʹҠߦͨ͠࿩
    എܠʙٕज़બఆ
    ίϯςφߏ੒ɾઃܭࢦ਑
    σϓϩΠɺεέʔϦϯά
    ɺ؂ࢹͷ͓࿩
    ·ͱΊ

    View full-size slide

  5. 5
    ίϯςφԽҎલͷߏ੒
    5
    QBDLFSBOTJCMFͰ࡞੒ͨ͠(PMEFO*NBHFΛ
    UFSSBGPSNͰల։͢Δӡ༻
    *B$
    *NNVUBCMF*OGSBTUSVDUVSF
    ֓ͶσʔλετΞͷ෼཭͕Ͱ͖͍ͯΔɻ
    8FC4FSWFSͷεέʔϧΞ΢τ͸༰қɻ
    ಈ࡞໘ εέʔϥϏϦςΟݎ࿚ੑ
    ͸େ͖ͳ՝୊΋ͳ
    ͘ฏ࿨ɻ

    View full-size slide

  6. 6
    Q.ͳΜͰίϯςφʹͨ͠ͷʁ
    6

    View full-size slide

  7. 7
    ࠷ॳͷ͖͔͚ͬɿΠϯϑϥ൓ө͕ͭΒ͔ͬͨ
    7
    QBDLFSCVJMEdຊ൪൓ө·Ͱͷίετ
    ඞཁͳશͯͷϞδϡʔϧΛΠϯετʔϧ#VJMEͯ͠HPMEFO*NBHFΛ࡞Δ
    UFSSBGPSNʹBNJΛ൓өˠ࠷ऴςετ
    BVUP4DBMJOH(SPVQͷ૿ݮͰಈ࡞͍ͯ͠ΔαʔόʔΛखಈͰೖΕସ͑Δ ৽چࠞࡏ

    ͜ͷ··Ͱ͸ฏ੒͕ऴΘͬͯ͠· SZ
    ׂͱංେԽ͖͍ͯͯ͠ΔQMBZCPPL

    View full-size slide

  8. 8
    ίϯςφྑ͍
    8
    ϓϩηε୯ҐͰߏஙՄೳ
    ࢖༻͢Δϛυϧ΢ΣΞಉ࢜Ͱͷґଘੑͷڝ߹ͳͲΛؾʹ͠ͳ͍ͰࡁΉɻ
    मਖ਼ɾ௥ՃʹΑΔӨڹΛڱ͘ग़དྷΔɻ
    ػೳ௥Ճɾमਖ਼͸໾ׂผʹίϯςφ୯ҐͰमਖ਼௥Ճ͕Մೳ
    मਖ਼ɾ௥Ճͷ୯ҐΛখ͘͞ग़དྷΔɻ
    ىಈɾഇغ͕ߴ଎
    εέʔϧΞ΢τͷ଎౓޲্
    JNNVUBCMFJOGSBTUSVDUVSFͷ࣮ફʹద͍ͯ͠Δ
    ΞϓϦέʔγϣϯΛσϓϩΠ͢ΔΑ͏ͳײ֮ͰΠϯϑϥσϓϩΠ͕Ͱ͖Δɻ
    ϙʔλϏϦςΟ
    FUD

    View full-size slide

  9. 9
    WebServerΛίϯςφʹͯ͠ΈΑ͏ɻ
    9
    ՝୊ϕʔεͳΒίϯςφ͡Όͳͯ͘΋ղܾͰ͖Δ͚Ͳɺ
    ΑΓϕλʔͳੈքʹ࣋ͬͯߦ͚ͦ͏ɻ
    GBSHBUFͳΒ&$؅ཧෆཁ FDTPOFDͳΒىಈ଎౓
    ΑΓখ͘͞࡞ΕͯϙʔλϏϦςΟͷ͋Δੈք؍
    8FC4FSWFSͳΒେ͖ͳোน͸ͳ͍͸ͣ ͸ͣ

    ฏ੒࠷ SZ
    ίϯςφԽ

    View full-size slide

  10. 10
    ٕज़બఆ: EKS or ECS on EC2 or ECS on Fargate
    10
    ىಈ଎౓΍୯७ͳՁ֨໘Ͱ͸&$PO&$4 4QPPU'MFFU
    ͷํ͕༏Ґ͚ͩͲʜ
    νʔϜͷ؅ঠྖҬ͕޿͍ͷͰɺͳΔ΂͘ӡ༻؅ཧ͢ΔίετΛݮΒ͍͖͍ͯͨ͠ɻ
    'BSHBUF͕ཧ૝త
    ࠓ࣌఺Ͱ͸&,4ΑΓ&$4ͷํ͕ӡ༻ɾ"84಺ͷผίϯϙʔωϯτͱͷ࿈ܞ͕ॆ࣮͍ͯ͠Δɻ
    LVCFSOFUFT΋ັྗత͚ͩͲɺ%BUB1MBOFͷNBOBHFE͖ͯɺ৭ʑރΕ͖ͯͨΒʜ

    View full-size slide

  11. 11
    Ͳ͏ઃܭ͍ͯ͜͠͏ʁ
    11
    ίϯςφԽͷϝϦοτΛڗड͠΍͍͢ߏ੒ΛzͰ͖Δ͚ͩz࠾Δ֤छϕετϓϥΫςΟεͷ࣮ફ
    5XFMWFGBDUPS"QQ
    Ϟμϯͳ8FCΞϓϦέʔγϣϯΛ࣮ݱ͢ΔϕετϓϥςΫΟε
    ίϯςφʹݶΒͳ͍ॏཁͳઃܭࢦ਑ɻ
    %PDLFS#FTU1SBDUJDF
    ίϯςφຖʹ̍ͭͷϓϩηε͚࣮ͩߦ ͳΔ΂͘খ͘͞

    ίϯςφ͸ΤϑΣϝϥϧ ୹໋
    Ͱ͋Δ΂͖ ഇغՄೳͰ͋Δ͜ͱ

    ΠϝʔδϨΠϠΛ࠷খʹɺෆཁͳ΋ͷΛஔ͔ͳ͍ɺFUDʜ

    View full-size slide

  12. 12
    ίϯςφߏ੒
    12
    جຊ̍ϓϩηε̍ίϯςφ EPDLFSCFTUQSBDUJDF

    ֤ίϯςφͷ੹຿ͱαΠζΛখ͘͞ɻ
    BMQJOFͳͲܰྔͳ*NBHFͷར༻ɺඞཁ࠷௿ݶ͔͠ೖΕͳ͍ɻ
    ͋͘·Ͱجຊํ਑ɺ෼཭͕ผͷ໰୊ΛੜΉ৔߹͸ڐ༰ɻ
    ίϯςφཻ౓ʹσϓϩΠཻ౓
    ҰͭҰͭͷίϯςφͷϏϧυ଎౓΍ϦϦʔε୯ҐΛখ͘͞ɻ
    ؂ࢹɾ෼ੳ౳ͷػೳཁ݅ʹඞཁͳϓϩηεΛαΠυΧʔԽ
    'BSHBUFͷڞ༗ϘϦϡʔϜ ্ݶ(#
    Λར༻
    (#ͪΐͱͭΒ͍ͷͰϩʔςʔτ౳ߟྀཁɻ
    ݱ࣌఺Ͱ༰ྔؔ࿈ͷϝτϦΫε͕औΕͳ͍ͷ΋ͭΒΈɻ
    ͜ͷ-BZFS͔Β͜ͷ੹຿ΛऔΓ֎ͤΔͱঘྑ͍

    View full-size slide

  13. 13
    ϙʔλϏϦςΟ
    13
    ֎෦Ϧιʔεͱͷ઀߹ͳͲͷઃఆΛ؀ڥม਺Ͱ஫ೖ
    5XFMWF'BDUPS"QQ***ͷ࣮ફ
    ϙʔλϏϦςΟηΩϡϦςΟΛอͭɻ
    &$'BSHBUFىಈλΠϓͱ΋ʹɺ"841BSBNFUFS4UPSFͷىಈ࣌ಡΈࠐΈΛαϙʔτɻ
    ΞϓϦέʔγϣϯଆͰಛʹ෮߸ɾ؀ڥม਺ͷઃఆͳͲΛҙࣝͤͣɺ؀ڥม਺ͷಡΈࠐΈ͕Մೳ
    σϓϩΠ΋؆୯ͰɺUBTLEFpOJUJPOͷઃఆʹߦॻ͚ͩ͘ɻ όʔδϣϯࢦఆͰ͖Δͱঘخ͍͠
    ŧŽ

    View full-size slide

  14. 14
    σϓϩΠύΠϓϥΠϯ
    14
    $IBU"QQ$PEF#VJME$PEF%FQMPZ#MVF(SFFO
    ಺෦తʹ͸-#ͷUBSHFU(SPVQͷ੾Γସ͑
    DPEF%FQMPZͷఏڙػೳͳͷͰɺ؆୯ͳઃఆͰ
    ࣮ݱՄೳ
    σϓϩΠ࣌ͷWFSTJPOࠞࡏΛආ͚ΒΕΔ
    HSFFOอ࣋ظؒʢ෼dઃఆՄೳ
    ͸੾Γ໭͕͠ߴ଎ɻ
    σϓϩΠࣗମ͸ֻ͕͔͍࣌ؒͬͯΔҹ৅
    DPEF$PNNJU DPEF1JQF-JOF࿈ܞͰϦϦʔεࣗಈ
    Խ΋Մೳɻ

    View full-size slide

  15. 15
    εέʔϥϏϦςΟ
    15
    $MPVE8BUDI"MBSNΛ࢖ͬͨDQVVUJMJ[BUJPOͷ஋ϕʔεͰࣗಈεέʔϧΞ΢τεέʔϧΠϯ
    w ͦͷ࣌఺ͷෛՙʹଈͯ͠ඞཁͳྔͷϦιʔεΛద੾ʹ׆༻Ͱ͖Δ
    w ෳ਺ϧʔϧΛ૊Έ߹Θͤͯɺෛՙͷ্ঢ෯ʹԠͯ͡૿ݮΛίϯτϩʔϧɻ
    w GBSHBUFىಈ଎౓΍ΦʔτεέʔϧͷDPPM%PXO ධՁִؒͳͲɺ୹ظͷมಈʹର͢Δݶք͸͋Δɻ
    ͋Δ࣌ؒଳʹ͓͚ΔTask਺ભҠ
    +

    View full-size slide

  16. 16
    ؂ࢹ&ϩΪϯά
    16
    TTI໰୊
    جຊతʹTTI͠ͳ͍ͰࡁΉΑ͏ʹ੔උ͢Δ
    ϩάपΓ͸ՄೳͳݶΓTUEPVU TUEFSSΛ࢖͏
    EFGBVMUͷBXTMPHTܦ༝ͰDMPVE8BUDIʹసૹ
    ೉͍͠΋ͷ͸EBUBEPHʹసૹ
    ؂ࢹϞχλϦϯά͸%BUBEPH
    DQV NFNPSZ BMCMBUFODZ BMC@UBSHFU@YY YY౳
    ͜ΕͰ΋μϝͳ͕࣌དྷͨΒߟ͑Δɻ

    View full-size slide

  17. 17
    dockerImageͷܰྔԽ
    17
    ΞϓϦέʔγϣϯίϯςφͷEPDLFS*NBHFʹը૾΋ؚ·Ε͍ͯΔɻ
    EPDLFS*NBHF͸͍ܰʹͨ͜͠ࣄ͸ͳ͍ɻ
    QVTI QVMM଎౓޲্σϓϩΠɺىಈ଎౓ εέʔϧΞ΢τͷ൓
    ө଎౓

    ΞϓϦέʔγϣϯαʔόʔ഑Լʹͦ΋ͦ΋͍Δඞཁ͕ͳ͍ɻ
    ը૾ϦιʔεΛ$MPVE'SPOU4ʹϗεςΟϯάͯ͠ɺͦ΋ͦ΋
    *NBHF͔Β֎͢ɻ

    View full-size slide

  18. 18
    ϩάసૹΛίϯςφ੹຿͔ΒऔΓ֎͢
    18
    DMPVE8BUDI,JOFTJT'JSF)PSTFMBNCEB
    1SPT
    ίϯςφ͸ૹ৴Λߟ͑ͣඪ४ग़ྗʹు͚ͩ͘ͰΑ͘ͳΔ
    ڞ༗ϘϦϡʔϜ͔Βͷղ์ɻ
    ϩάૹ৴ͷؔ৺͝ͱमਖ਼Λίϯςφͷ੹຿͔ΒऔΓআ͚Δ
    $POT
    MBNCEB pSFIPSTFͷίετ͸૿͑Δ
    ো֐఺ͷௐ͕ࠪ൥ࡶʹͳΒͳ͍͔ɺMBUFODZ໘ͳͲݕূத
    GBSHBUFͷϩάυϥΠόʔʹqVFOU͕௥Ճ͞ΕΔͷͰɺෆཁʹͳΔ͔΋

    View full-size slide

  19. 19
    ·ͱΊ
    19
    'BSHBUFͱίϯςφྑ͍΋ͷ
    ΠϯϑϥೖΕସ͑࡞ۀͱΠϯελϯε؅ཧ͔Βͷղ์ɻ
    Ϋϥελ؅ཧͱ޲͖߹Θͳ͍ͷͰΦʔτεέʔϧָɻ
    &$4PO&$ͱൺ΂ͨݱ࣌఺Ͱͷػೳ໘ͷ੍໿ɺىಈ଎౓ɺՁ֨໘Ͱෆརͳࣄ͸ఱṝɻ
    Ձ֨໘Ͱ͸΍͸Γ&$ΑΓ΍΍ׂߴɻ3*ʜ ŧŽ
    ໾ׂผʹίϯςφʹ੾Γग़ͨ͠ࣄͰɺҰͭҰͭͷίϯςφʹର͢Δमਖ਼͸খ͘͞༰қʹͳͬͨɻ
    ίϯςφۜͷ஄ؙͰ͸ͳ͍ɻ
    ϝϦοτΛ׆͔ͤΔܗʹγεςϜͷߏ੒ΞϓϦέʔγϣϯΛม͍͑ͯ͘ඞཁ͸͋Δɻ
    5XFMWF'BDUPS"QQ͸ྑ͍ࢦඪɻ ͍͖ͳΓશ෦͸ແཧͰ΋

    View full-size slide

  20. 20
    WE ARE HIRING :)
    20
    ໌Δ͍৬৔Ͱ͢ɻ
    ίϯςφԽʹݶΒͣϏδωεΛࢧ͑ɺՃ଎ͤ͞Δҝͷ৽͍͠௅ઓɺ౤ࢿ͸ৗʹܧଓͯ͠·͢
    ΧδϡΞϧ໘ஊ΋΍͍ͬͯ·͢ͷͰɺ͓ؾܰʹ

    IUUQTXXXXBOUFEMZDPNDPNQBOJFTFVSFLB

    View full-size slide

  21. CONFIDENTIAL INFORMATION: Not for Public Distribution - Do Not Copy
    CONFIDENTIAL INFORMATION: Not for Public Distribution - Do Not Copy
    5IBOLZPV

    View full-size slide