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
TerraformとAWS ECSに入門しました
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yusuke Sasaki
May 24, 2019
Technology
1
90
TerraformとAWS ECSに入門しました
社内LT資料
https://booth.pm/ja/items/1316133
を読んだ話
Yusuke Sasaki
May 24, 2019
Tweet
Share
Other Decks in Technology
See All in Technology
toCプロダクトにおけるAI機能開発のしくじりと学び / ai-product-failures-and-learnings
rince
6
5.3k
Bill One 開発エンジニア 紹介資料
sansan33
PRO
4
17k
What happened to RubyGems and what can we learn?
mikemcquaid
0
210
2026年、サーバーレスの現在地 -「制約と戦う技術」から「当たり前の実行基盤」へ- /serverless2026
slsops
2
170
システムのアラート調査をサポートするAI Agentの紹介/Introduction to an AI Agent for System Alert Investigation
taddy_919
2
1.5k
Agile Leadership Summit Keynote 2026
m_seki
1
140
Application Performance Optimisation in Practice (60 mins)
stevejgordon
0
120
分析画面のクリック操作をそのままコード化 ! エンジニアとビジネスユーザーが共存するAI-ReadyなBI基盤
ikumi
0
130
Mosaic AI Gatewayでコーディングエージェントを配るための運用Tips / JEDAI 2026 新春 Meetup! AIコーディング特集
genda
0
150
セキュリティについて学ぶ会 / 2026 01 25 Takamatsu WordPress Meetup
rocketmartue
1
270
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
410
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
67k
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
A Tale of Four Properties
chriscoyier
162
24k
Utilizing Notion as your number one productivity tool
mfonobong
2
210
RailsConf 2023
tenderlove
30
1.3k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
76
A better future with KSS
kneath
240
18k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
400
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
88
Transcript
TerraformとAWS TerraformとAWS ECSに入門しました ECSに入門しました 佐々木 2019/05/24 LT大会 佐々木 2019/05/24 LT大会
1 1
技術書典6で買ったterraform本 技術書典6で買ったterraform本 TerraformとAWSに特化したノウハウ本、おす TerraformとAWSに特化したノウハウ本、おす すめ すめ Kubernetesなどクラウドネイティブなアプリ Kubernetesなどクラウドネイティブなアプリ ケーション開発をしてみたという話 ケーション開発をしてみたという話
=> 今回「コンテナ時代の~」を写経しました => 今回「コンテナ時代の~」を写経しました コンテナ時代のWebサービスの作り方 コンテナ時代のWebサービスの作り方 Pragmatic Terraform on AWS Pragmatic Terraform on AWS showKsではじめるクラウドネイティブ開発 showKsではじめるクラウドネイティブ開発 3 3
コンテナ時代のWebサービスの作り方 コンテナ時代のWebサービスの作り方 GitHub/CircleCI/Docker/Terraformなどを使って GitHub/CircleCI/Docker/Terraformなどを使って ECS上でRailsを動かす話 ECS上でRailsを動かす話 4 4
terraformとは terraformとは AWS/Azure/GCPなどのクラウドリソースを構成 AWS/Azure/GCPなどのクラウドリソースを構成 管理するツール 管理するツール AWS EC2インスタンスを管理する例 AWS EC2インスタンスを管理する例
( ( ): ): sample.tf sample.tf provider provider "aws" "aws" { { region region = = "ap-northeast-1" "ap-northeast-1" } } resource resource "aws_instance" "aws_instance" "sandbox" "sandbox" { { ami ami = = "ami-785c491f" "ami-785c491f" instance_type = instance_type = "t2.micro" "t2.micro" } } 5 5
terraformとは terraformとは ディレクトリの初期化、"aws"プロバイダーのた ディレクトリの初期化、"aws"プロバイダーのた めのプラグインをインストール めのプラグインをインストール .tfファイルのdry‑run、変更内容の整合性や差分 .tfファイルのdry‑run、変更内容の整合性や差分 を確認 を確認
.tfファイルを元にインフラを構築する、.tfstate .tfファイルを元にインフラを構築する、.tfstate ファイルに管理下となった状態を格納 ファイルに管理下となった状態を格納 terraform init terraform init terraform plan terraform plan terraform apply terraform apply 6 6
Amazon ECS Amazon ECS Elastic Container Service(ECS) Elastic Container Service(ECS)
Dockerコンテナをサポートするマネージドなコ Dockerコンテナをサポートするマネージドなコ ンテナオーケストレーションサービス ンテナオーケストレーションサービス クラスタ・サービス・タスク定義といった概念 クラスタ・サービス・タスク定義といった概念 がある がある 7 7
Terraform ディレクトリ構成 Terraform ディレクトリ構成 各ディレクトリに対してinit/plan/applyする 各ディレクトリに対してinit/plan/applyする ecr/ // ECR(Docker )
管理 ecr/ // ECR(Docker ) 管理 iam/ // IAM( ) 管理 iam/ // IAM( ) 管理 service/ // ECS( ) 管理 service/ // ECS( ) 管理 vpc/ // VPC(仮想 ) 管理 vpc/ // VPC(仮想 ) 管理 8 8
terraform apply後のアーキテクチャ terraform apply後のアーキテクチャ 9 9
CircleCI デプロイの様子 CircleCI デプロイの様子 10 10
デプロイ(1/3) docker buildしてpush デプロイ(1/3) docker buildしてpush 11 11
デプロイ(2/3) タスク定義更新 デプロイ(2/3) タスク定義更新 12 12
デプロイ(3/3) DB migration デプロイ(3/3) DB migration 13 13
CloudWatch migrationのログ CloudWatch migrationのログ 14 14
まとめ まとめ ECSでwebアプリのCI/CDする環境をterraformを ECSでwebアプリのCI/CDする環境をterraformを 使って構築した 使って構築した 入門したけどどハマりポイントはたくさんあり 入門したけどどハマりポイントはたくさんあり AWS奥が深い AWS奥が深い
特にネットワーク周り理解不足なので今後精進 特にネットワーク周り理解不足なので今後精進 していきます していきます 15 15