Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Patterns In Infrastructure as Code
Takeshi Kondo
April 24, 2020
Technology
8
4.7k
Patterns In Infrastructure as Code
Infra Study Meetup#1
https://forkwell.connpass.com/event/171560/
Takeshi Kondo
April 24, 2020
Tweet
Share
More Decks by Takeshi Kondo
See All by Takeshi Kondo
Who owns the Service Level?
chaspy
5
7.4k
多様な働き方を支える Working Agreements / Working agreements that support diverse work styles
chaspy
1
1.3k
SRE を実現するための組織マネジメント / Management to achieve SRE
chaspy
3
4.3k
サービス立ち上げ期におけるSREの取り組み / SRE efforts in the service launch phase
chaspy
0
950
Implementing Site Reliability Engineering in your organization
chaspy
6
2.4k
How to measure "Site Reliability Engineering"
chaspy
6
2.4k
Site Reliability Engineering における 重要領域とパフォーマンス指標の提案 / Performance Indicators for SRE
chaspy
1
2.1k
Metric-Driven Decision Making with Custom Prometheus Exporter
chaspy
1
1.1k
想定外の負荷を乗り切ったオンライン教育サービスの裏側 / How We Overcame the COVID-19 Crisis
chaspy
7
5.6k
Other Decks in Technology
See All in Technology
IoTを始めたきっかけの話と個人でできるIoTの今後 / 新年LT会「私の愛するIoT 2023」
you
0
170
Dev Containers ことはじめ - 失敗から学ぶ開発環境運用法
streamwest1629
0
310
データ分析基盤の要件分析の話(202201_JEDAI)
yabooun
0
200
経営統合をきっかけに会社をエンジニアリングした話 / btconjp-2023
carta_engineering
0
140
Optimizing your Swift code
kateinoigakukun
0
1.3k
Pentesting Password Reset Functionality
anugrahsr
0
240
cdk deployに必要な権限ってなんだ?
kinyok
0
140
230120 ガンダムの事例にみる自動化の対象 Haruka Oh!さん
comucal
PRO
0
120
OpenShift.Run2023_create-aro-with-terraform
ishiitaiki20fixer
1
180
OVN-Kubernetes-Introduction-ja-2023-01-27.pdf
orimanabu
1
250
Stripe / Okta Customer Identity Cloud(旧Auth0) の採用に至った理由 〜モリサワの SaaS 戦略〜
tomuro
0
110
AWS re:Invent 2022で発表された新機能を試してみた ~Cloud OperationとSecurity~ / New Cloud Operation and Security Features Announced at AWS reInvent 2022
yuj1osm
1
160
Featured
See All Featured
Pencils Down: Stop Designing & Start Developing
hursman
114
10k
Clear Off the Table
cherdarchuk
79
290k
Teambox: Starting and Learning
jrom
124
7.9k
Music & Morning Musume
bryan
37
4.6k
Support Driven Design
roundedbygravity
88
8.9k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
6
840
Building Adaptive Systems
keathley
27
1.3k
Infographics Made Easy
chrislema
235
17k
Git: the NoSQL Database
bkeepers
PRO
418
60k
Optimizing for Happiness
mojombo
365
64k
Creatively Recalculating Your Daily Design Routine
revolveconf
207
11k
Adopting Sorbet at Scale
ufuk
65
7.8k
Transcript
Patterns In Infrastructure as Code Takeshi Kondo / @chaspy Infra
Study Meetup #1
Passed
Agenda • Infrastructure as Code in Quipper • Patterns in
Infrastructure as Code 1. Environment Pattern 2. Scaffold Pattern 3. Backup Pattern
Agenda • Infrastructure as Code in Quipper • Patterns in
Infrastructure as Code 1. Environment Pattern 2. Scaffold Pattern 3. Backup Pattern • What • Why • Point • Example
Agenda • Infrastructure as Code in Quipper • Patterns in
Infrastructure as Code 1. Environment Pattern 2. Scaffold Pattern 3. Backup Pattern
Infrastructure as Code in Quipper (1) • Infrastructure / Cloud
(AWS) • Terraform • Codenize.tools (Miam, Roadworker) • Application Platform (Kubernetes) • Kube-aws • Server Provisioning • Ansible
Infrastructure as Code in Quipper (2) • SaaS Configuration •
Datadog • Dashboard • SLO • Monitor • Pingdom • Deadman’s snitch • CircleCI • Environment Variables
Infrastructure as Code in Quipper(2) • SaaS Configuration • Datadog
• Dashboard • SLO • Monitor • Pingdom • Deadman’s snitch • CircleCI • Environment Variables Terraform Codenize.tools (Barkdog) circleci-env (Internal tool)
Infrastructure as Code in Quipper(2) • SaaS Configuration • Datadog
• Dashboard • SLO • Monitor • Pingdom • Deadman’s snitch • CircleCI • Environment Variables Terraform Codenize.tools (Barkdog) circleci-env (Internal tool)
Infrastructure as Code in Quipper(2) • SaaS Configuration • Datadog
• Dashboard • SLO • Monitor • Pingdom • Deadman’s snitch • CircleCI • Environment Variables Terraform Codenize.tools (Barkdog) circleci-env (Internal tool)
Agenda • Infrastructure as Code in Quipper • Patterns in
Infrastructure as Code 1. Environment Pattern 2. Scaffold Pattern 3. Backup Pattern • What • Why • Point • Example
Environment Pattern
Environment Pattern Production Resource Staging Resource Staging Code Production Code
Infrastructure as Code - Chapter 9. Patterns for Defining Infrastructure Apply Apply Change Change
Environment Pattern: Why • To minimize blast radius • To
test before releasing to production
Environment Pattern: Point • Don’t Repeat Yourself • Minimize commonality
• Keep it simple stupid • Enforcing, not communize Infrastructure as Code - 9.2.7 Approaches to Sharing Definitions
Environment Pattern: Example services ᵓᴷᴷ hoge-service ᴹ ᵓᴷᴷ production ᴹ
ᴹ ᵓᴷᴷ aurora.tf ᴹ ᴹ ᵓᴷᴷ main.tf ᴹ ᴹ ᵓᴷᴷ provider.tf ᴹ ᴹ ᵓᴷᴷ terraform.tf ᴹ ᴹ ᵓᴷᴷ terraform.tfvars ᴹ ᴹ ᵓᴷᴷ variables.tf ᴹ ᴹ ᵋᴷᴷ versions.tf ᴹ ᵋᴷᴷ staging ᴹ ᵓᴷᴷ aurora.tf ᴹ ᵓᴷᴷ main.tf ᴹ ᵓᴷᴷ provider.tf ᴹ ᵓᴷᴷ terraform.tf ᴹ ᵓᴷᴷ terraform.tfvars ᴹ ᵓᴷᴷ variables.tf ᴹ ᵋᴷᴷ versions.tf ᵋᴷᴷ modules Terraform ansible ᵋᴷᴷ ubuntu1804 ᵓᴷᴷ reverse-proxy-production ᴹ ᵓᴷᴷ goss ᴹ ᵓᴷᴷ group_vars ᴹ ᴹ ᵓᴷᴷ all.yml ᴹ ᴹ ᵓᴷᴷ development.yml ᴹ ᴹ ᵋᴷᴷ staging.yml ᴹ ᵓᴷᴷ hosts-development ᴹ ᵓᴷᴷ hosts-test ᴹ ᵓᴷᴷ roles ᴹ ᴹ ᵋᴷᴷ nginx ᴹ ᴹ ᵓᴷᴷ files ᴹ ᴹ ᵓᴷᴷ tasks ᴹ ᴹ ᵋᴷᴷ templates ᴹ ᵋᴷᴷ site.yml ᵓᴷᴷ reverse-proxy-staging ᵓᴷᴷ common-roles ᵓᴷᴷ datadog ᵓᴷᴷ td-agent Ansible
Scaffold Pattern
Scaffold Pattern Template Input variable Code Generate
Scaffold Pattern: Why • To make self-service easier • Reduce
cognitive load Infrastructure as Code - 9.1.6 Self-Service Environments
Scaffold Pattern: Point • Write a document • Make each
program do one thing well https://en.wikipedia.org/wiki/Unix_philosophy
Scaffold Pattern: Example • Create new application with Kubernetes manifest
• Create new resource with Terraform HCL • Create AWS Aurora resource definition • Create Datadog SLO Definition
Create AWS Aurora resource definition
Backup Pattern
Backup Pattern Code Resource Import Change manually
Backup Pattern Code Resource Import Change manually Apply
Backup Pattern: Why • Easy to change from GUI (especially
SaaS Configuration) • For backup • For greppability • For bulk replacement
Backup Pattern: Point • Sync Interval • If long, it
may overwrite the actual configuration
Backup Pattern: Example • Datadog Dashboard • Datadog Monitor •
Jenkins Configuration (SCM Sync Plugin)
Datadog Dashboard
Let’s Read http://shop.oreilly.com/product/0636920294382.do
Special Thanks • @suzuki-shunsuke • To lead splitting Terraform state
• To improve CI/CD pipeline • SRE graduates • To introduce of Infrastructure as Code • To build workflow with maintainability
Happy (Infrastructure as) Coding
Thank You! chaspy chaspy_ Site Reliability Engineer at Quipper Takeshi
Kondo Terraform-jp