Infrastructure as Code, 3rd Edition

Book description

The past decade has seen cloud and infrastructure as code move out of shadow IT and startups and into the mainstream. Many organizations rushed to adopt new technologies as part of their transformation into digital businesses, creating a sprawl of unmaintainable infrastructure codebases. Now, there is a need to consolidate cloud-based systems into mature foundations for sustainable growth.

With this book, Kief Morris describes patterns and practices for building and evolving infrastructure as code. The third edition provides a broader context for infrastructure, explaining how to design and implement infrastructure to better support the strategic goals and challenges of an organization, such as supporting growth while better managing costs.

This book covers:

  • Foundational concepts, including an exploration of declarative and procedural infrastructure languages, where infrastructure code fits into a comprehensive platform strategy and enterprise architecture, and how to test and deliver infrastructure code.
  • Infrastructure architecture, drawing on lessons learned from software design and engineering to build infrastructure codebases that can be evolved and scaled to enable growth and adapt to changing needs.
  • Patterns for building infrastructure to support platform services across the complicated, varied landscapes of real-world IT systems, from physical hardware to virtual servers to cloud-native clusters and serverless workloads.
  • Workflows and operating models that combine automation and cloud with forward-thinking approaches like Agile and DevOps for rigorous governance of compliance, cost, security, and operational quality.

Publisher resources

View/Submit Errata

Table of contents

  1. Brief Table of Contents (Not Yet Final)
  2. I. Foundations
  3. 1. What Is Infrastructure as Code?
    1. Infrastructure as Code
    2. From the Iron Age to the Cloud Age
      1. Cloud Age Approaches To Change Management
      2. The Path To The Cloud Age
    3. Strategic Goals and Infrastructure as Code
    4. System Architecture Goals and Infrastructure as Code
    5. Use Infrastructure as Code to Optimize for Change
    6. Common Myths About Infrastructure Automation and Change
      1. Myth: Infrastructure Doesn’t Change Very Often
      2. Myth: We Can Build the Infrastructure First and Automate It Later
      3. Myth: Speed And Quality Must Be Traded Off Against Each Other
    7. The Four Key Metrics
    8. Core Practices for Infrastructure as Code
      1. Core Practice: Define Everything as Code
      2. Core Practice: Continuously Test and Deliver All Work in Progress
      3. Core Practice: Build Small, Simple Pieces That You Can Change Independently
    9. Conclusion
  4. 2. Principles of Cloud 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 Procedure
    7. Principle: Apply Software Design Principles to Infrastructure Code
    8. Conclusion
  5. 3. Platforms and Toolchains
    1. Capabilities in an Enterprise Architecture
      1. Types of Technology Capabilities
    2. Engineering platforms
      1. Platform Services
      2. Providing Platform Service Functionality
    3. IaaS Platforms
      1. Types of Infrastructure Resources Provided by an IaaS Platform
      2. IaaS in the Data Center
      3. Multicloud
    4. Toolchains for infrastructure and platforms
      1. Infrastructure Delivery Toolchain
      2. Platform Management Toolchain
      3. Application Delivery Toolchain
    5. Conclusion
  6. 4. Defining Infrastructure as Code
    1. The Basics of Defining Infrastructure as Code
      1. What You Can Define as Code
      2. Choose Tools With Externalized Configuration
      3. Manage Your Code in a Source Code Repository
    2. Languages for Coding Infrastructure
      1. Idempotent Code
      2. Declarative Infrastructure Languages
      3. Programmable Infrastructure Languages
      4. Deciding Between Declarative and Imperative Languages
      5. Domain-Specific Infrastructure Languages
      6. Levels of Abstraction In Infrastructure Code
    3. Differences Between Infrastructure Code and Application Code
      1. The Context For Executing Code
      2. Infrastructure Code and Resource Instances
      3. Infrastructure State
    4. Next-Generation Infrastructure
      1. Infrastructure From Code
      2. Infrastructure as Model
    5. Conclusion
  7. II. Design
  8. 5. Design Principles For Infrastructure as Code
    1. Design Considerations For Infrastructure As Code
      1. CUPID Properties for Design
      2. Cohesion and Coupling
      3. Providers, Consumers, and Interfaces
      4. Managing Interfaces Between Components
      5. Using Interfaces for Composability
    2. Design Contexts For Infrastructure Components
    3. Design Forces
      1. Design Forces in the Runtime Context
      2. Design Forces in the Deployment Context
      3. Design Forces in the Code Context
      4. Design Forces Across Contexts
    4. Conclusion
  9. 6. Infrastructure Components
    1. The Infrastructure Components
      1. Starting Infrastructure Design With Workloads
      2. Infrastructure Products
      3. Infrastructure Deployment Stacks
      4. Infrastructure Code Libraries
    2. Sharing and Reusing Infrastructure
      1. Sharing Infrastructure Code Components
      2. Sharing Infrastructure Deployment Stacks
      3. Sharing Runtime Instances of Infrastructure Components
    3. Application-Driven Infrastructure Design
      1. Horizontal Design
      2. Vertical Design
      3. Reference Infrastructure Design Layers
      4. Design Workflow
      5. Start Simple
    4. Conclusion
  10. 7. Design Patterns for Infrastructure Deployment Stacks
    1. Patterns for Sizing and Structuring Stacks
      1. Pattern: Full System Stack
      2. Antipattern: Monolithic Stack
      3. Pattern: Application Group Stack
      4. Pattern: Single Service Stack
      5. Pattern: Micro Stacks
      6. Pattern: Shared Stack
    2. Stack Patterns for Multiple Instances of Infrastructure
      1. Antipattern: Multiple-Environment Stack
      2. Antipattern: Snowflakes As Code
      3. Pattern: Reusable Stack
    3. Conclusion
  11. 8. Configuring Stack Deployment Instances
    1. Key Concepts
      1. Using Stack Parameters to Create Unique Identifiers
      2. Keep Parameters Simple
    2. Example Stack
    3. Patterns for Configuring Stacks
      1. Antipattern: Configuration in Code
      2. Antipattern: Manual Stack Parameters
      3. Pattern: Stack Environment Variables
      4. Pattern: Scripted Parameters
      5. Pattern: Stack Configuration Files
      6. Pattern: Deployment Wrapper Stack
      7. Pattern: Pipeline Stack Parameters
      8. Pattern: Stack Parameter Registry
    4. Implementing a Configuration Registry
      1. Integrated Infrastructure Automation Tool Registries
      2. Standalone Pacakged Configuration Registries
      3. IaaS Platform Registry Services
      4. Build Your Own Configuration Registry
      5. Single or Multiple Configuration Registries
    5. Handling Secrets as Parameters
      1. Encrypting Secrets
      2. Secretless Authorization
      3. Injecting Secrets at Runtime
      4. Disposable Secrets
    6. Conclusion
  12. 9. Integrating Deployment Stacks
    1. Example Infrastructure Deployment Stacks
    2. Patterns for Integrating Deployment Stacks
      1. Pattern: Resource Matching
      2. Pattern: Stack State Lookup
      3. Also Know As
      4. Pattern: Integration Registry Lookup
      5. Also Know As
    3. Dependency Injection
    4. Conclusion
  13. 10. Designing Environments
    1. Multi-Environment Architectures
    2. Multiple Delivery Environments
    3. Splitting Environments For Alignment
      1. Aligning Environments To System Architecture
      2. Aligning Environments To Organizational Structure
      3. Aligning Environments To Governance Concerns
    4. Multiple Environment Replicas
      1. Designing Environments For Operability Scenarios
      2. Distributing Environments Geographically
      3. Replicating Environments for User Bases
    5. Environment implementation layers
      1. Design forces for choosing the environment implementation layer
      2. Testing and delivering changes to environment infrastructure
    6. IaaS Resource Groups and Environments
    7. Building Environments with Multiple Stacks
    8. Conclusion
  14. About the Author

Product information

  • Title: Infrastructure as Code, 3rd Edition
  • Author(s): Kief Morris
  • Release date: March 2025
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098150358