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
250
EKS を使ってる人から見た App Runner
shogomuranushi
7
2.5k
Suggested Topicの質問に可能な限り答えてみた
shogomuranushi
0
1.1k
顧客のアプリケーションコードが動くマルチテナント環境における課題とEKSにたどり着くまで
shogomuranushi
0
1.6k
ちょいテク100本ノック。できるまで帰しません 。今から使えるちょいテク集
shogomuranushi
1
2.8k
what is Cloud Run?
shogomuranushi
2
110
Other Decks in Programming
See All in Programming
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
930
PicoRubyと暮らす、シェアハウスハック
ryosk7
0
200
快速入門可觀測性
blueswen
0
490
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
400
.NETでOBS Studio操作してみたけど…… / Operating OBS Studio by .NET
skasweb
0
120
サーバーゆる勉強会 DBMS の仕組み編
kj455
1
300
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
290
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
770
DMMオンラインサロンアプリのSwift化
hayatan
0
160
DevFest - Serverless 101 with Google Cloud Functions
tunmise
0
140
ドメインイベント増えすぎ問題
h0r15h0
2
560
DevinとCursorから学ぶAIエージェントメモリーの設計とMoatの考え方
itarutomy
0
100
Featured
See All Featured
Designing Experiences People Love
moore
139
23k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Six Lessons from altMBA
skipperchong
27
3.6k
Optimizing for Happiness
mojombo
376
70k
Facilitating Awesome Meetings
lara
51
6.2k
Embracing the Ebb and Flow
colly
84
4.5k
Art, The Web, and Tiny UX
lynnandtonic
298
20k
KATA
mclloyd
29
14k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
500
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.4k
RailsConf 2023
tenderlove
29
970
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%ఔʢࣗ༝ʣͷٕज़ࢿߦֶ͍ͼଓ͚Δɻ •
ֶͦͯ͠Μͩ͜ͱΛࣄۀͷʹ׆͔͢ɻࣦഊؚΊͯɻ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠