Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
非IaCなAWS環境をCloudFormationでIaC化する
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
kefi550
October 08, 2023
Programming
670
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
非IaCなAWS環境をCloudFormationでIaC化する
【AWS】AWS10分LT会 - vol.1
https://aws-likers.connpass.com/event/296768/
kefi550
October 08, 2023
More Decks by kefi550
See All by kefi550
ECSのコストのケチり方
kefi550
0
270
Amazon Pinpoint使ってますか?Amazon PinpointでGmail送信者ガイドラインに対応した話
kefi550
0
820
CO2濃度を監視して生産性向上💪
kefi550
0
50
Other Decks in Programming
See All in Programming
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.5k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.9k
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Domain-Driven Transformation
hschwentner
2
2.3k
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
パーソナライズPodcastを作った話
repunit11
0
120
AWS CDKのカスタムリソースでContinuum(旧Security Agent)を実装した話 | Implementing Continuum (formerly Security Agent) via AWS CDK Custom Resource
akihisaikeda
2
140
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
360
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
350
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
4.9k
Simple Storage Service(S3) is not simple
iwatsukayura
0
220
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
970
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
GraphQLとの向き合い方2022年版
quramy
50
15k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
390
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
The browser strikes back
jonoalderson
0
1.8k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Writing Fast Ruby
sferik
630
63k
Transcript
非IaCな環境をCloudFormationで IaC化する 2023/10/09 AWS10分LT会 - vol. 1 1 石橋翔太 (@kefi550)
IaCとは https://docs.aws.amazon.com/ja_jp/whitepapers/latest/introduction-devops-aws/infrastructure-as-code.html
• AWSリソースがほぼすべて手で作られており、コード化はされていない 課題 • 本番/ステージングで細かい差分が多い...無意味な差分がある... • 作業(手順)漏れなどによるリリース失敗... • AWSリソース等環境の把握、変更レビューがムズい...(自分が入社したときムズかった)
コード管理されず、手作業によるインフラ管理は盆栽になりやすい 課題 ステージング 本番 とりあえず変更... とりあえず変更... なんでこうなってんだっけ?
• パラメータを変えることで、あるテンプレート から環境ごとのリソースを作る 理想の状態 共通テンプレート stagingリソース productionリソース Env=production Env=staging
無意味な本番/ステージングの差分を防止 理想の状態 共通テンプレート stagingリソース productionリソース Env=production Env=staging
• 既存リソースをCFnスタックにimportする ◦ import作業は多少めんどい ◦ 再作成できない系リソースはこっちがいい • 既存リソースと等価なリソースをCFnで作成し、古いリソースを削除するリプレイス ◦ 作るのはラク
◦ 新たに作ったリソースが要件を満たしているかの確認を注意する必要がある • 新規作成系リソースは必ずCloudFormationで作る心構えをする ◦ 既存リソースをコード化するのに比べてラクなので新規作成時にコード化すべき 既存リソースをCloudFormation化していくアプローチ
• former2 をつかって本番/ステージングそれぞ れのリソースのテンプレートを得る • https://github.com/iann0036/former2 既存リソースをCFnスタックにimportする
• 本番/ステージングの同じ役割のリソースをFn::If 等を使って気合で1つのテンプレートにマージ • スタックにimportして、ドリフトが無いことを確認(ドリ フト検出できないリソースもある ) 既存リソースをCFnスタックにimportする
• 本番/ステージングの変な差分 課題 本番DB sg-xxx TCP 5432 allow from sg-zzz
ステージングDB sg-yyy TCP 5432 allow from 0.0.0.0/0
• Fn::Sub や Fn::Ref等を使って共 通テンプレートを整理する 既存リソースをCFnスタックにimportする
一旦既存の状態をそのままスタックにimportしてから細かく変更することで、影響範囲やレビュー 負荷を小さくできる
• 一旦既存の状態のままスタックにimportしてから細かく変更することで、影響範囲やレビュー負荷 を小さくできる • importの段階で多少の気合が必要 ◦ ドリフト検出を使って、テンプレートが正しく現状と合っているかは確認できる
既存リソースをCFnスタックにimportする
• ほぼコード化されていないAWSリソースをCloudFormationでコード化しています • CFn resource importで安全にCFn移行 コード化していまのところ良かったこと • (リソースの作成変更といった)作業漏れが発生しにくい
• マネコンから作るのに比べて、細かいパラメータへの意識 • レビューしやすい • ゴミが残りづらい • オンボーディングに便利(だと思う) おわりに
インフラはコードで管理しよう