0%

Book Description

Just five years ago, infrastructure as code was a new concept. Today, even banks, governments, and other highly regulated organizations are moving to the cloud, leading teams everywhere to build up large, complex infrastructure codebases. With this practical book, Kief Morris of ThoughtWorks shows you how to effectively use principles, practices, and patterns pioneered by infrastructure and development teams to manage cloud age infrastructure.

Ideal for system administrators, infrastructure engineers, software developers, team leads, and architects, this insightful second edition demonstrates the tools you need for implementing infrastructure as code. You’ll learn about the platforms and tooling involved in creating and configuring infrastructure elements, patterns for using these tools, and practices for making infrastructure as code work in your environment.

In four parts, this book covers:

  • Foundations: Understand how to use Infrastructure as Code to drive continuous change and raise the bar of operational quality.
  • Working with infrastructure stacks: Learn practical patterns and approaches for defining, provisioning, testing, and continuously delivering changes to infrastructure resources.
  • Working With Servers And Other Application Runtime Platforms: Discover patterns for provisioning and configuring servers and clusters for deploying applications.
  • Working With Larger Systems and Teams: Consider workflows and governance, as well as architectural patterns, for creating and managing many different infrastructure elements.

Table of Contents

  1. Preface
    1. How I Learned to Stop Worrying and to Love the Cloud
      1. The Sorcerer’s Apprentice
      2. Cloud from Scratch
      3. Legacy cloud infrastructure
    2. Why I Wrote This Book
    3. Why A Second Edition
    4. Who This Book Is For
    5. What Tools Are Covered
    6. Principles, Practices, and Patterns
    7. The FoodSpin examples
    8. Conventions Used in This Book
    9. O’Reilly Online Learning
    10. How to Contact Us
  2. I. Foundations
  3. 1. What is Infrastructure as Code?
    1. From the Iron Age to the Cloud Age
    2. Infrastructure as Code
      1. Benefits of Infrastructure as Code
    3. Use Infrastructure as Code to optimize for change
      1. Objection: “We don’t make changes often enough to justify automating them”
      2. Objection: “We should build first and automate later”
      3. Objection: “We must choose between speed and quality”
    4. Three core practices for Infrastructure as Code
      1. Core practice: Define everything as code
      2. Core practice: Continuously validate all your work in progress
      3. Core practice: Build small, simple pieces that you can change independently
    5. The parts of an infrastructure system
    6. Conclusion
  4. 2. Principles of Cloud Age Infrastructure
    1. Principle: Assume systems are unreliable
    2. Principle: Make everything reproducible
    3. Pitfall: Snowflake systems
    4. Principle: Create disposable things
    5. Principle: Minimize variation
      1. Configuration Drift
    6. Principle: Ensure that you can repeat any process
    7. Conclusion
  5. 3. Infrastructure Platforms
    1. What is a dynamic infrastructure platform?
    2. Infrastructure Resources
    3. Compute Resources
      1. Virtual machines
      2. Physical servers
      3. Containers
      4. Server clusters
      5. Serverless code execution (FaaS)
    4. Storage Resources
      1. Block storage (virtual disk volumes)
      2. Object storage
      3. Networked filesystems (shared network volumes)
      4. Structured data storage
      5. Secrets management
    5. Network Resources
      1. Network address blocks
      2. Traffic management and routing
      3. Network access rules
      4. Caches
      5. Service meshes
    6. Conclusion
  6. 4. Core Practice: Define everything as code
    1. Why you should define your infrastructure as code
    2. What you can define as code
      1. Choose tools that are configured with code
      2. Manage your code in a version control system
      3. Secrets and source code
    3. Infrastructure coding languages
      1. Scripting your infrastructure
      2. Building infrastructure with declarative code
      3. DSLs for infrastructure
      4. The return of general-purpose languages for infrastructure
    4. Implementation Principles for defining infrastructure as code
      1. Implementation Principle: Avoid mixing different types of code
      2. Implementation Principle: Separate infrastructure code concerns
      3. Implementation Principle: Treat infrastructure code like real code
    5. Conclusion
  7. II. Working With Infrastructure Stacks
  8. 5. Building Infrastructure Stacks as Code
    1. What is an infrastructure stack?
      1. Stack code
      2. Stack instance
      3. Configuring servers in a stack
    2. Patterns and antipatterns for structuring stacks
      1. Antipattern: Monolithic Stack
      2. Pattern: Application Group Stack
      3. Pattern: Service Stack
      4. Pattern: Micro Stack
    3. Conclusion
  9. 6. Using Modules to Share Stack Code
    1. Examples of using modules
    2. Patterns and antipatterns for infrastructure modules
      1. Pattern: Facade Module
      2. Antipattern: Anemic Module
      3. Pattern: Domain Entity Module
      4. Antipattern: Spaghetti Module
      5. Antipattern: Obfuscation Layer
      6. Antipattern: One-shot Module
    3. Conclusion
  10. 7. Building Environments With Stacks
    1. What environments are all about
      1. Release delivery environments
      2. Multiple production environments
      3. Environments, consistency, and configuration
    2. Patterns for building environments
      1. Antipattern: Multiple-Environment Stack
      2. Antipattern: Copy-Paste Environments
      3. Pattern: Reusable Stack
    3. Building environments with multiple stacks
    4. Conclusion
  11. 8. Configuring Stacks
    1. Using stack parameters to create unique identifiers
    2. Example stack parameters
      1. Handling secrets as parameters
    3. Patterns for configuring stacks
      1. Antipattern: Manual Stack Parameters
      2. Pattern: Stack Environment Variables
      3. Pattern: Scripted Parameters
      4. Pattern: Stack Configuration Files
      5. Pattern: Wrapper Stack
      6. Pattern: Pipeline Stack Parameters
      7. Pattern: Stack Parameter Registry
    4. Configuration Registry
      1. Implementing a Configuration Registry
      2. Single or multiple configuration registries
      3. Configuration Management Database (CMDB)
    5. Conclusion
  12. 9. Core Practice: Continuously validate all work in progress
    1. Why continuously validate infrastructure code?
      1. What continuous validation means
      2. What should we validate with infrastructure?
    2. Challenges with testing infrastructure code
      1. Challenge: Tests for declarative code often have low value
      2. Challenge: Testing infrastructure code is slow
    3. Progressive validation
      1. Validation stages
      2. Testing in production
    4. Progressive validation models
      1. Test pyramid
      2. Swiss cheese testing model
    5. Pipelines for validation
      1. Pipeline stages
      2. Delivery pipeline software and services
    6. Conclusion
  13. 10. Testing Infrastructure Stacks
    1. Example infrastructure
      1. The example stack
      2. Pipeline for the example stack
    2. Offline validation stages for stacks
      1. Syntax checking
      2. Offline static code analysis
      3. Static code analysis with API
      4. Testing with mock API
    3. Online validation stages for stacks
      1. Preview: Seeing what changes will be made
      2. Verification: Making assertions about infrastructure resources
      3. Outcomes: Proving infrastructure works correctly
    4. Using test fixtures to handle dependencies
      1. Test doubles for upstream dependencies
      2. Test fixtures for downstream dependencies
    5. Lifecycle patterns for test instances of stacks
      1. Pattern: Persistent test stack
      2. Pattern: Ephemeral test stack
      3. Antipattern: Dual Persistent and Ephemeral Stack Stages
      4. Pattern: Periodic stack rebuild
      5. Pattern: Continuous stack reset
    6. Test orchestration
      1. Support local testing
      2. Avoid tight coupling with pipeline tools
      3. Test orchestration tools
    7. Conclusion
18.116.239.195