5. In the Beginning
• We had racks of servers, and
disks, and switches
• And lots and lots of cables
• And, we liked it!
• Sometimes known as the Iron
Age
7. Also sprach Zarathustra
• Jeff Bezos gave us Amazon
Elastic Compute Cloud (EC2)
• Configure a server machine
from a simple web-app, pay
by the hour
• Awesome - no need to dirty
our hands with hardware
9. Problems in Paradise
• Scaling - provisioning servers manually from a web
app doesn’t scale
• Inconsistency - as machines get configured
manually (by different people) they diverge
• behavior differences
• security vulnerabilities - compliance nightmare
• These are called “snowflakes” - bad
10. Problems: Fragility
• You’re never really confident about snowflakes
which means you’re afraid to change/update them
• Even if you are confident, probably too lazy -
(re)building machines manually is time consuming
11. Pets vs. Livestock
• Snowflakes are like pets
• You become attached
• Cute names
• Long-lived
• You want livestock
• Generic machines that
come and go
12. Appetite
• Add/remove nodes quickly
• Have identical nodes within the same role
• Achieve freedom to kill and rebuild at will - Phoenix
machines
• Also - similarity between production, test and
staging environments
• Bonus if you can make dev similar to production
13.
14. Results
• Consistent, scalable application and infrastructure
• Up-to-date, well-patched infrastructure
• Immutable infrastructure - c.f. immutable types
• Agile: make changes and rollback quickly
• Ability to experiment - spin up and kill machines
15. How?
• We want an API for the Cloud so we can write
“programs” to create our infrastructure
• “Amazon” is actually Amazon Web Services (AWS)
16. Infrastructure as Code
• If we write scripts/programs:
• Use version control
• Have documentation
• Can audit and/or test
• Automate and meta-automate
17. Not Just Amazon
• Although we’re talking about Amazon, there are lots
of other public cloud providers and private/on-
premises options with APIs
• Google, RackSpace, OpenStack
• Aside: (Certified) Amazon Architect is a thing
• My view is Linux-centric - Azure also has an API
• Platform as a Service (PaaS) is another option
18. Automating Amazon
• You can roll your own - there are plenty of API
libraries for AWS in various languages
• AWS CLI - command line
• AWS Cloud Formation tool - JSON
• AWS Elastic Beanstalk
• All free, as in beer but not speech
19. HashiCorp
• HashiCorp is company that makes open-source tools
for infrastructure automation
• started when Hashimoto was a student
• Packer builds images (OS + app) to deploy on nodes
- called AMIs on Amazon
• Terraform builds infrastructure - nodes, private
networks, identities, storage, DBs, etc.
• Consul - service discovery
20. IaC in the Small
• HashiCorp has two tools for building virtual
environments on your own computer
• Vagrant - provisions and starts one or more VMs for
your development environment
• Also useful to test image builds locally
• Otto - successor to Vagrant that can build
production infrastructure, too (via Terraform)
21. Free Beer!
• You can do all of this for free (at a small scale)
• Amazon, Google, others
• No longer restricted to big companies - democratizing
• All of these tools are free - tons for free docs
• HashiCorp tools are OSS - chance to contribute
22. Conclusion
• Infrastructure as Code is an evolution from the Iron
Age to the Cloud Age
• Allows rapid changes in size or function of
infrastructure
• Facilitates rapid business development - $$$
• You can get started for free