Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Terraform で作る Amazon ECS の CI/CD パイプライン
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hiyanger
January 18, 2025
Programming
540
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Terraform で作る Amazon ECS の CI/CD パイプライン
栃木ゆる勉強会(2025/1/18)
https://tochigi-study.connpass.com/event/337526/
登壇 / 20分
hiyanger
January 18, 2025
More Decks by hiyanger
See All by hiyanger
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
270
Terraform やるなら公式スタイルガイドを読もう 〜重要項目 10選〜
hiyanger
14
4.2k
(Amazon Bedrock 基礎)生成 AI の活用に導くシステム構築の基本とセキュリティの実装
hiyanger
4
160
CIer に在籍した 3年間 でやったこと
hiyanger
2
450
これからクラウドエンジニアになるために本当に必要なスキル 5選
hiyanger
1
850
クラウド食堂とは?
hiyanger
0
490
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
1.6k
全身全霊で取り組んだ 2024 Qiita アドベントカレンダー
hiyanger
0
140
【AWS】EC2 基本アーキテクチャ(ハンズオン付き)
hiyanger
0
350
Other Decks in Programming
See All in Programming
AHC070解法紹介
eijirou
0
150
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
740
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
4
400
WebRTC映像をAirPlayに対応させる挑戦.pdf
monolithic_adam
0
330
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
240
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
320
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
420
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.3k
iOSDCのペンライトを自動制御したい!
akkeylab
0
330
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
180
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
150
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.2k
Featured
See All Featured
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
930
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
Bash Introduction
62gerente
615
220k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
How to train your dragon (web standard)
notwaldorf
97
6.8k
Utilizing Notion as your number one productivity tool
mfonobong
4
610
Thoughts on Productivity
jonyablonski
76
5.4k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
Docker and Python
trallard
47
4.2k
Transcript
Terraform で作る Amazon ECS の CI/CD
自己紹介 名前 / 檜山 準(ひやんが / hiyanger) 職種 / AWS
エンジニア 所属 / クラウド系 SIer 出身 / 栃木県 宇都宮市 趣味 / ギター 🎸 @hiyanger
自己紹介 出身 / 宇都宮 錦小学校 陽北中学校 宇都宮北高
自己紹介 名前 / 檜山 準(ひやんが / hiyanger) 職種 / AWS
エンジニア 所属 / クラウド系 SIer 出身 / 栃木県 宇都宮市 趣味 / ギター 🎸 @hiyanger
自己紹介 AWS でやってきたこと 現 SIer には 2022/12 入社 そこから AWS
をさわり始める
自己紹介 本日は改めて ご参加ありがとうございます! うーたんさんとの初回は東京の LT会、めぐろ LT 会にて。 その後、企画からお誘いいただ きました🙏
Terraform で作る Amazon ECS の CI/CD
はじめに ※補足 各用語の概要 Terraform コードでインフラが作れる IaC のひとつ。コードはインフラエ ンジニアにも優しい。 ECS AWS
で使われるコンテナの代 表格。オーケストレーション的 なこともできちゃう。 CI/CD コードの変更からビルド、テス ト、デプロイまで自動化。
もくじ 1. どのような CI/CD パイプラインを作るかの検討 2. 実際に CI/CD パイプラインを構築
1.どのような CI/CD パイプライン を 作るかの検討
どのような CI/CD パイプラインを作るかの検討 もくじ 1. GitHub Actions のみ 2. AWS
Code シリーズ のみ 3. GitHub Actions + AWS Code シリーズ
どのような CI/CD パイプラインを作るかの検討 1. GitHub Actions のみ メリット .yml 1つで完結する
デメリット ・AWS との複数の API 連携で処理が増える ・Blue/Green が できなさそう
どのような CI/CD パイプラインを作るかの検討 2. AWS Codeシリーズ のみ メリット ・他サービスと 連携しやすいし柔軟
・Blue/Green、ロール バックも可能 デメリット IAM ロールの管理が 増える
どのような CI/CD パイプラインを作るかの検討 3. GitHub Actions + AWS Codeシリーズ メリット
・単独で使う場合の 煩雑性を解消できる ・アプリとインフラの境 界を明確にできる💡 デメリット 両方の管理が必要
どのような CI/CD パイプラインを作るかの検討 アプリとインフラの境界を明確化(例) アプリは GitHub Actions!インフラは Code シリーズ! appspec.yml
migrations.sql dockerfile 等 pipeline.tf
2. 実際に CI/CD パイプラインを 構築
実際に CI/CD パイプラインを構築 構成図 💡ポイント💡 ・アプリとインフラが いる ・GHA と Code
シリーズ が混在
実際に CI/CD パイプラインを構築 構築のながれ 1. GitHub Actions 2. 基本リソースの作成 3.
AWS Code シリーズ
実際に CI/CD パイプラインを構築 1. GitHub Actions ・dockerfile から docker image
をビルド ・docker image を ECR に push (💡OIDC 接続 / AWS クレデンシャル配置不要) ・migrations.sql を S3 へ配置 OIDC
はじめに 1. GitHub Actions / Terraform(IAMロール) OIDC で GitHub からの
アクセスを許可💡
実際に CI/CD パイプラインを構築 2.基本リソースの作成 ・ECS ・VPC ・RDS ・ALB ・S3 VPC
VPC
はじめに 2.基本リソースの作成 / Terraform(ECS) deployment_conrroller は CODE_DEPLOY💡
実際に CI/CD パイプラインを構築 3. AWS Code シリーズ ・CodePipeline ・CodeBuild 💡RDS
が プライベートサブネットに あると VPC への配置と NAT GW が必要 ・CodeDeploy 💡ログがないのでエラーがでるとつらい
実際に CI/CD パイプラインを構築 3. AWS Codeシリーズ / Terraform(CodeDeploy) ロールバックや、 Blue/Green
はここで設定💡
実際に CI/CD パイプラインを構築 パイプラインを流してみる ECR へプッシュ DB マイグレーション ECS デプロイ
ECR からトリガー
参考 ・より詳細な自分の Qiita 記事(GHA やTerraformのコードはこちらから) 【AWS】ECS CI/CD の作り方(GitHub Actions /
Code シリーズ / Terraform) https://qiita.com/hiyanger/items/05d9203048d09da28288 ・ECS用のCDパイプラインに対する考察 https://zenn.dev/reireias/articles/8e987af2762eaa#3.-image-build%E3%81%AE%E3%81% BFgithub-actions%E3%81%A7%E3%82%84%E3%82%8B ・AWSとGitHubを用いたパターン別CI/CD構成解説 https://speakerdeck.com/tsukuboshi/cdgou-cheng-jie-shuo?slide=29 ・GitHub Actions から ECR に Docker イメージを push する https://zenn.dev/kou_pg_0131/articles/gh-actions-ecr-push-image#1.-github-actions-%E 7%94%A8%E3%81%AE-id-%E3%83%97%E3%83%AD%E3%83%90%E3%82%A4%E3%83%80 %E3%81%A8-iam-%E3%83%AD%E3%83%BC%E3%83%AB%E3%82%92%E4%BD%9C%E6%88 %90%E3%81%99%E3%82%8B
以上です。 ありがとうございました! 今後とも「栃木ゆるIT勉強会」を よろしくおねがいします!