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
CloudFormation Guard で Policy as Code! 実際どうよ? /...
Search
Yukitaka Ohmura
October 08, 2022
Technology
0
520
CloudFormation Guard で Policy as Code! 実際どうよ? / Policy as Code with CloudFormation Guard
「JAWS DAYS 2022 AWS SA/エキスパート 怒涛のLTチャレンジ」(
https://jawsdays2022.jaws-ug.jp/
) でお話ししたLTの資料です。
Yukitaka Ohmura
October 08, 2022
Tweet
Share
More Decks by Yukitaka Ohmura
See All by Yukitaka Ohmura
JAWS-UG ちばらき 地味でも大事な re:Invent 2024 / JAWS-UG chibaraki Enjoy cool and unaware feature at pre:Invent 2024
ohmura
3
94
20240208_CFn_IaC_Gen_with_CDK.pdf
ohmura
1
310
CloudFormation IaC generatorを使った既存AWS環境の管理方法 / Managing existing environment with AWS CFn IaC generator
ohmura
9
3.5k
スタートアップに学ぶイノベーションの起こし方とクラウドの活用方法 / Learning from startup - how to innovate and to use AWS
ohmura
0
150
AWS Well-Architected Framework 2023年10月 アップデート情報 / AWS Well-Architected Framework Oct. 2023 update
ohmura
0
730
Cloud Financial Management ~AWSコストの可視化・最適化・予測・FinOps~ / Cloud Financial Management Overview
ohmura
8
4.6k
What we leaned about CDK from developing BLEA
ohmura
0
76
Other Decks in Technology
See All in Technology
急成長する企業で作った、エンジニアが輝ける制度/ 20250214 Rinto Ikenoue
shift_evolve
2
1.1k
株式会社EventHub・エンジニア採用資料
eventhub
0
4.2k
オブザーバビリティの観点でみるAWS / AWS from observability perspective
ymotongpoo
8
1.3k
Developers Summit 2025 浅野卓也(13-B-7 LegalOn Technologies)
legalontechnologies
PRO
0
500
2.5Dモデルのすべて
yu4u
2
790
Helm , Kustomize に代わる !? 次世代 k8s パッケージマネージャー Glasskube 入門 / glasskube-entry
parupappa2929
0
210
SA Night #2 FinatextのSA思想/SA Night #2 Finatext session
satoshiimai
1
130
滅・サービスクラス🔥 / Destruction Service Class
sinsoku
6
1.6k
CZII - CryoET Object Identification 参加振り返り・解法共有
tattaka
0
310
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
6
57k
現場で役立つAPIデザイン
nagix
32
11k
Culture Deck
optfit
0
390
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
31
2.1k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
99
18k
GraphQLとの向き合い方2022年版
quramy
44
13k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.6k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Understanding Cognitive Biases in Performance Measurement
bluesmoon
27
1.5k
KATA
mclloyd
29
14k
The Invisible Side of Design
smashingmag
299
50k
YesSQL, Process and Tooling at Scale
rocio
171
14k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.1k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Transcript
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. ⼤村 幸敬 Manager, Solutions Architect Amazon Web Services Japan 2022/10/08 CloudFormation Guard で Policy as Code︕ 実際どうよ︖ J AW S D AY S 2 0 2 2 AW S S A / エ キ ス パ ー ト 怒 涛 の LT チ ャ レ ン ジ
© 2022, Amazon Web Services, Inc. or its affiliates. ⼤村
幸敬(おおむら ゆきたか) 部⻑ / シニア ソリューションアーキテクト • これからクラウドを使いはじめる エンタープライズ企業をサポート • 運⽤系サービス & DevOps 系サービスをリード • Baseline Environment on AWS (BLEA) 開発者 好きなAWSのサービス︓ AWS Command Line Interface (CLI) AWS Cloud Development Kit (CDK) AWS Systems Manager Incident Manager @yktko 2
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. Policy as Code 3
© 2022, Amazon Web Services, Inc. or its affiliates. Policy
as Code が実現する世界 開発から運⽤までいずれの⼯程でもシステム環境が ポリシーに適合していることをコードで検証できる 4 CFn 検証 コーディング デプロイ 稼働環境 ポリシーコード (従うべきセキュリティ等を定義) CloudFormation (CFn) 検証 検証 CloudFormation テンプレート
© 2022, Amazon Web Services, Inc. or its affiliates. Policy
as Code on AWS の現状 1. CFnテンプレートの検証: cfn-guard, cfn_nag, cfn-lint 2. CFnデプロイ時の 予防的ガードレール: CFn Hooks 3. 稼働環境の 発⾒的ガードレール: AWS Config Rules 5 CFn cfn-guard コーディング デプロイ 稼働環境 CloudFormation CFn Hooks Config Rules (カスタムルール) CloudFormation テンプレート
© 2022, Amazon Web Services, Inc. or its affiliates. Policy
as Code on AWS の課題 • 同じポリシーを異なる形式で定義する必要がある § cfn-guard → Guard DSLで定義 § AWS Config Rules → Lambdaコード+RDK*で定義 6 CFn cfn-guard コーディング デプロイ 稼働環境 CloudFormation Config Rules (カスタムルール) CloudFormation テンプレート *RDK = Rule Development Kit https://github.com/awslabs/aws-config-rdk CFn Guard DSL Lambda+ RDK
© 2022, Amazon Web Services, Inc. or its affiliates. Config
Rules を CFn Guard DSLで定義可能に 7 Q: 同じDSLでCFnテンプレートも 実環境も検証できるのでは︖ CFn cfn-guard コーディング デプロイ 稼働中環境 CloudFormation Config Rules (w/CFn Guard DSL) CloudFormation テンプレート CFn Guard DSL
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. やってみた 8
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. の前に CFn Guard おさらい 9
© 2022, Amazon Web Services, Inc. or its affiliates. AWS
CloudFormation Guard (CFn Guard) • 2020年10⽉ CFn Guard 1.0 がリリース • 2021年5⽉ 2.0 がリリースされ DSLが⼤きく変更(1.0と⾮互換) • 2022年6⽉ 2.1 がリリース • 2022年8⽉ Config Rules が CFn Guard DSL に対応 10 https://github.com/aws-cloudformation/cloudformation-guard
© 2022, Amazon Web Services, Inc. or its affiliates. CFn
Guard (フェーズ1: ルールとテストを書く) 11 S3が暗号化されていることを 検証するルール (Guard DSL) s3-encrypt.guard ルールのテストコード (YAML) s3-encrypt_tests.yaml ルールのテスト実⾏ (Guard CLI) すべてのテストが意図した結果になり テストをPASSしている
© 2022, Amazon Web Services, Inc. or its affiliates. CFn
Guard (フェーズ2: CFnテンプレートの検証) 12 S3が暗号化されていることを 検証するルール (Guard DSL) s3-encrypt.guard CFnテンプレ (S3バケット暗号化あり) ルールで検証(PASS) s3-encrypted.yaml s3-un-encrypted.yaml CFnテンプレ (S3バケット暗号化なし) ルールで検証(FAIL)
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. AWS Config Rules を CFn Guard DSLで定義 13
© 2022, Amazon Web Services, Inc. or its affiliates. 同じDSLで
CFnテンプレート と Config を検証するルール (Parameterized Rules) 14 https://github.com/aws-cloudformation/cloudformation-guard/releases/tag/2.1.0 For CFn For CFn For Config For Config 共通のルールへそれぞれから適したパラメータを渡す サンプルルールの内容(抜粋) CFn Guard GitHubのサンプルコード CFnテンプレートの検証はOK︕ (中略)
© 2022, Amazon Web Services, Inc. or its affiliates. Parameterized
Rulesサンプルで Config Rules を定義する 15 https://aws.amazon.com/jp/blogs/mt/announcing-aws-config-custom-rules-using-guard-custom-policy/
© 2022, Amazon Web Services, Inc. or its affiliates. Parameterized
Rulesサンプルで Config Rules を定義する 16
© 2022, Amazon Web Services, Inc. or its affiliates. Parameterized
Rulesサンプルで Config Rules を定義する 17 😇
© 2022, Amazon Web Services, Inc. or its affiliates. Parameterized
Rulesサンプルで Config Rules を定義する 18 😭
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. (今は)できませんでした 19
© 2022, Amazon Web Services, Inc. or its affiliates. まとめ
20 Q: 同じGuard DSLで CFnテンプレートも実環境も検証できるのでは︖ A: もう少し、こなれてくる必要がありそう CFn cfn-guard コーディング デプロイ 稼働中環境 CloudFormation Config Rules (w/CFn Guard DSL) CloudFormation テンプレート CFn Guard DSL
© 2022, Amazon Web Services, Inc. or its affiliates. まとめ
21 CloudFormationテンプレートの検証に Config カスタムルールの開発に CFn Guard それぞれお試しください︕ CFn cfn-guard コーディング デプロイ 稼働環境 CloudFormation CFn Hooks Config Rules (カスタムルール w/CFn Guard) CloudFormation テンプレート
© 2022, Amazon Web Services, Inc. or its affiliates. ©
2022, Amazon Web Services, Inc. or its affiliates. Thank you ! 22 Email:
[email protected]
Twitter: @yktko