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
79
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
610
脱ぽちぽちを目指して CDKでインフラ構築をしてみた
hosomatu
0
1.7k
Featured
See All Featured
Music & Morning Musume
bryan
46
6.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.7k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
Rebuilding a faster, lazier Slack
samanthasiow
83
9.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
A better future with KSS
kneath
238
17k
Typedesign – Prime Four
hannesfritz
42
2.7k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
54k
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/
ご清聴いただきありがとうございました