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
100
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
150
完全IT未経験の消防士が Fusicのエンジニアになるまでに取り組んだこと
hosomatu
1
290
圧倒的サポート力! Amazon Q× CDK 開発のすすめ
hosomatu
3
640
脱ぽちぽちを目指して CDKでインフラ構築をしてみた
hosomatu
0
1.8k
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
53
7.7k
How to Ace a Technical Interview
jacobian
278
23k
Measuring & Analyzing Core Web Vitals
bluesmoon
8
550
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
Unsuck your backbone
ammeep
671
58k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
6k
Navigating Team Friction
lara
188
15k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
139
34k
Statistics for Hackers
jakevdp
799
220k
Automating Front-end Workflow
addyosmani
1370
200k
The Art of Programming - Codeland 2020
erikaheidi
54
13k
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/
ご清聴いただきありがとうございました