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
2
110
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
160
完全IT未経験の消防士が Fusicのエンジニアになるまでに取り組んだこと
hosomatu
1
290
圧倒的サポート力! Amazon Q× CDK 開発のすすめ
hosomatu
3
670
脱ぽちぽちを目指して CDKでインフラ構築をしてみた
hosomatu
0
1.8k
Featured
See All Featured
A better future with KSS
kneath
239
17k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
Thoughts on Productivity
jonyablonski
70
4.9k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
960
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.7k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Balancing Empowerment & Direction
lara
4
680
Side Projects
sachag
455
43k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.5k
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/
ご清聴いただきありがとうございました