Date post: | 14-Apr-2017 |
Category: |
Technology |
Upload: | charles-anderson |
View: | 143 times |
Download: | 0 times |
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
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
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
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
Pets vs. Livestock• Snowflakes are like pets
• You become attached
• Cute names
• Long-lived
• You want livestock
• Generic machines that come and go
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
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
How?
• We want an API for the Cloud so we can write “programs” to create our infrastructure
• “Amazon” is actually Amazon Web Services (AWS)
Infrastructure as Code• If we write scripts/programs:
• Use version control
• Have documentation
• Can audit and/or test
• Automate and meta-automate
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
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
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
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)
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
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
Resources• http://www.slideshare.net/ws.cander/inrastructure-as-code
• http://martinfowler.com/bliki/InfrastructureAsCode.html
• https://info.thoughtworks.com/Infrastructure-as-Code-Kief-Morris.htmlhttps://www.manning.com/books/amazon-web-services-in-action
• https://www.hashicorp.com/
• https://aws.amazon.com/ https://cloud.google.com/