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.4k
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
240
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
[JAWS-UG横浜 #76] イケてるアップデートを宇宙いち早く紹介するよ!
maroon1st
0
450
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
layerx_20241129.pdf
kyoheig3
2
290
Symfony Mapper Component
soyuka
2
730
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
testcontainers のススメ
sgash708
1
120
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
620
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
200
Featured
See All Featured
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
2
160
YesSQL, Process and Tooling at Scale
rocio
169
14k
Unsuck your backbone
ammeep
669
57k
Rails Girls Zürich Keynote
gr2m
94
13k
Adopting Sorbet at Scale
ufuk
73
9.1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Side Projects
sachag
452
42k
Git: the NoSQL Database
bkeepers
PRO
427
64k
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%ఔʢࣗ༝ʣͷٕज़ࢿߦֶ͍ͼଓ͚Δɻ •
ֶͦͯ͠Μͩ͜ͱΛࣄۀͷʹ׆͔͢ɻࣦഊؚΊͯɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠