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とAWS ECSに入門しました
Search
Yusuke Sasaki
May 24, 2019
Technology
100
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TerraformとAWS ECSに入門しました
社内LT資料
https://booth.pm/ja/items/1316133
を読んだ話
Yusuke Sasaki
May 24, 2019
Other Decks in Technology
See All in Technology
その Valkey 使いこなしていますか?
onk
PRO
5
1.8k
「私が一番顧客に詳しい」を捨てる~ 全員が一次情報に精通する開発チームをつくり、PMが次のボトルネックへ染み出すまで
kaminashi
1
780
What Is JetBrains Air
x5gtrn
PRO
0
130
日本語に強いオープンな大規模言語モデル「LLM-jp」
odashi
5
1.2k
初海外で注意すべきこと12選!!!安全快適なre:invent生活にするために
yuuuuuuu168
1
190
20年間 SNS サービス「GREE」 を支えた技術の刷新と、長期運用サービスの Kubernetes へのリアーキテクト
gree_tech
PRO
0
100
Getting Started with Google Antigravity
glaforge
0
350
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
1
230
実践!Cloud Run ハンズオン!! / Cloud Run handson
y0hgi
2
300
LLM-as-a-Judgeは本当に信頼できるのか――評価器を評価する話
taka_aki
2
980
AI駆動で「他アプリの音を加工できる」アプリを作った
satomasahiro2005
0
190
Metadata - Section 1: HTML Basics
mohab1
0
140
Featured
See All Featured
Faster Mobile Websites
deanohume
310
32k
Chasing Engaging Ingredients in Design
codingconduct
0
370
Paper Plane (Part 1)
katiecoart
PRO
2
12k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
280
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Docker and Python
trallard
47
4.2k
Ruling the World: When Life Gets Gamed
codingconduct
0
410
Mobile First: as difficult as doing things right
swwweet
225
10k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
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