$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
RemovalPoliciesのことを知ろう!
Search
watany
April 01, 2025
Technology
2
250
RemovalPoliciesのことを知ろう!
JAWS-UG CDK支部 #20でお話しした内容でした
https://jawsug-cdk.connpass.com/event/348953/
watany
April 01, 2025
Tweet
Share
More Decks by watany
See All by watany
まだ間に合う! 2025年のhono/ssg事情
watany
3
810
AIのメモリー
watany
13
1.6k
AIエージェントが書くのなら直接CloudFormationを書かせればいいじゃないですか何故AWS CDKを使う必要があるのさ
watany
21
8.8k
Coding Agentに値札を付けろ
watany
3
960
Vibe Codingをせずに Clineを使っている
watany
19
7.9k
ミリしらMCP勉強会
watany
4
1.1k
エンジニアに許された特別な時間の終わり
watany
104
210k
AI Agent時代なのでAWSのLLMs.txtが欲しい!
watany
4
1.3k
宇宙最速のランチRecap LT会(AWS re:Invent 2024)
watany
2
800
Other Decks in Technology
See All in Technology
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.3k
A Compass of Thought: Guiding the Future of Test Automation ( #jassttokai25 , #jassttokai )
teyamagu
PRO
1
180
Docker, Infraestructuras seguras y Hardening
josejuansanchez
0
140
小規模チームによる衛星管制システムの開発とスケーラビリティの実現
sankichi92
0
190
DGX SparkでローカルLLMをLangChainで動かした話
ruzia
1
260
ECMAScript仕様の最新動向: プロセスの変化と仕様のトレンド
uhyo
2
460
AIにおける自由の追求
shujisado
2
470
一億総業務改善を支える社内AIエージェント基盤の要諦
yukukotani
8
2.8k
私も懇親会は苦手でした ~苦手だからこそ懇親会を楽しむ方法~ / 20251127 Masaki Okuda
shift_evolve
PRO
4
540
AI/MLのマルチテナント基盤を支えるコンテナ技術
pfn
PRO
4
680
Capture Checking / Separation Checking 入門
tanishiking
0
110
Digitization部 紹介資料
sansan33
PRO
1
6.1k
Featured
See All Featured
Agile that works and the tools we love
rasmusluckow
331
21k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.8k
4 Signs Your Business is Dying
shpigford
186
22k
Thoughts on Productivity
jonyablonski
73
5k
KATA
mclloyd
PRO
32
15k
A designer walks into a library…
pauljervisheath
210
24k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Site-Speed That Sticks
csswizardry
13
990
Side Projects
sachag
455
43k
Navigating Team Friction
lara
191
16k
Transcript
JAWS-UG CDK支部 #20 RemovalPoliciesのことを知ろう! 2025-04-01
About Me 渡邉 洋平(watany) • 所属:NTTテクノクロス株式会社 ◦ 「AWS 500 APN
Certification Distinction」に認定 • Personal ◦ JAWS-UG東京 運営 ◦ AWS Ambassadors(2024) ◦ Japan AWS All Certifications Engineers(2022~) https://jawsug.connpass.com/event/316
RemovalPoliciesのことを知ろう!
おさらい- RemovalPolicy • CDK’s Removal Policy ≒ CloudFormation’s DeletionPolicy •
リソースの消し方を設定する ◦ RemovalPolicy.DESTROY:削除 ◦ RemovalPolicy.RETAIN:保持 ◦ RemovalPolicy.SNAPSHOT:スナップショット取得 ◦ RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE:作成失敗で削除。以降は保持 https://docs.aws.amazon.com/cdk/v2/guide/resources.html#resources_removal
何が困るか- RemovalPolicy 大量のリソースへ 設定したい 検証用にRETAINを 止めたい RDS全部に SNAPSHOT設定したい
RemovalPolicies https://github.com/aws/aws-cdk/releases/tag/v2.183.0 2025/03/12 🚀
なぜ私が説明するか 私と3人で 作ったPR https://github.com/aws/aws-cdk/pull/32283
何ができるか- RemovalPolicies 基本形 Stack配下の 全Constructへ 設定
何ができるか- RemovalPolicies 基本形 特定のリソース タイプ全部へ設定
何ができるか- RemovalPolicies 基本形 特定のリソース タイプ以外へ設定
何ができるか- RemovalPolicies 応用編 MissingRemobalPolicies ⇒RemovalPolicyの明示的な 設定のない Constructへ設定 RemovalPolicies ⇒問答無用で設 定
何ができるか- RemovalPolicies 応用編 - Priority Priority=優先度 対応ができる
これらの課題はクリアされる 大量のリソースへ 設定したい 検証用にRETAINを 止めたい RDS全部に SNAPSHOT設定したい
RemovalPoliciesの実装秘話
RemovalPoliciesの実装秘話 1. 元ネタの技術記事
機能の元ネタ https://dev.classmethod.jp/articles/aws-cdk-set-removal-policy-all-resources-in-stack/
機能の元ネタ のんピさんありがとう Blogを無効化してしまってごめん https://dev.classmethod.jp/author/non____97/
RemovalPoliciesの実装秘話 2.実装工程
None
• VS Code Extension コーディングエージェント(OSS) ◦ ”必要になれば人間に聞く” Human-in-the-Loop ◦ ”人間に聞かない機能”
Auto Approve • 多彩なツールの実行 ◦ ファイルの作成・編集、コマンド実行 ◦ ヘッドレスブラウザを用いたデバッグ ◦ MCP経由でのPlugin機能 • 多彩なLLM APIの採用 ◦ Amazon Bedrock+Claudeも使用可能 Cline
”流行ってるから適当に言ってんだろ ” https://x.com/_watany/status/1861279373984440580 これが証拠 (2024/11/26)
経緯 Qiitaアドベントカレンダー 2024向けにClineを調べていた
RemovalPoliciesの実装秘話 3.MissingRemovalPolicies
元はこんな実装だった overwrite デフォがMissing~ overwriteを明示で 上書き
元はこんな実装だった それPriority付けたらヤバくないっすか 問題が わかりますか?
元はこんな実装だった それPriority付けたらヤバくないっすか 優先度が高いので retainが適応される 優先度が低いので destroyが後で 適応される
あなたはどっち? 俺の優先度が 高いんだから retainに なれよ! 優先度順 なんだから順番に retain→destroy だろ! https://www.irasutoya.com/2017/12/blog-post_666.html
色々あり、分割しました
ということで RemovalPolicies、超便利なので使ってください https://docs.aws.amazon.com/cdk/api/v2/python/aws_cdk/RemovalPolicies.html
宣伝 初主催のイベントを 4/23(木) オンラインでやるから聞きに来てね https://jawsug.connpass.com/event/348840/ https://x.com/_watany/status/1899298621830361566