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! 実際どうよ? / Policy as Code with CloudFormation Guard
Search
Yukitaka Ohmura
October 08, 2022
Technology
0
300
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
20240208_CFn_IaC_Gen_with_CDK.pdf
ohmura
1
240
CloudFormation IaC generatorを使った既存AWS環境の管理方法 / Managing existing environment with AWS CFn IaC generator
ohmura
9
3k
スタートアップに学ぶイノベーションの起こし方とクラウドの活用方法 / Learning from startup - how to innovate and to use AWS
ohmura
0
84
AWS Well-Architected Framework 2023年10月 アップデート情報 / AWS Well-Architected Framework Oct. 2023 update
ohmura
0
490
Cloud Financial Management ~AWSコストの可視化・最適化・予測・FinOps~ / Cloud Financial Management Overview
ohmura
8
3.7k
What we leaned about CDK from developing BLEA
ohmura
0
50
Other Decks in Technology
See All in Technology
PhpStorm超絶技巧40分集中講義 #phpconkagawa
yusuke
4
720
AWS Observability ベストプラクティス 大紹介
o11yfes2023
0
150
日本が誇るイタリアのダンスミュージック!? ユーロビートって何??
minorun365
PRO
1
180
RailsConf 2024 Keynote "Startups on Rails in 2024"
irinanazarova
0
770
AI JIMY - 登壇(インストール編)
hanacchi
0
150
LLM評価の落とし穴~開発者目線で気をつけるポイント~
rishigami
11
3.1k
類似ロジック実装をiOS/Android間で合わせる道標No.1
fumiyasac0921
1
220
グイグイ系QAエンジニアでやっていくよ!
____rina____
0
750
動画配信サービスのフロントエンド実装に学ぶ設計原則
yud0uhu
0
130
Databricksの生成AI戦略
taka_aki
1
360
SWC Transformerから見るTypeScript関数記述ベストプラクティス
fujiyamaorange
1
170
1Q86
kawaguti
PRO
2
180
Featured
See All Featured
The Invisible Side of Design
smashingmag
294
49k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
123
39k
Creatively Recalculating Your Daily Design Routine
revolveconf
211
11k
Designing on Purpose - Digital PM Summit 2013
jponch
111
6.5k
What's new in Ruby 2.0
geeforr
338
31k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
Atom: Resistance is Futile
akmur
260
25k
We Have a Design System, Now What?
morganepeng
43
6.8k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
Why Our Code Smells
bkeepers
PRO
331
56k
Code Reviewing Like a Champion
maltzj
515
39k
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