Immutable Infrastructure
As a default architectural pattern in MSA world
JEEConf 2017
Volodymyr Tsap
About me
15 years supporting Linux for money
10 years Enterprise Java Applications
and SDK’s support
8 years as a CTO in own company
What is Immutable Infrastructure?
Splitting data storage with the
application environment
Component replacement instead
of applying configuration
changes
Classic Model
OS v1.0
App v1.0
Immutable model
The difference in upgrade process
App v1.1
App v1.0
OS v1.0
Reboot
Instance A
Instance A
App v1.0
OS v1.0
Instance A
App v1.1
OS v1.0
Destroy
Instance B
Start new
So, what the problem with Classic
Model?
Classic model
problems
Configuration drift
Classic model
problems
Configuration drift
Undocumented changes
Classic model
problems
Configuration drift
Undocumented changes
Weak reproducibility
Classic model
problems
Configuration drift
Undocumented changes
Weak reproducibility
Dev/Prod env difference
Classic model
problems
Configuration drift
Undocumented changes
Weak reproducibility
Dev/Prod env difference
Avoidance of automation
What is the Solution?
Not Exactly
?
Immutable Infrastructure pattern
in SHALB
Background Infrastructure Support,
DevOps services
40+ production environments,
including HighLoad websites,
Private Clouds, IoT vendors
and PaaS providers
30+ Development Teams, with
different stacks, OS’es,
delivery processes etc..
Background
Objectives:
Consolidate and unify DevOps
processes
Support more environments with
less engineers
Previous
Experience
Configuration Management
is not a panacea
Slow and complex development
for simple things
Software always fails somewhere
Decompose all supported systems
to the bricks
atomic replaceable unit
What could be the atomic replaceable unit?
Application instance: Elastic Beanstalk, Google App Engine
Container: Docker, RKT, LSX, Kubernetes POD
VM Image: VMDK, AMI, GCOW, ISO
Whole Infrastructure: AWS CloudFormation, Hashicorp Terraform
Where do we deploy units?
So let’s build
the units!
SHALB Delivery Process: Image Delivery Pipeline
OS Version
Local OS
Mirror
Build
Scenario
Packer Script
Configuration,
Software
Ansible CM
Build System
Terraform
Provision
Orchestration
Vagrant
CI/CD Auto Tests
QA Team
GIT
Infrastructure
Delivery Teams
Images
ISO, AMI,
GCOW,LXC,
Docker
Production
Development
SHALB Delivery Process: Custom Vanila OS Pipeline
Let's make own distro!
SHALB Delivery Process: Customer Related Images
Then Build Production Image
SHALB Delivery Process: Add software /Apply Configuration Changes
Can’t be immutable now? Use Hybrid Pipeline:
Summary
We can rely on any orchestration available
on premise or on public cloud.
We can scale a billions instances without the
pain managing every OS.
Don’t have time to build custom
pipelines?
Use available free instruments!
Immutable patterns
in Public Clouds
Quick Examples
Toolsets to build II by vendors
Docker toolset: Composer, Registry, Swarm
Amazon AWS Services, AMI-backed, AWS Container Engine
Google Cloud Immutable Images for GCE and K8
Openstack Heat Orchestration Templates
Vmware Photon Platform
Example #1:
AWS Elastic Beanstalk.
Immutable Deployment Method
AWS Elastic Beanstalk. What is this?
● Fast and simple application deployment
● Pre-installed environments Java Tomcat and Java SE
● Compile and build during deploy: javac maven ant gradle
● Auto-scaling, Load Balancing, AWS resources RDS, S3 etc..
Code Sample
AWS Elastic Beanstalk Deployment Options
Example #2: Google Cloud
Automated Image Builds with
Jenkins, Packer, and Kubernetes
Google Compute Engine: Raw OS image provisioned with CM
Google Compute Engine: Foundation image
Google Compute Engine: Immutable image
Google Guide: Automated Image Builds with Jenkins, Packer, and Kubernetes
Guide: https://cloud.google.com/solutions/automated-build-images-with-jenkins-kubernetes
Google Project on Github: https://github.com/GoogleCloudPlatform/kube-jenkins-imager
Example #3:
AWS CloudFormation
Infrastructure From Templates
Amazon CloudFormation
● Create templates for the service or application
architectures
● Quick and reliable provisioning of the services or
applications (called “stacks”).
● Update or replicate the stacks as needed.
● Sample solution templates show how to create an
end-to-end solution with common applications.
Amazon CloudFormation UI and Code Sample
To Take Away
Split your apps and the data
Deliver apps with the OS
CM approach is not a panacea
Pre-build images are more reliable and then provisioned
It is not so complex to build own image delivery
What to read next?
Using Docker. Developing and Deploying Software with Containers
http://shop.oreilly.com/product/0636920035671.do#
Book for SRE in Google
https://landing.google.com/sre/book/index.html
Terraform: Up & Running By Yevgeniy Brikman
http://www.terraformupandrunning.com/
Amazon Professional Services Implementation Sample
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production*
https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-life-without-ssh-immutable-
infrastructure-in-production-sac318
Thank you! Questions?
Volodymyr Tsap
Co-founder/CTO at SHALB.com
Email: voa@shalb.com
Skype: volodymyr.tsap
Linkedin: voatsap
Facebook: volodymyr.tsap
Deleted slides here
Infrastructure as a code, versioning
Environment “time machine”, Scaling OOB
No dependencies for 3rd party repositories
Immutable Infrastructure advantages
Good for:
DevOps
Developers
Good for:
Quality Assurance
CI/CD integration
Quick tests for infrastructure
Immutable Infrastructure advantages
Perfectly fits for Microservices
Immutable Infrastructure advantages
Good for:
Software Architect
Product Managers
Product Owners
Maintenance cost for big deployments
Immutable Infrastructure advantages
Good for:
Business Guys
Steakholders
Product Owners

Immutable infrastructure tsap_v2