SlideShare a Scribd company logo
INFRASTRUCTURE
AS CODE
@cfgmgmtcamp
kief@thoughtworks.com
Cloud Practice Lead (UK)
DevOps, Continuous Delivery, Agile Ops
Twitter: @kief
Book: http://oreil.ly/1JKIBVe
Site: http://infrastructure-as-code.com
February 2017
SPEED
RISK
FASTER IS
SAFER
http://bit.ly/2cQQSOk
RAPID
RESPONSIBLE
INFRASTRUCTURE
AS CODE
Applying tools and practices from
software engineering to managing
infrastructure.
DEFINE SYSTEMS AS CODE
System design is:
▪ Reusable
▪ Consistent
▪ Visible
▪ Versioned
DYNAMIC INFRASTRUCTURE
PLATFORMS
Compute Storage
Network
DYNAMIC INFRASTRUCTURE
PLATFORMS
Cloud (IaaS)
Virtual
Physical
Compute Storage
Network
PROGRAMMABLE,
ON-DEMAND
API
Cloud and automation
AWESOME!
Oh, no!
SERVER SPRAWL!
CONFIGURATION
DRIFTServers start
out identical
But changes
accumulate
over time
AUTOMATION FEAR
CYCLE
AUTOMATION LAG
The longer it’s been since an automated
process has run in the same context …
… the more work is needed to run it again
Apply small changes frequently
rather than large batches infrequently
CONTINUOUSLY SYNCHRONIZE
OR CONTINUOUSLY REBUILD
DEVOOPS
How can we avoid damage from
automated mistakes?
AUTOMATICALLY TEST EVERY CHANGE
PROMOTE CHANGES
TEST
SIT
PROD
QA
BUILD COMPLIANCE INTO THE PIPELINE
Humans focus on the
implementation of the
pipeline and audit trailsUse the pipeline to continuously
validate operational requirements and
compliance, and to implement controls
INFRASTRUCTURE
DESIGN PATTERNS
Organizing code for dynamic
infrastructure
One definition,
multiple
environments
our-project/main.tf
staging
production
INFRASTRUCTURE
DESIGN PRINCIPLE
Structure your code to minimize risks for
making (small, frequent) changes
our-project/staging/main.tf
staging
production
our-project/production/main.tf
One definition
per environment
our-project/main.tf
staging
production
development
Single
definition
template,
promoted
across
environments
How do we build and test
this stuff?
It runs sooooo sloooooow! L
Nginx Cookbook
ORGANIZE INFRASTRUCTURE INTO
SEPARATELY TESTABLE PIECES
Tomcat Cookbook
JDK Cookbook
MyApp Vhost Cookbook
MyApp.war
Application
Server
Web
Server
FAN-IN PIPELINES
TEST
TOMCAT
COOKBOOK
TEST MYAPP
CODE
TEST JDK
COOKBOOK
TEST APP
SERVER
TEST MYAPP
DEPLOYMENT
Test components
individually
Cumulatively integrate and
test components together
DESIGNING FOR CHANGE
Cope with growth, evolving
requirements, expanding teams
DESIGN TO ENABLE FREQUENT
CHANGES
Split infrastructure
according to the
scope of typical
changes
Minimize the risk of
changes by limiting
the blast radius
Keep infrastructure
units loosely
coupled
ALIGN INFRASTRUCTURE DESIGN WITH
ORGANIZATION STRUCTURE
WHERE
SHOULD WE
SPLIT?
WHERE
SHOULD WE
SPLIT?
Split
infrastructure in
ways that
reduce the
friction for
making changes
SHARING
How can teams share their stuff?
LIBRARY PATTERN FOR INFRA
Tested server
images
BUILD TEST
BUILD TEST PROD
BUILD TEST PROD
Server image pipeline
Application environment pipelines
DECOUPLED CHANGE PIPELINES
Application A with its environment
TESTBUILD
Application B
TESTBUILD
Application C
TESTBUILD
QA PROD
QA PROD
QA PROD
HANDLING DEPENDENCIES
TESTBUILD QA PROD
TESTBUILD QA PROD
Self-service
test instances
Consumer
Driven Contract
(CDC) Tests
Mocks,
stubs, and
fakes
CYCLE TIME
Measure and optimize the elapsed
time from identifying a need to
satisfying it
SOME ACTIVITIES TO
MEASURE
Rebuild (Recover)
New environment
Update existing environments
Introducing a new tech stack
SOME OTHER BOOKS
Book: http://oreil.ly/1JKIBVe
Site: http://infrastructure-as-code.com
Twitter: @kief
kief@thoughtworks.com
Cloud Practice Lead (UK)
DevOps, Continuous Delivery, Agile Ops

More Related Content

Implementing Infrastructure as Code ConfigMgtCamp 2017