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

Terraformを使ったAWS環境作成の効率化

 Terraformを使ったAWS環境作成の効率化

Lancers Night 2017/03/07

291429be59bd97d8a3c21c17c55c7a22?s=128

takayuki.hiratsuka

March 09, 2017
Tweet

Transcript

  1. 5FSSBGPSNΛ࢖ͬͨ "84؀ڥ࡞੒ͷޮ཰Խ

  2. ฏ௩و೭ ࣗݾ঺հ ˝ೖࣾ࣌ظ  ˝ۀ຿಺༰ ɾϥϯαʔζͷӡ༻ ɾ։ൃ؀ڥࢧԉ ɾ৽نαʔϏεͷΠϯϑϥߏங ˝झຯ ɾ௼Γ

    ϒϥοΫόε  ɾεϊϘ ɾΞχϝ 4"0 3Fθϩ FUD  ΠϯϑϥΤϯδχΞ
  3. ɾ5FSSBGPSNͱ͸  ɾͳͥ5FSSBGPSN  ɾ5FSSBGPSNͷ࢖͍ํ ɾ5FSSBGPSNΛͲ͏࢖͍ͬͯΔ͔ʁ ɾ5FSSBGPSN "OTJCMF %FQMPZ 4FSWFSTQFD

    ΞδΣϯμ
  4. ɾͲ͕͜࡞ͬͨʁ ɾԿ͕Ͱ͖Δͷʁ 5FSSBGPSNͱ͸

  5. Ͳ͕͜࡞ͬͨʁ

  6. ɾ*OGSBTUSVDUVSFBT$PEF ɾ&YFDVUJPO1MBOT ɾ3FTPVSDF(SBQI ɾ$IBOHF"VUPNBUJPO Կ͕Ͱ͖Δͷʁ

  7. ࣗಈԽɺόʔδϣϯ؅ཧɺςετɺܧଓతΠϯ ςάϨʔγϣϯͱ͍ͬͨɺιϑτ΢ΣΞ։ൃͷ ख๏ΛγεςϜ؅ཧʹԠ༻͢ΔͨΊͷํ๏࿦ɻ ίʔυͰΠϯϑϥΛ࡞੒͠ɺͦͷίʔυΛόʔδϣϯ؅ཧ *OGSBTUSVDUVSFBT$PEF

  8. "WBJMBCMF1SPWJEFST

  9. ɾ$IFG"OTJCMF1VQQFUͱͷॅΈ෼͚ ɾ$MPVE'PSNBUJPO͡ΌͩΊʁ ɾ۩ମతʹ"84ͷԿΛίʔυԽͰ͖Δͷʁ ɾಋೖલͱಋೖޙ ͳͥ5FSSBGPSN

  10. .8 04 ج൫ "84$MPVE'PSNBUJPO (PPHMF$MPVE %FQMPZNFOU.BOBHFS $IFG"OTJCMF1VQQFUͱͷॅΈ෼͚

  11. ˞ ˞1MVHJOͱͯ͠ఏڙ 1SPWJEFST

  12. ۩ମతʹ"84ͷԿΛίʔυԽͰ͖Δͷʁ

  13. None
  14. ಋೖલͱಋೖޙ $SFBUF/BU(BUFXBZBOE3PVUJOH

  15. /BU(BUFXBZBUUBDI&*1 SFTPVSDFBXT@FJQ/"5$\ WQDUSVF ^ /BU(BUFXBZ SFTPVSDFBXT@OBU@HBUFXBZ1SJWBUF$\ BMMPDBUJPO@JE\BXT@FJQ/"5$JE^ TVCOFU@JE\BXT@TVCOFUD1SJWBUF1VCMJDJE^ ^ SFTPVSDFBXT@SPVUF@UBCMFD1SJWBUF/"5\

    WQD@JE\BXT@WQD1SJWBUFJE^ SPVUF\ DJES@CMPDL ^ SPVUF\ DJES@CMPDL OBU@HBUFXBZ@JE\BXT@OBU@HBUFXBZ1SJWBUF$JE^ ^ UBHT\ /BNFD1SJWBUF/"5 ^ ^ &*1֬อ /BU(BUFXBZ࡞੒ 3PVUJOH࡞੒ $SFBUF/BU(BUFXBZBOE3PVUJOH
  16. ɾߏจʹ͍ͭͯ ɾ࣮ࡍͷίʔυΛݟͯΈΔ 71$ฤ  ɾ࣮ࡍͷίʔυΛݟͯΈΔ 4ฤ  ɾ؀ڥઃఆϑΝΠϧͷ࡞੒ ɾ࣮ߦํ๏ ɾUGTUBUFϑΝΠϧʹ͍ͭͯ

    5FSSBGPSNͷ࢖͍ํ
  17. )$- )BTIJ$PSQ$POpHVSBUJPO-BOHVBHF  ‘’HCL is also fully JSON compatible. That

    is, JSON can be used as completely valid input to a system expecting HCL. This helps makes systems interoperable with other systems.‘’ https://github.com/hashicorp/hcl +40/
  18. "O".* WBSJ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JTQFDMJCFDUDPN   $POEJUJPO\ *Q"EESFTT\ BXT4PVSDF*Q<  > ^ ^ ^ > ^ T@QPMJDJFTBQJTQFDKTPO TUG 4ʹόέοτΛ࡞੒͠ɺ ੩త΢ΣϒαΠτϗεςΟϯάΛ༗ޮʹ͢Δɻ
  22. None
  23. QSPWJEFSBXT\^ FYQPSU"84@"$$&44@,&:@*%BOBDDFTTLFZ FYQPSU"84@4&$3&5@"$$&44@,&:BTFDSFULFZ FYQPSU"84@%&'"6-5@3&(*0/BQOPSUIFBTU UFSSBGPSNQMBO UFSSBGPSNBQQMZ BXT@DPOpHUG QSPWJEFSBXT\ TIBSFE@DSFEFOUJBMT@pMFlIPHFBXTDSFEFOUJBMT QSPpMFQSPEVDUJPO

    ^ UFSSBGPSNQMBO UFSSBGPSNBQQMZ ࣮ߦίϚϯυ ؀ڥઃఆϑΝΠϧͷ࡞੒
  24. ᵋᴷᴷQSPEVDUJPO ᵓᴷᴷBXT@DPOpHUG ᵓᴷᴷDMPVEXBUDIUG ᵓᴷᴷJBNUG ᵓᴷᴷJBN@QPMJDJFT ᴹᵓᴷᴷCJMMJOHKTPO ᴹᵋᴷᴷJOTUBODF@SPMF@QPMJDZKTPO ᵓᴷᴷJHXUG ᵓᴷᴷOBUUG ᵓᴷᴷSETUG

    ᵓᴷᴷSPVUJOHUG ᵓᴷᴷTUG ᵓᴷᴷT@QPMJDJFT ᴹᵋᴷᴷBQJTQFDKTPO ᵓᴷᴷTFDVSJUZHSPVQUG ᵓᴷᴷTVCOFUHSPVQUG ᵋᴷᴷWQDUG σΟϨΫτϦߏ੒ ؀ڥઃఆϑΝΠϧ UGϑΝΠϧ
  25. ࣮ߦํ๏ ߏจνΣοΫ UFSSBGPSNWBMJEBUF %SZSVO UFSSBGPSNQMBO ࣮ߦ UFSSBGPSNBQQMZ

  26. None
  27. UFSSBGPSNQMBOͰΤϥʔ͕ͳ͘ͱ΋BQQMZͰΤϥʔʹͳΔέʔε͕͋Δɻ ɾ".* 17 )7. ʹରͯ͠બ୒ෆՄͳΠϯελϯελΠϓΛࢦఆͨ͠৔߹ɻ ɾطʹଘࡏ͢Δ4όέοτΛ࡞੒͢Δ৔߹ɻ ౳ʑʜ

  28. ˝UFSSBGPSNUGTUBUFϑΝΠϧͱ͸ʁ UFSSBGPSNͰ࡞੒ͨ͠؀ڥͷߏ੒৘ใΛه࿥ͨ͠ϑΝΠϧͰ+40/Ͱ هࡌ͞Ε͍ͯΔɻ ˝͍ͭ࡞Δʁ BQQMZ࣮ߦ࣌ʹࣗಈ࡞੒͞ΕΔɻ ˝ͳͥඞཁʁ ࡞੒ͨ͠UGϑΝΠϧͱͷࠩ෼Λݕग़͠ɺࠩ෼͕͋Ε͹BQQMZ࣮ߦ࣌ʹϦ ιʔε࡞੒࡟আߋ৽Λߦ͏ɻ ࣄલʹQMBOͰ֬ೝ͸Ͱ͖·͢ɻ 

    ˝ةݥੑ νʔϜͰUFSSBGPSN HJUIVC౳Ͱ؅ཧ͍ͯ͠Δ৔߹͸ίϯϑϦΫτ͕ ൃੜ͢Δͱഁյతঢ়گʹؕΔɻ UGTUBUFϑΝΠϧʹ͍ͭͯ
  29. ɾUFSSBGPSNTUBUFϑΝΠϧͷѻ͍ ɾίʔυ؅ཧํ๏ ɾ͋͑ͯUFSSBGPSN؅ཧ͠ͳ͔ͬͨ΋ͷ 5FSSBGPSNΛͲ͏࢖͍ͬͯΔ͔ʁ

  30. Amazon S3 UFSSBGPSNSFNPUFDPOpHa CBDLFOETa CBDLFOEDPOpHCVDLFUUFSSBGPSNTUBUFQSPEa CBDLFOEDPOpHLFZOFUXPSLUFSSBGPSNUGTUBUFa CBDLFOEDPOpHSFHJPOVTFBTU ʲ4Ͱ؅ཧͯ͠ΈΔʳ ʲߋ৽औಘʳ UFSSBGPSNSFNPUFQVTI

    UFSSBGPSNSFNPUFQVMM UFSSBGPSNUGTUBUFͷ؅ཧ͸͜ΕΒͷαʔϏεͰՄೳʂ
  31. Amazon S3 Amazon S3 U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