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
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
500
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
1.6k
全身全霊で取り組んだ 2024 Qiita アドベントカレンダー
hiyanger
0
140
【AWS】EC2 基本アーキテクチャ(ハンズオン付き)
hiyanger
0
350
Other Decks in Programming
See All in Programming
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
540
パーソナライズPodcastを作った話
repunit11
0
120
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.5k
Are APIs Still Relevant in the AI Era?
soyuka
0
420
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
700
ゲームコントローラやキーボードのファームウェアをSwiftで書く
kishikawakatsumi
1
280
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
310
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
390
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Jetpack Compose Mechanisms
skydoves
2
460
ジョジョの世界をXRで再現する
mofurune
0
130
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
590
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
300
Statistics for Hackers
jakevdp
799
230k
Believing is Seeing
oripsolob
1
240
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
580
Practical Orchestrator
shlominoach
192
12k
Accessibility Awareness
sabderemane
1
230
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
260
Producing Creativity
orderedlist
PRO
348
41k
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勉強会」を よろしくおねがいします!