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

CI/CD/インフラ勉強会Vol4 Amazon ECS編 Part1

CI/CD/インフラ勉強会Vol4 Amazon ECS編 Part1

Amazon ECS回です。あまりにやること多いので二つに分けました。
今回は仮想化のおさらいをしてからECSのはじめだけ。

91f47c6a88734f521567938d2436b614?s=128

Shohei Kobayashi

June 26, 2022
Tweet

More Decks by Shohei Kobayashi

Other Decks in Programming

Transcript

  1. "NB[PO&$4ฤ1BSU &MBTUJD$POUBJOFS4FSWJDFͱ'BSHBUF ۽Ͱ΋Θ͔Δ$*$%ϞμϯΠϯϑϥ

  2. զ ΤϯδχΞྺɿ೥͘Β͍ ۀքɿ8FC͹͔ͬ ݴޠɿ3VCZͱ3BJMT೥ 1)11ZUIPO1FSM೥͘Β͍ʢ๨Ε͕ͪʣ Πϯϑϥ΍͖ͬͯͨྺʹΤϯδχΞྺ %/4αʔόͱ͔ϝʔϧαʔό࡞ͬͯ·ͨ͠ ࠷ۙ͸΋ͬͺΒ3BJMT࢖͍ͷϑϦʔϥϯεɻ ޷͖ͳ%/4αʔόͷϛυϧ΢ΣΞɿEKCEOT ޷͖ͳϝʔϧαʔόͷϛυϧ΢ΣΞɿ2NBJM

    ޷͖ͳ.Z42-ͷίϚϯυ͸TIPXTMBWFTUBUVT ޷͖ͳ"84ϓϩμΫτ͸&MBTUJD.BQ3FEVDF ޷͖ͳ($1ϓϩμΫτ͸$MPVESVO ޷͖ͳ$*$%πʔϧ͸(JUIVC"DUJPO &$4׬ᘳʹཧղͨ͠ কདྷͷເ͸ηΩϡϦςΟΤϯδχΞɻ
  3. $JSDMF$*͸͍͍ͧʂʂʂʂ

  4. લճ·Ͱͷ͓͞Β͍

  5. $*Ͱ΍Διʔείʔυద༻ϑϩʔجຊ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB ։ൃ͸ࣗಈɾຊ൪͸࠷ऴεςοϓͷΈखಈ όοΫΤϯυ ։ൃऀͷϩʔΧϧ ୯ମςετ ݁߹ςετ Ϗϧυ

    σϓϩΠ४උ σϓϩΠ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB όοΫΤϯυ %FWFMPQNFOU 1SPEVDUJPO ։ൃ؀ڥ͸NBJOʹQVTIͱಉ࣌ʹσϓϩΠ·Ͱߦ͏ ຊ൪؀ڥ͸खಈͰσϓϩΠͷΈߦ͏ σϓϩΠ ୯ମςετ ݁߹ςετ Ϗϧυ σϓϩΠ४උ
  6. $*Ͱ΍Δϑϩʔجຊͦͷ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS σϓϩΠͰߦ͏͜ͱ όοΫΤϯυ ։ൃऀͷϩʔΧϧ ୯ମςετ ݁߹ςετ Ϗϧυ σϓϩΠ४උ

    σϓϩΠ "NB[PO&MBTUJD$POUBJOFS3FHJTUPSZ &$44FSWJDF5BTLVQEBUF &$45BTL%F fi OJUJPOVQEBUF NJHSBUJPO &$4ͷઃఆΛมߋ͢ΔͷͰ "84$%,΍5FSSBGPSNͰ ߦ͏͜ͱ͕ଟ͍Ͱ͢
  7. (JUIVC"DUJPO "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB ͦΕͧΕͷεςοϓΛZBNMϑΝΠϧͰఆ͍ٛͯ͘͠ όοΫΤϯυ ։ൃऀͷϩʔΧϧ ୯ମςετ ݁߹ςετ Ϗϧυ

    σϓϩΠ४උ σϓϩΠ UFTUZBNM MJOUZBNM CSBLFNBOZBNM EFQMPZZBNM CVJMEZBNM YAML YAML YAML YAML YAML
  8. "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB 4ZTUFN.BOBHFS4FDSFU.BOBHFS όοΫΤϯυ ։ൃऀͷϩʔΧϧ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB όοΫΤϯυ

    %FWFMPQNFOU 1SPEVDUJPO EFWUT QSPEUT σϓϩΠ४උػີ৘ใΛ؀ڥ෼༻ҙ ։ൃ༻ػີ৘ใ ຊ൪༻ػີ৘ใ
  9. "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB ΞϓϦέʔγϣϯଆ͸؀ڥม਺ͰಡΈࠐΉΑ͏ʹ͓ͯ͘͠ όοΫΤϯυ ։ൃऀͷϩʔΧϧ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB όοΫΤϯυ

    %FWFMPQNFOU 1SPEVDUJPO EFWUT QSPEUT σϓϩΠ४උΞϓϦ಺ͷඞཁͳ৘ใ͸؀ڥม਺Ͱ ։ൃ༻ػີ৘ใ ຊ൪༻ػີ৘ใ
  10. σϓϩΠ४උ"84$%,ͰجຊϦιʔεΛ࡞੒ ίʔυͰ"84ϦιʔεΛఆٛɻඞཁͳϦιʔεΛ࡞͓ͬͯ͘ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB "NB[PO$MPVE'SPOU ϑϩϯτΤϯυ όοΫΤϯυ "NB[PO4 ։ൃऀͷϩʔΧϧ

    cdk deploy WQDTUBDLUT SETTUBDLUT 5ZQF4DSJQUΛ $MPVE'PSNBUJPOͷελοΫʹม׵ Ϧιʔεఆٛʂ CloudFormation ֤छϦιʔε࡞੒ AWS Local
  11. σϓϩΠ४උ(JUIVC"DUJPOͰఆٛ EPDLFSίϚϯυҰࣜ·Ͱߦ͍ɺ"84ͷDPOUBJOFS3FHJTUPSZʹQVTI·ͰΛ΍͓ͬͯ͘ ։ൃऀͷϩʔΧϧ ୯ମςετ ݁߹ςετ Ϗϧυ σϓϩΠ४උ EPDLFSCVJME EPDLFSUBH EPDLFSQVTI

    EPDLFSCVJME EPDLFSUBH EPDLFSQVTI "NB[PO&MBTUJD$POUBJOFS3FHJTUPSZ
  12. σϓϩΠ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS DELEFQMPZίϚϯυ όοΫΤϯυ ։ൃऀͷϩʔΧϧ ୯ମςετ ݁߹ςετ Ϗϧυ σϓϩΠ४උ

    σϓϩΠ "NB[PO&MBTUJD$POUBJOFS3FHJTUPSZ &$44FSWJDF5BTLVQEBUF &$45BTL%F fi OJUJPOVQEBUF NJHSBUJPO DELEFQMPZ<ελοΫ໊>
  13. ࠓ೔΍Δ͜ͱ

  14. Amazon ECS "QQMJDBUJPO-PBE#BMBODFS 3%4"VSPSB "NB[PO$MPVE'SPOU ϑϩϯτΤϯυ όοΫΤϯυ "NB[PO4 ։ൃऀͷϩʔΧϧ ୯ମςετ

    ݁߹ςετ Ϗϧυ σϓϩΠ४උ σϓϩΠ
  15. "NB[PO&$4

  16. &$4͸ίϯςφ࣮ߦ؀ڥ ίϯςφԽ͞ΕͨΞϓϦέʔγϣϯΛಈ͔ͨ͢Ίͷ؀ڥҰࣜΛݴ͏ɻ Amazon Elastic Container Registory Amazon Elastic Container Service

    ECS Compute Option AWS Fargate AWS LocalZones AWS WaveLength AWS Outposts
  17. ༧උ஌ࣝɿίϯςφʹ͍ͭͯ

  18. Ծ૝Խͱ͸ Ұ୆ͷ෺ཧ04্Ͱෳ਺ͷ04Λಈ͔͢ख๏ɻ ෺ཧϚγϯ 04 (VFTU04 (VFTU04 (VFTU04 "QQ "QQ "QQ

    ෺ཧతʹ͸Ұ୆ͷ෺ཧϚγϯ͕ͩɺ ͦͷ্Ͱ͸ࡾͭͷ04͕ىಈ͍ͯ͠Δ
  19. αʔόԾ૝ԽͱίϯςφԾ૝Խ Ͳͬͪ΋Ұ୆ͷ෺ཧαʔόͷ্Ͱࡾ୆ͷԾ૝αʔό͕ಈ͍͍ͯΔ ෺ཧϚγϯ 04 (VFTU04 (VFTU04 (VFTU04 #JO-JCT #JO-JCT #JO-JCT

    )ZQFSWJTFS ෺ཧϚγϯ 04 #JO-JCT #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ "QQ "QQ "QQ "QQ ,FSOFM ,FSOFM ,FSOFM ,FSOFM ,FSOFM
  20. ߟ͑ํͷҧ͍ Ϧιʔεͦͷ΋ͷΛԾ૝Խ͢ΔϋΠύʔόΠβʔܕͱɺΞϓϦέʔγϣϯͷശΛ༻ҙ͢ΔΠϝʔδͷίϯςφܕ ϋΠύʔόΠβʔܕ ίϯςφܕ ෺ཧϚγϯ 04 (VFTU04 (VFTU04 (VFTU04 #JO-JCT

    #JO-JCT #JO-JCT )ZQFSWJTFS ෺ཧϚγϯ 04 #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ "QQ "QQ "QQ ,FSOFM ,FSOFM ,FSOFM ,FSOFM ,FSOFM #JO-JCT "QQ
  21. "NB[PO&$ &$͸ϋΠύʔόΠβʔܕ ϋΠύʔόΠβʔܕ ίϯςφܕ ෺ཧϚγϯ 04 (VFTU04 (VFTU04 (VFTU04 #JO-JCT

    #JO-JCT #JO-JCT )ZQFSWJTFS ෺ཧϚγϯ 04 #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ "QQ "QQ "QQ ,FSOFM ,FSOFM ,FSOFM ,FSOFM ,FSOFM
  22. "NB[PO&$4 &$4͸ίϯςφܕ ϋΠύʔόΠβʔܕ ίϯςφܕ ෺ཧϚγϯ 04 (VFTU04 (VFTU04 (VFTU04 #JO-JCT

    #JO-JCT #JO-JCT )ZQFSWJTFS ෺ཧϚγϯ 04 #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ "QQ "QQ "QQ ,FSOFM ,FSOFM ,FSOFM ,FSOFM ,FSOFM
  23. ίϯςφͷҠ২ੑʹ͍ͭͯ ίϯςφ͸Ծ૝Խͷ୯Ґ͕খ͘͞ɺΠϝʔδԽͯ͠ผͷ04΁ͷҠߦ΍ෳ੡ָ͕ ෺ཧϚγϯ 04 #JO-JCT #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ

    "QQ ෺ཧϚγϯ 04 %PDLFS&OHJOF "QQ"ίϯςφ #JO-JCT "QQ "QQ"ίϯςφ "QQ"Πϝʔδ "QQ#Πϝʔδ "QQ$Πϝʔδ ίϯςφϦϙδτϦ
  24. ίϯςφͷҠ২ੑʹ͍ͭͯ ΠϝʔδΛ؅ཧ͢Δ࢓૊ΈΛίϯςφϦϙδτϦͱ͍͏ ෺ཧϚγϯ 04 #JO-JCT #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ

    "QQ ෺ཧϚγϯ 04 %PDLFS&OHJOF "QQ"ίϯςφ "QQ"Πϝʔδ #JO-JCT "QQ "QQ"ίϯςφ "QQ#Πϝʔδ "QQ$Πϝʔδ ίϯςφϦϙδτϦ
  25. ίϯςφͷҠ২ੑʹ͍ͭͯ ίϯςφΠϝʔδͷ΍ΓͱΓΛQVTIQVMMͱ͍͏ ෺ཧϚγϯ 04 #JO-JCT #JO-JCT #JO-JCT %PDLFS&OHJOF "QQ "QQ

    "QQ ෺ཧϚγϯ 04 %PDLFS&OHJOF "QQ"ίϯςφ #JO-JCT "QQ "QQ"ίϯςφ "QQ"Πϝʔδ "QQ#Πϝʔδ "QQ$Πϝʔδ ίϯςφϦϙδτϦ EPDLFSQVMM EPDLFSQVTI
  26. "NB[PO&$4 ͋ΒͨΊͯ

  27. &$4͸ίϯςφ࣮ߦ؀ڥ ίϯςφΛ࣮ߦ͢ΔͨΊͷػೳ͕Ұࣜἧ͍ͬͯΔ Amazon Elastic Container Registory Amazon Elastic Container Service

    ECS Compute Option AWS Fargate AWS LocalZones AWS WaveLength AWS Outposts
  28. &$3͸ΠϝʔδΛ؅ཧ͢ΔίϯςφϦϙδτϦ "84ͷ࢓૊ΈʹίϯςφΛ഑Δࡍ͸େମ&$3Λར༻͢Δɻ Amazon Elastic Container Registory Amazon Elastic

  29. &$4͸ίϯςφ࣮ߦ؀ڥɿ1BSU &$4Λ࢖ͬͯίϯςφΛىಈ͢Δʹ͸5BTL%F fi OJUJPOΛॻ͘ඞཁ͕͋Δɻ %PDLFS fi MFͱ͸·ͨҧ͏ఆٛΛ৭ʑ͢Δඞཁ͕͋Δ Amazon Elastic Container

    Registory Amazon Elastic Container Service ECS Compute Option AWS Fargate AWS LocalZones AWS WaveLength AWS Outposts 5BTL%F fi OJUJPO 5BTL%F fi OJUJPO 5BTL%F fi OJUJPO
  30. &$4͸ίϯςφ࣮ߦ؀ڥɿ1BSU &$4Λ࢖ͬͯίϯςφΛىಈ͢Δʹ͸5BTL%F fi OJUJPOΛॻ͘ඞཁ͕͋Δɻ %PDLFS fi MFͱ͸·ͨҧ͏ఆٛΛ৭ʑ͢Δඞཁ͕͋Δ Amazon Elastic Container

    Registory Amazon Elastic Container Service ECS Compute Option AWS Fargate AWS LocalZones AWS WaveLength AWS Outposts 5BTL%F fi OJUJPO 5BTL%F fi OJUJPO 5BTL%F fi OJUJPO
  31. 5BTL%F fi OJUJPOʹॻ͘͜ͱ "NB[PO&$4 "QQMJDBUJPO-PBE#BMBODFS "84ͷઃఆͷఆٛΛ৭ʑهड़͢Δඞཁ͕͋Δɻ όοΫΤϯυ "NB[PO&MBTUJD$POUBJOFS3FHJTUPSZ w ىಈλΠϓ

    w λεΫఆ໊ٛ w λεΫϩʔϧʢίϯςφΛ࣮ߦ͢Δ*".ϩʔϧ w ωοτϫʔΫϞʔυʢ71$ͱ͔બͿʣ w 04ϑΝϛϦʔʢ8JOEPXT-JOVYʣ w λεΫͷαΠζʢίϯςφͷϦιʔε$16ͱ͔ϝϞϦͱ͔ʣ w ίϯςφ໊ w ίϯςφͷΠϝʔδ໊ w ϙʔτϚοϐϯά w ͦͷଞίϯςφͷઃఆ ଞʹ΋͍Ζ͍Ζ
  32. &$4͸ίϯςφىಈλΠϓ &$ܕͱ'BSHBUFܕ͕͋Γɺϓϥεͦͷଞతѻ͍Ͱ͍͔ͭ͋͘Δɻ ECS Compute Option AWS Fargate AWS LocalZones AWS

    WaveLength AWS Outposts EC2
  33. &$4͸ίϯςφىಈλΠϓ1BSU ىಈλΠϓΛܾΊͨΒɺ࣍͸ͲͪΒͰىಈ͢Δ͔Λܾఆ͢Δɻ ECS Compute Option AWS Fargate AWS LocalZones AWS

    WaveLength AWS Outposts EC2 ECS Service ECS Task
  34. ࠓ೔ͷ·ͱΊ

  35. ·ͱΊ Ծ૝Խʹ͍ͭͯ  ෺ཧతͳίϯϐϡʔλϦιʔεͷ্ʹԾ૝తʹෳ਺ͷϚγϯΛ࡞੒͢Δػೳ  ϋΠύʔόΠβʔܕ͸෺ཧϦιʔεΛ෼͚ΔʢΧʔωϧ͝ͱ෼ׂʣ  ίϯςφܕ͸ΞϓϦέʔγϣϯͷശΛͭ͘ΔʢΧʔωϧ͸ڞ༗ʣ  ίϯςφܕ͸Πϝʔδͱ͍͏୯ҐͰ࣋ͪӡͼͰ͖Δ

     ίϯςφΠϝʔδΛ؅ཧ͢Δ࢓૊ΈΛϦϙδτϦͱ͍͏ &$4  5BTL%F fi OJUJPOͰ"84ͷઃఆΛ͍Ζ͍Ζ͢Δ  ىಈλΠϓ͸'BSHBUF&$ͦͷଞ͍͔ͭ͋͘Δ  ࣮ߦλΠϓ͸&$44FSWJDFܕͱ&$45BTLܕ͕͋Δɻ
  36. ࣍ճ &$4ͷىಈλΠϓͱ࣮ߦܕʹ͍ͭͯઆ໌͢ΔΑ ECS Compute Option AWS Fargate AWS LocalZones AWS

    WaveLength AWS Outposts EC2 ECS Service ECS Task