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
Stageを活用したマルチステージ運用の最短経路
Search
yuto mori
July 12, 2025
1
82
Stageを活用したマルチステージ運用の最短経路
AWS CDK Conference Japan 2025 presented by JAWS-UG
yuto mori
July 12, 2025
Tweet
Share
More Decks by yuto mori
See All by yuto mori
初学者向け CDK勉強会 外部公開用
hosomatu
0
140
完全IT未経験の消防士が Fusicのエンジニアになるまでに取り組んだこと
hosomatu
1
280
圧倒的サポート力! Amazon Q× CDK 開発のすすめ
hosomatu
3
620
脱ぽちぽちを目指して CDKでインフラ構築をしてみた
hosomatu
0
1.7k
Featured
See All Featured
Facilitating Awesome Meetings
lara
54
6.5k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Faster Mobile Websites
deanohume
308
31k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
A designer walks into a library…
pauljervisheath
207
24k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
126
53k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.5k
BBQ
matthewcrist
89
9.7k
Transcript
©Fusic Co., Ltd. 0 CONFIDENTIAL Stageを活用したマルチステージ運用の最短経路 2025.07.12 名前 森優斗 @kotukotuganbad
AWS CDK Conference Japan 2025 presented by JAWS-UG
©Fusic Co., Ltd. 1 CONTENTS 目次 1. CDKにおけるStageとは 2. Stageで何を実現したのか
3. 実装例の紹介 4. まとめ
©Fusic Co., Ltd. 2 森 優斗 Mori Yuto ❖ I
am - 消防10年 Fusic 2年 - RareTECH メンター(ITスクール) - 初音ミクとギターが好きです ❖ Skills - AWS (Web) / Ruby on Rails ❖ Comment - 懇親会でいっぱい話したいです 自己紹介 はじめに 株式会社Fusic @福岡 データソリューション部門 エンジニア @kotukotuganbad
©Fusic Co., Ltd. 3 導入 0
©Fusic Co., Ltd. 4 CDKにおけるステージとは CDKにおけるステージとは CDKパイプラインを使う際のスタックを囲うだけの存在 として扱っていませんか?
©Fusic Co., Ltd. 5 CDKにおけるステージとは CDKにおけるステージとは
©Fusic Co., Ltd. 6 CDKにおけるステージとは CDKにおけるステージとは 非常にもったいない! 聴講後にすぐにポテンシャルを解放してあげましょう
©Fusic Co., Ltd. 7 CDKにおけるStageとは 1
©Fusic Co., Ltd. 8 CDKにおけるステージとは CDKにおけるステージとは CDK.Stageとは 複数のStackをまとめてグループ化するものです
©Fusic Co., Ltd. 9 CDKにおけるステージとは CDKにおけるステージとは Stage Stack Amazon ECS
Construct ALB AWS Fargate Construct Amazon CloudFront 複数のStackをまとめてグループ化 Stack Amazon GuardDuty AWS Security Hub
©Fusic Co., Ltd. 10 Stageで何を実現したのか 2
©Fusic Co., Ltd. 11 開発環境へのデプロイフロー Stageで何を実現したのか Stack Construct AWS Cloud
ステージング環境 Construct cdk deploy “DevStage/*” –-profile dev AWS Cloud 本番環境 AWS Cloud 開発環境 parameter.ts DevStage 開発環境のenv情報 開発環境用のパラメータ Stack Construct Construct DevStage
©Fusic Co., Ltd. 12 異なるパラメータのステージング環境へのデプロイフロー Stageで何を実現したのか Stack Construct AWS Cloud
ステージング環境 Construct cdk deploy “StgStage/*” –-profile stg AWS Cloud 本番環境 AWS Cloud 開発環境 parameter.ts StgStage 開発環境のenv情報 ステージング環境用のパラメータ Stack Construct Construct DevStage Stack Construct Construct StgStage
©Fusic Co., Ltd. 13 ガードレールとしての機能 Stageで何を実現したのか Stack Construct AWS Cloud
ステージング環境 Construct cdk deploy “StgStage/*” –-profile prd AWS Cloud 本番環境 AWS Cloud 開発環境 parameter.ts StgStage 開発環境のenv情報 ステージング環境用のパラメータ Stack Construct Construct DevStage Stack Construct Construct StgStage Stack Construct Construct StgStage
©Fusic Co., Ltd. 14 実装例の紹介 5
©Fusic Co., Ltd. 15 ディレクトリ構成 実装例の紹介 . ├── bin │
└── infra.ts # CDKアプリのエントリーポイント ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts # Construct定義(全環境で共通) │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts # Stack定義(全環境で共通) │ └── stage │ ├── dev-stage.ts # Stage定義 │ ├── prd-stage.ts # Stage定義 │ └── stg-stage.ts # Stage定義 ├── cdk.json ├── parameter.ts # 各種パラメータ管理
©Fusic Co., Ltd. 16 parameter.ts 実装例の紹介 . ├── bin │
└── infra.ts ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts │ └── stage │ ├── dev-stage.ts │ ├── prd-stage.ts │ └── stg-stage.ts ├── cdk.json ├── parameter.ts それぞれのStageに 渡すためのenv情報 パラメータの型 devに渡すパラメータ
©Fusic Co., Ltd. 17 aspects 実装例の紹介 . ├── bin │
└── infra.ts ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts │ └── stage │ ├── dev-stage.ts │ ├── prd-stage.ts │ └── stg-stage.ts ├── cdk.json ├── parameter.ts
©Fusic Co., Ltd. 18 エントリーポイント 実装例の紹介 . ├── bin │
└── infra.ts ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts │ └── stage │ ├── dev-stage.ts │ ├── prd-stage.ts │ └── stg-stage.ts ├── cdk.json ├── parameter.ts parameter.tsで定義した 内容を渡している
©Fusic Co., Ltd. 19 Stage 実装例の紹介 . ├── bin │
└── infra.ts ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts │ └── stage │ ├── dev-stage.ts │ ├── prd-stage.ts │ └── stg-stage.ts ├── cdk.json ├── parameter.ts Stage配下の全ての Stackに渡される
©Fusic Co., Ltd. 20 Stack 実装例の紹介 . ├── bin │
└── infra.ts ├── lib │ ├── aspects │ │ └── removal-policy-aspect.ts │ ├── constructs │ │ └── vpc.ts │ │ └── ecs.ts │ ├── stack │ │ └── infra-stack.ts │ └── stage │ ├── dev-stage.ts │ ├── prd-stage.ts │ └── stg-stage.ts ├── cdk.json ├── parameter.ts タグやRemovalPolicyを 環境ごとに一元管理 環境ごとのパラメータ
©Fusic Co., Ltd. 21 まとめ StageはStackを包括することができる概念 Point 01 Stageによってparameterやaspectsを効率的に渡すことができる Point
02 StageによってStackのenvによるガードレールを効率的に使用できる Point 03
©Fusic Co., Ltd. 22 まとめ Stageを活用してCDKの強さを引き出そう!
©Fusic Co., Ltd. 23 Thank You We are Hiring! https://recruit.fusic.co.jp/
ご清聴いただきありがとうございました