Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
after of Infrastructure-as-Code-is-very-tired
Search
shogomuranushi
July 31, 2019
Programming
16
3.3k
after of Infrastructure-as-Code-is-very-tired
shogomuranushi
July 31, 2019
Tweet
Share
More Decks by shogomuranushi
See All by shogomuranushi
ノーコード x ChatBotで遊んでたら ReActを実装しそうだった話
shogomuranushi
0
1.2k
ChatGPT関連情報の追い方、個人・業務での使い方、サービスへの組み込み方、 ABEJAでの取り組み4例、ここ2週間のトピックなど行けるところまで
shogomuranushi
5
1.9k
FPが教える iDeCo のすごさ
shogomuranushi
0
130
AWS Control Tower導入してハッピーになりました
shogomuranushi
0
230
EKS を使ってる人から見た App Runner
shogomuranushi
7
2.4k
Suggested Topicの質問に可能な限り答えてみた
shogomuranushi
0
1.1k
顧客のアプリケーションコードが動くマルチテナント環境における課題とEKSにたどり着くまで
shogomuranushi
0
1.6k
ちょいテク100本ノック。できるまで帰しません 。今から使えるちょいテク集
shogomuranushi
1
2.7k
what is Cloud Run?
shogomuranushi
2
110
Other Decks in Programming
See All in Programming
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
110
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.7k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
870
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
1
110
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
イベント駆動で成長して委員会
happymana
1
320
Jakarta EE meets AI
ivargrimstad
0
120
Featured
See All Featured
How to Ace a Technical Interview
jacobian
276
23k
Code Reviewing Like a Champion
maltzj
520
39k
Typedesign – Prime Four
hannesfritz
40
2.4k
Navigating Team Friction
lara
183
14k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
How STYLIGHT went responsive
nonsquared
95
5.2k
Teambox: Starting and Learning
jrom
133
8.8k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Agile that works and the tools we love
rasmusluckow
327
21k
Transcript
Infrastructure as CodeʹർΕͨͷͰ ͕ͨͪຊདྷΓ͔ͨͬͨ͜ͱΛཧ͢Δ +α X-Tech JAWS & JAWS-UGΞʔΩςΫνϟઐࢧ෦ ίϥϘษڧձ#02
Shogo Muranushi
Shogo Muranushi ABEJA, Inc. - ABEJA Platform Product Owner -
Site Reliability Engineer Tech Lead
None
None
None
None
ΞδΣϯμ • JAWS DaysͰͨ͠༰ͷ͓͞Β͍ • ͦͷޙʹ৭ʑͳਓͱͨ݁͠ • ͡Ό͋ɺԿ͔Β࢝ΊΔʁͦͷޙͷIaCͷτϨϯυ • αΫοͱͬͯϋϚΓͦ͏ͳ݅Λ·ͱΊΔ
• ·ͱΊ
JAWS DaysͰͨ͠༰ͷ͓͞Β͍ ʢ5όʔδϣϯʣ
ࠓͷͷঢ়ଶ ύτϥογϡͷֆΛ ૾͍ͯͩ͘͠͞
ຊηογϣϯͰͷ Infrastructure as Code ओʹAWSΛߏ ͢ΔͨΊͷπʔϧ܈Λࢦ͠·͢ɻ ղΛ͍࣋ͬͯΔΘ͚Ͱ͋Γ·ͤΜɻ ϕετͳҊ͍࣋ͬͯͳ͍ͷͰΈΜͳͰ͑Λग़͠·͠ΐ ͏ɻ ҙࣄ߲
• Chef: 1 • Ansible: 2 • CloudFormation: 2 •
Terraform: 3 ͷวྺ
None
• σΟϨΫτϦઃܭ • Environment Λ͚Δ • tfstate s3 backend
ʹ • Workspace ͷ׆༻ • Map ؔϑϧ׆༻ ৄղʂTerraform Best Practices in 2017
• σΟϨΫτϦઃܭ ӨڹൣғΛݶఆ͢ΔͨΊ not_immutableͱimmutableΛ͚Δ ࠶ར༻ੑΛߴΊΔͨΊɺϦιʔεmoduleԽ͢Δ
• EnvironmentΛ͚Δ WorkspaceΛ׆༻͠ɺڥΛ͚Δ ݺͼग़࣌͢ ${terraform.workspace}
• Map ؔϑϧ׆༻ ڥຖʹϦʔδϣϯΛม͑Δྫ υοτ۠ΓͰvariableΛఆٛ
• tfstate s3 backend ʹ
None
ৄղʂTerraform Best Practices in 2017
• ࣾһͷΦϯϘʔσΟϯάʹ͕͔͔࣌ؒΔ • ϲ݄ޙʹࣗͰ࡞Δ࣌ʹࢥ͍ग़͢ͷʹ͕͔͔࣌ؒΔ • ҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ ϕετϓϥΫςΟε͔͠Εͳ͍͚Ͳෳࡶ
• ApplyʹؾΛ͏ • Destroy/Create͠ͳ͍͔৻ॏʹͳΔ • ಈ࡞Λཧղ͍ͯ͠ͳ͍ਓʹ҆қʹ࡞ۀΛͤΒΕͳ͍ • ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ มߋͷࠩΛҡ࣋͢Δͷʹख͕͔͔ؒΔ
• TerraformɺCFnͷରԠΛͯͳ͍߹खͰΔʁ • ͱ͍͏͜ͱશ෦ΛίʔυԽग़དྷͳ͍ • ରԠޙʹࠩөΛ͠ͳ͖Όɻ݁ߏؾΛ͏ΑͶ • ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ ৽͍͠αʔϏεɾػೳʹରԠͯ͠ͳ͍͕࣌͋Δ
• ελʔτΞοϓͦΜͳʹਓ͕͍ͳ͔ͬͨ • ډͨͱͯ͠Value͋Δ։ൃΛͯ͠΄͍͠ ͭ·ΓɺҰఆͷεΩϧΛ͍࣋ͬͯΔਓ͕͍Δ
ΠΩϦظ ਃ͠༁͍͟͝·ͤΜɻෳࡶͰͨ͠
• ϩγΞਓʮDynamoDBͷTerraformͷίʔυΛ࡞ͬͯཉ ͍͠ʯ • ଜओʮΦοέʔʯ ͱ͋Δ
1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ 2. σΟϨΫτϦઃܭ 3. EnvironmentΛ͚Δ 1. s3 backend 4.
Workspaceͷ׆༻ 1. Mapؔϑϧ׆༻ Δ͜ͱ
1. ·ͣSampleΛͦͷ··࣮ߦ͢Δ
2. σΟϨΫτϦઃܭ ӨڹൣғΛݶఆ͢ΔͨΊ not_immutableͱimmutableΛ͚Δ ࠶ར༻ੑΛߴΊΔͨΊɺϦιʔεmoduleԽ͢Δ
3. EnvironmentΛ͚Δ WorkspaceΛ׆༻͠ɺڥΛ͚Δ ݺͼग़࣌͢ ${terraform.workspace}
4. tfstate s3 backend ʹ
5. tfstate s3 backend ʹ ڥຖʹϦʔδϣϯΛม͑Δྫ υοτ۠ΓͰvariableΛఆٛ
None
None
• 1ͿΓʹTerraformΛௐΔ • forจͰ͖ͳ͍ʁʂͯ͜ͱɾɾ • Μʁ0.12Ͱforจ͕͑Δͱͳ • 0.12ΛϏϧυ͢Δ͔ʁ͍ɺ·ͱʹಈ͔ͳ͍ͷ໘ͩͳ • ΜʁTerraform
Module Registryͱ͍͏ͷ͕͋ΔͧɻGithubʹ ίʔυ্͕͕ͬͯΔ • moduleͷࢀߟʹͤͯ͞Β͓͏ ͬͱΩϨΠʹॻ͚ͳ͍ͷ͔
Terraform Module Registry
Terraform Module Registry ৺ͷ ʮ͍ɺԶ͜Μͳࣄͯ͠Δ߹͡Όͳ͍ʯ
ͷׂ Πϯϑϥ ୲ऀ Πϯϑϥ ऀ ϓϩμΫτ Φʔφʔ Time
• ʮͦΕ࡞ͬͯফͯ͠࡞ͬͯফͯ͠ɺຬߦ͘ίʔυͲΕ͘Β͍ ͷ࣌ؒͰ࡞ΕΔʁʯ • ʮ୭͕໘ݟΕΔʁʯ • ʮͦͦDynamoDBͬͯͦΜͳԿճ࡞Δʁʯ • ʮDynamoDBͷมߋ࡞ۀগͳ͘Ͷʁʯ •
ʮࠩؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β͏ϝ Ϧοτ͋Δʁʯ ͦͷ࣌ͷ৺ͷू
• ʮͦ͏͍͑ɺRedshiftͷ࣌ࢥͬͨʯ • ʮSampleࢼͯ͠ɺmoduleԽͯ͠ɺΩϨΠͳίʔυʹͯ͠…ʯ • ʮͰɺRedshiftͷσϓϩΠ͕Ұճ20-30͔͔Δ͔ΒɺԿճ͔Γ ͯ͠…ʯ • ʮͦΕԿ͔͔࣌ؒΔͶΜɻϘλϯϙνϙνͰͰग़དྷΔΜʯ •
ʮdevɺstgɺprod࡞ͬͯ࡞ۀ࣌ؒ10ఔΜʯ • ʮࠩؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β͏ϝϦο τ͋Δʁʯ ͦͷ࣌ͷ৺ͷू ͦͷ̎
• ʮͦ͏͍͑ɺRedshiftͷ࣌ࢥͬͨʯ • ʮSampleࢼͯ͠ɺmoduleԽͯ͠ɺΩϨΠͳίʔυʹͯ͠…ʯ • ʮͰɺRedshiftͷσϓϩΠ͕Ұճ20-30͔͔Δ͔ΒɺԿճ͔Γ ͯ͠…ʯ • ʮͦΕԿ͔͔࣌ؒΔͶΜɻϘλϯϙνϙνͰͰग़དྷΔΜʯ •
ʮdevɺstgɺprod࡞ͬͯ࡞ۀ࣌ؒ10ఔΜʯ • ʮࠩؾʹ͠ͳ͕ΒɺίʔυͷϦϑΝΫλߟ͑ͳ͕Β͏ϝϦο τ͋Δʁʯ ͦͷ࣌ͷ৺ͷू ͦͷ̎ ʮ͍ɺແཧʯ
FacebookͰᄁ͖ɺࠓʹࢸΔ
Infrastructure as CodeʹർΕͨͷͰɺ ͕ͨͪຊདྷΓ͔ͨͬͨ͜ͱΛཧ͢Δ Shogo MuranushiɹABEJA, Inc. Product Owner &
Lead Infrastructure Engineer
• Infrastructure as Codeͱ • ࣗಈԽɺόʔδϣϯཧɺςετɺܧଓతΠϯςάϨʔγϣ ϯɺܧଓతσϓϩΠͱ͍ͬͨɺιϑτΣΞ։ൃͷϓϥΫςΟ εΛγεςϜཧʹԠ༻͢ΔͨΊͷํ๏ • ݮɺ࡞ۀཤྺɺςετࣗಈԽɺΦϖϛεݮɺϨϏϡʔɾ
ϑϩʔͷϝϦοτ ͦͦ Infrastrucure as CodeͰ࣮ݱ͔ͨͬͨ͜͠ͱ
• ϙνϙνΛͰऴΘΔ͕ͣ • ίʔυԽʹ͕͔͔࣌ؒΔ • ϦϑΝΫλ͍ͨ͠ප͕ൃප͢Δ • ࠩͷ߹ΛऔΔͷʹ࣌ؒͱؾΛ͏ • ίʔυͷ֦ுੑΛ্͛ΔͱɺՄಡੑ͕Լ͕ΓෳࡶʹͳΔɻෑډ্͕͕Δ
• ίʔυͷγϯϓϧʹ͢ΔͱɺՄಡੑ্͕Δ͕֦ுੑʹ͚ܽΔ • moduleͷ࠶ར༻ੑͷ͠͞ ͨͩ͠ɺਏ͍͜ͱ͕ͨ͘͞Μ͋Δ
ߟ͑Δ͖ϙΠϯτ
• ମ੍ • ৫ • ࣄۀϑΣʔζ ͕ࣗஔ͔Ε͍ͯΔڥʹΑͬͯద༻༗ແΛߟ͑Δ େࣄ
• ʮίʔυԽਖ਼ٛʯഇࢭ͢Δ • ROIΛߟ͑ͯख࡞ۀࢹʹ ͳΜͰ͔ΜͰίʔυԽ͢ΔͷࣙΊΔ • ref:
• Φϖϛε͕͋Δ • ه͕Βͳ͍ • ࠶ݱੑ͕ͳ͍ • ͍ճͤͳ͍ • ϨϏϡʔ͕Ͱ͖ͳ͍
ख࡞ۀͰμϝͳͷ͔ɻԿ͕μϝͳͷ͔
• Φϖϛε͕͋Δ • Φϖϛεͯ͠OKͳͱ͜ΖɺNGͳͱ͜Ζ͚ͯΔʁ • ه͕Βͳ͍ • ࡞ۀ༰ɺཤྺʢExcelʣGithubͰཧ • ٯʹࠓͷঢ়ଶΛExport͍ͨ͠
• ࠶ݱੑ͕ͳ͍ • ຊʹ࠶ݱ͢Δඞཁ͋Δʁ Ҋʁ
• ͍ճͤͳ͍ • ຊʹ͍ճ͢ʁʁ • ٯʹࠓͷঢ়ଶΛExport => Import͍ͨ͠ • ϨϏϡʔ͕Ͱ͖ͳ͍
• ࡞ۀ༰ɺมߋ͢ΔύϥϝʔλΛࣄલʹϨϏϡʔ͢Δ Ҋʁ
• CLIͷίϚϯυΛهʹͯ͠ɺ࣮ߦ͢Δ • Φϖϛεগͳ͍ • هΔ • ࠶ݱੑ͋Δ • ͍ճͤΔ
• ϨϏϡʔͰ͖Δ • ႈͰͳ͍ɻએݴతͰͳ͍ Ҋʁ
ͭ·Γ
εϥϜμϯΫઋಓ͞Μ ʮ·ͩ͋ΘͯΔΑ͏ͳ࣌ؒ͡Όͳ͍ʯ
• ख࡞ۀͰԿ͕μϝͳͷ͔ɺμϝͳཧ༝Λ͏Ұચ͍ग़͢ • CLIଞͷҊ͕ग़ͯ͘Δ • ঢ়گΛؑΈͯཁ݅Λຬͨͭͭ͠ɺίετɺεϐʔυɺϦεΫΛධ Ձ͠ɺҊͷํ͕ίʔυԽΑΓROI͕ߴ͍ͳΒɺҊͰOK • ྫʣDBͱ͔CDNͬͯԿճ࡞Βͳ͍ΑͶɾɾʁ •
ίετɺεϐʔυɺϦεΫͷ؍ͰίʔυԽͷํ͕ROI͕ߴ͍ͳ ΒɺίʔυԽͰOK ʢࣗʹରͯ͠ʣྫྷ੩ʹͳΓ·͠ΐ͏
ROIΛߟ͑Δ
• ίʔυԽ͠ͳ͍ • DBͱ͔CDNͷΑ͏ͳԿճ࡞Βͳ͍Α͏ͳͭʢίετޮѱ͍ʣ • ҙਤ͠ͳ͍ಈ࡞Λڐ༰Ͱ͖ͳ͍εςʔτ࣋ͭܥʢϦεΫΛڐ༰Ͱ͖ͳ͍ʣ • Πϯϑϥͷਓ͕গͳ͍ʢֶशίετ͕͔͔ΓɺεϐʔυམͪΔʣ ίετɺεϐʔυɺϦεΫͷධՁྫ
• ίʔυԽ͢Δ • ALB + EC2 + RDBͷηοτόϯόϯ࡞ΔΜͩΑͶʔʢίετޮྑ͍ʣ • DR༻ʹ͙͢ʹ্ཱͪ͛Δඞཁ͕͋Δʢεϐʔυ͋Δʣ
• ଟϦʔδϣϯʹαʔϏεల։͢Δ͕͋Δʢεϐʔυ͋Δʣ • ϦιʔεؒΛܨ͍Ͱ͍Δܥʢίετޮߴ͍ʣ • ΦϖϛεΛՄೳͳݶΓഉআ͍ͨ͠ʢࣗಈԽʹΑΔϦεΫϔοδՄೳʣ • ͕͔ͩ͠͠ ίετɺεϐʔυɺϦεΫͷධՁྫ
• աʹΩϨΠʹ͠ա͗ͳ͍ • Γͳ͍ػೳΛิ͏ͨΊʹத͕ෳࡶͳίʔυʹϋʔυϧ্͕Δ • ඞཁ͋ΒຊՈʹPRग़ͦ͏ • ׂΓͬͯखͰྑ͍Μ ίʔυԽ͢Δ࣌ͷҙ
ࠓͷͷঢ়ଶ ͜͏ͳΒͳ͍Α͏ʹ ROIߟ͑·͠ΐ͏
ͦͷޙʹ৭ʑͳਓͱͨ݁͠
IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ
Infrastructure as Code IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ ֓೦
IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ Infrastructure as Code Tool ֓೦ πʔϧ
Infrastructure as Code Tool IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ ֓೦ πʔϧ ར ՝
Infrastructure as Code Tool IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ ֓೦ πʔϧ ར ՝
πʔϧ ֓೦ IaCͷ֓೦ྑ͍͕ʮπʔϧ͕͍͍͍ͭͯͳ͍ʯ Infrastructure as Code Tool ͦΕٻΊ͗ͪ͢Ό͏ʁ
ଞͷ֓೦ಉ͡ • ϚΠΫϩαʔϏεͳͲಉ͡ • ֓೦ྑ͍͚Ͳπʔϧ͕͍͍͍ͭͯͳ͍͜ͱ͕ଟ͍ • ͭ·ΓʮۜͷؙͰͳ͍ʯঢ়ଶ
Կ͕͠ΜͲ͔͔ͬͨ • πʔϧ͕ղܾͯ͘͠ΕΔ՝ͱɺπʔϧ͕͍͍͍ͭͯͳ͍෦ ΛΧόʔ͢Δγϯυ͞ • ͜ͷఱṝͷόϥϯεΛؑΈͯɺࣄۀϑΣʔζɺͷཱɺνʔϜ ମ੍ͩͱIaCγϯυ͔ͬͨ
࠾༻ɾෆ࠾༻ج४ʹ͍ͭͯ • ֓೦͕ղܾ͢Δ՝͘͢͝ଟ͍͕ɺਓͦΕͧΕ৫ஔ͔Ε͍ͯΔཱɺ ࣄۀϑΣʔζ͕ҧ͏ͨΊɺ՝ʹରͯ͠ͷॏΈ͕ҧ͏ • AgileDevOpsͷ֓೦ࣅͨΑ͏ͳͷ • ͦΕΒ͕ղܾ͢Δ՝ͱʁࠓͷࣄۀϑΣʔζɺνʔϜͷεΩϧɾମ੍ɾҾ ͖ܧ͗ͳͲɺͲ͏͍͏νʔϜʹ͍͔ͨ͠ʁͰมΘͬͯ͘Δ
৽͍ٕ͠ज़֓೦ɺࣄۀϑΣʔζɺνʔϜͷମ ੍ɺࠓޙɺͳͲΛ౿·͑ͯݕ౼͠·͠ΐ͏ νʔϜن ༏ઌ ҆ఆ༏ઌ ଐਓԽഉআ ଐਓԽͪ͠Ό͏ ಉ͡εΩϧͷਓগͳ͍ ಉ͡εΩϧͷਓଟ͍ ച্
৽͍ٕ͠ज़֓೦ɺࣄۀϑΣʔζɺνʔϜͷମ ੍ɺࠓޙɺͳͲΛ౿·͑ͯݕ౼͠·͠ΐ͏ νʔϜن ༏ઌ ҆ఆ༏ઌ ଐਓԽഉআ ଐਓԽͪ͠Ό͏ ಉ͡εΩϧͷਓগͳ͍ ಉ͡εΩϧͷਓଟ͍ ച্
ٞ͢Δͱ͖ ͜ͷลΓͷೝࣝΛ߹ΘͤΔ
ͱ͍͑ศརͳ͜ͱ͋Δ ͳͷͰɺશͯΛͦͷٕज़Ͱղܾ͢Δඞཁͳ͍
ʮશͯΛIaCͰΔඞཁͳ͍ʯ • ొஃޙ͜ͷҙݟ͕ଟ͔ͬͨ • શ෦IaCͰద༻͢ΔͷʮRDBΛࣺͯͯશͯKVSʂʯʮશ෦αʔ όϨεͰ͐ʯͱಉ͡ɻదࡐదॴ͕Ұ൪ύϑΥʔϚϯε͕ྑ͍ • freee͞ΜͷࢿྉͰʮશͯͷཁ݅ΛkubernetesͰ࣮ʯ͡Όͳ͘ ͯɺஔ͖͑Մೳͳ෦ʹ͓ͯ͘͜͠ͱɻͱ͔௨ͣΔ •
͡Ό͋ʮదࡐదॴʯΛݟ͚Δʹʁ
ٕज़ࢿɻେࣄɻઈରΔ͖
ݸਓͷ͕ձࣾͷ • ྫ͑ɺτϨϯυͷٕज़ͷ༻్ΛݟۃΊͯదࡐదॴͰ৭ʑͳαʔϏεɾπʔϧΛ Έ߹ΘͤΕແବ͕ݮΓࣄۀ͕Ճ͢Δ • AWSΛֶͿ͜ͱͰʮނোͷͨΊͷઃܭʢdesign for faillerʣʯΛֶΔ • KubernetesΛֶͿ͜ͱͰʮએݴతΞʔΩςΫνϟ͜͏͍͏͜ͱ͔ʯͱ͍͏ઃ
ܭΛֶΔɺͳͲ • ͦΕͳΒɺࣄۀΛͤ͞Δ্Ͱ৽͍ٕ͠ज़֓೦ͷशಘʢࢿʣඞਢ • ୭͔͚ͩ৽͍͜͠ͱΛֶͿͷଞ͕͍ͯ͜ͳ͍͔͠Εͳ͍ͷͰɺνʔϜͰͦ ΕͧΕٕज़Λֶͼ߹͍ɺ͓ޓ͍Ͱڞ༗͋͠͏ͷ͋Γ
ݸਓతࢿײ֮10-20%ఔɻͦͷఔ৽͠ ͍νϟϨϯδʹճ͢ • KubernetesͰྑ͍͠ɺTerraformͰྑ͍ɻͱΓ͋͑ͣͬͯΈΔͬͯͷ༗Γͩ͠ɺ ͩ͜ΘͬͯϕετϓϥΫςΟεΛݟ͚ͭʹߦ͘ͷ͋Γ • ͪΐͬͱͰྑ͍͔Βຊ൪ʹऔΓೖΕͯΈΔɻେࣄɻݕূͱຊ൪ͰֶΔྔ͕ഒҧ͏ • ʮ͍͔͠Β10-20%औΕͳ͍ʯݴ͍༁ɻ୭͕ѱ͍ͬͯ৫ͷऀ͕ѱ͍ɻ৫Λ ͤ͞Δؾ͋Δͷ͔ɻͦ͜ʹίϛοτ͢Δؾ͕͋ΔͷʹͰ͖ͳ͍ͳΒଵຫɻਓͷΞα
ΠϯؚΊͯମ੍ͮ͘ΓΛ͖͢ • ࣦഊͷҰͭʢԿ͕μϝͩͬͨͷ͔ཧղͰ͖Δʣ
͡Ό͋ɺԿ͔Β࢝ΊΔʁͦͷޙͷIaCͷτϨϯυ
2019ͷτϨϯυ • AWS CDK —> ॕGAʂʂ • Terraform —> v0.12
ϦϦʔεʂʂ • Terraformer ??
AWS CDK • ͨͿΜ୭͔͕հͯ͘͠ΕΔͱࢥ͏ͷͰɺҰൠతͳ͜ͱॻ͔ͳ͍ • No YAML, Yes Programing Language.
• গͳ͍ίʔυྔͰଟ͘ͷ͜ͱ͕࣮ݱͰ͖Δ • ͰɺCFnͳͷͰద༻࣌ͷڍಈͷཧղඞཁɻ࡞Δ͚ͩͷָ • ͨͿΜҰੈΛ෩ᴆ͢ΔΜ͡Όͳ͍͔ͳ • ࣾͰSDKͰྑ͍Μ͡ΌͶʁͱ͍͏͕ ʢಈ͖͔Δͱ͍͏ҙຯͰʣ
Terraform v0.12 • for, for_eachจ͕ॻ͚ΔΑ͏ʹͳͬͨ • NullΛׂΓͯՄೳʹʢʹఆٛͯ͠ͳ͍͜ͱͱಉ͡ʣ • Splitѻ͍͘͢ •
ͦͷଞ৭ʑ • ͑ɺɺ͜͜·ͰདྷͨΒϓϩάϥϛϯάݴޠͰॻ͘CDKͷํ͕…? • ͋·ΓτϦοΩʔͳػೳΛ͍͗͢Δͱ୭͍ͯ͜Εͳ͍ͷͰ ༻๏༻ྔҙ͠·͠ΐ͏
Terraformer
ݸਓతײ • ޙʹ ൚༻ݴޠ vs DSL ͕ຄൃ͢Δ • Ͱɺঃʑʹऩଋָͯ͠ʹͳΔͣͳͷͰWelcome •
CDKͩͱॻ͘͜ͱָʹͳΔ • ͚Ͳɺӡ༻ɾҡ࣋͢Δ͜ͱผɻCFnΛϥοϓ͍ͯ͠Δ͚ͩͳ ͷͰίʔυͷద༻࣌ͷڍಈมΘΒͣཧղ͕ඞཁ
ݸਓతײ • ʮ࡞ΔʯͬͯͷIaCͰ՝ղܾͯ͠ɺʮӡ༻ʯIaCͰղܾ͠ͳ ͍ͷ͋Γɻ • IaC͍ࣺͯɻ͋͘·ͰɺαʔϏεؒͷܨ͗ͱ͔Λදݱ͢Δ ͷɻߏஙखॱͱͯ͠දݱ͢Δͷɻͱ͔ɻ࣮ࡍͷύϥϝʔλ AWSίϯιʔϧݟͯͶͱ͔༗Γͩͱࢥ͏ɻ
Infrastructure as Code Tool ͍ࣺͯIaCͷ߹ͷ Pro/Con
αΫοͱͬͯϋϚΓͦ͏ͳ݅Λ·ͱΊΔ
·͞ʹ͍͍ͯΔɻ͙͢ʹͰͬͨํ͕͍͍ͭ • ඵͰө͞ΕΔ • ফͯ͠ɺ͙͢ʹద༻͢Εͳ͍ • Կճ࡞Δ • ྫ •
Datadog: Monitor • AWS: CloudTrail, SNS, SQS, Route53, etc… • ͜ͷล͔Β࢝ΊΔͱɺॻ͖ํ͍উख͕͔Δ
·͞ʹ͍͍ͯͳ͍ • ࡞ʹ͕͔͔࣌ؒΔͭʢDBܥʣ • Կճ࡞Βͳ͍ͭʢRedShiftCloudFrontʣ • ফ͢ͱϚζΠͭ • Α͘มߋ͢Δͭ •
͜ͷล͔Β࢝ΊΔͱɺ1ճ1ճͷ࡞ۀ͕ා͍ɻ͕ࠩग़ͨͱ͖ʹຖ ճٵऩ͢Δͷ͕ਏ͍ɻ͔͔࣌ؒΔͷͰςετ͔ͳΓ͠ΜͲ͍
·ͱΊ • ֓೦ʹπʔϧ͕͍͔ͭͳ͍͜ͱΑ͋͘Δɻਏ͍ɻROIߟ͑Δɻ • Ͱ֓೦ʢίϯηϓτʣπʔϧ͔ΒֶΔ͜ͱଟ͍ɻ • 10 - 20%ఔʢࣗ༝ʣͷٕज़ࢿߦֶ͍ͼଓ͚Δɻ •
ֶͦͯ͠Μͩ͜ͱΛࣄۀͷʹ׆͔͢ɻࣦഊؚΊͯɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠